xref: /llvm-project/llvm/test/tools/llvm-objcopy/COFF/add-gnu-debuglink.test (revision 55c81d4282c5da0189711261a11537bc8a7fe85c)
1*55c81d42SFangrui SongRUN: yaml2obj %p/Inputs/x86_64-exe.yaml -o %t.in123.exe
212b6b802SMartin Storsjo
312b6b802SMartin Storsjo# Using a debuglink filename with a length that is a multiple of 4, to
412b6b802SMartin Storsjo# showcase padding in CONTENTS below.
512b6b802SMartin Storsjo
612b6b802SMartin StorsjoRUN: llvm-objcopy --add-gnu-debuglink=%t.in123.exe %t.in123.exe %t.out.exe
7e29e30b1SFangrui SongRUN: llvm-readobj --sections %t.out.exe | FileCheck %s --check-prefix=SECTIONS
812b6b802SMartin StorsjoRUN: llvm-objdump -s %t.out.exe | FileCheck %s --check-prefix=CONTENTS
912b6b802SMartin Storsjo
1012b6b802SMartin Storsjo# Show the last of the preexisting sections, which is used for choosing
1112b6b802SMartin Storsjo# a virtual address for the generated one.
1212b6b802SMartin Storsjo
1312b6b802SMartin StorsjoSECTIONS:        Section {
1412b6b802SMartin StorsjoSECTIONS:          Number: 4
1512b6b802SMartin StorsjoSECTIONS-NEXT:     Name: .pdata
1612b6b802SMartin StorsjoSECTIONS-NEXT:     VirtualSize: 0x18
1712b6b802SMartin StorsjoSECTIONS-NEXT:     VirtualAddress: 0x4000
1812b6b802SMartin StorsjoSECTIONS-NEXT:     RawDataSize: 512
1912b6b802SMartin StorsjoSECTIONS:        Section {
2012b6b802SMartin StorsjoSECTIONS-NEXT:     Number: 5
2112b6b802SMartin StorsjoSECTIONS-NEXT:     Name: .gnu_debuglink
2212b6b802SMartin StorsjoSECTIONS-NEXT:     VirtualSize: 0x2C
2312b6b802SMartin StorsjoSECTIONS-NEXT:     VirtualAddress: 0x5000
2412b6b802SMartin StorsjoSECTIONS-NEXT:     RawDataSize: 512
2512b6b802SMartin StorsjoSECTIONS-NEXT:     PointerToRawData:
2612b6b802SMartin StorsjoSECTIONS-NEXT:     PointerToRelocations:
2712b6b802SMartin StorsjoSECTIONS-NEXT:     PointerToLineNumbers:
2812b6b802SMartin StorsjoSECTIONS-NEXT:     RelocationCount:
2912b6b802SMartin StorsjoSECTIONS-NEXT:     LineNumberCount:
3012b6b802SMartin StorsjoSECTIONS-NEXT:     Characteristics [ (0x42000040)
3112b6b802SMartin StorsjoSECTIONS-NEXT:       IMAGE_SCN_CNT_INITIALIZED_DATA (0x40)
3212b6b802SMartin StorsjoSECTIONS-NEXT:       IMAGE_SCN_MEM_DISCARDABLE (0x2000000)
3312b6b802SMartin StorsjoSECTIONS-NEXT:       IMAGE_SCN_MEM_READ (0x40000000)
3412b6b802SMartin StorsjoSECTIONS-NEXT:     ]
3512b6b802SMartin Storsjo
3612b6b802SMartin Storsjo# Note: The last 4 bytes here are the crc of the referenced file - if the
3712b6b802SMartin Storsjo# yaml2obj generated file changes, this crc changes.
3812b6b802SMartin Storsjo
3912b6b802SMartin StorsjoCONTENTS: Contents of section .gnu_debuglink:
4012b6b802SMartin StorsjoCONTENTS:  40005000 6164642d 676e752d 64656275 676c696e  add-gnu-debuglin
4112b6b802SMartin StorsjoCONTENTS:  40005010 6b2e7465 73742e74 6d702e69 6e313233  k.test.tmp.in123
4212b6b802SMartin StorsjoCONTENTS:  40005020 2e657865 00000000 7929adc3           .exe
43