diff options
| author | Martin Storsjo <martin@martin.st> | 2019-01-23 08:25:28 +0000 | 
|---|---|---|
| committer | Martin Storsjo <martin@martin.st> | 2019-01-23 08:25:28 +0000 | 
| commit | 12b6b802080e0000ce81c58aeb15b4a59290f86f (patch) | |
| tree | a9f83e06bf77c840559032a036146fc23afcb87d /llvm/test/tools/llvm-objcopy/COFF/add-gnu-debuglink.test | |
| parent | 3ff5dfd7359de4a6e272ab87b96d1e73b1e57469 (diff) | |
| download | bcm5719-llvm-12b6b802080e0000ce81c58aeb15b4a59290f86f.tar.gz bcm5719-llvm-12b6b802080e0000ce81c58aeb15b4a59290f86f.zip | |
Reapply: [llvm-objcopy] [COFF] Implement --add-gnu-debuglink
This was reverted since it broke a couple buildbots. The reason
for the breakage is not yet known, but this time, the test has
got more diagnostics added, to hopefully allow figuring out
what goes wrong.
Differential Revision: https://reviews.llvm.org/D57007
llvm-svn: 351931
Diffstat (limited to 'llvm/test/tools/llvm-objcopy/COFF/add-gnu-debuglink.test')
| -rw-r--r-- | llvm/test/tools/llvm-objcopy/COFF/add-gnu-debuglink.test | 48 | 
1 files changed, 48 insertions, 0 deletions
| diff --git a/llvm/test/tools/llvm-objcopy/COFF/add-gnu-debuglink.test b/llvm/test/tools/llvm-objcopy/COFF/add-gnu-debuglink.test new file mode 100644 index 00000000000..cf3a9bba920 --- /dev/null +++ b/llvm/test/tools/llvm-objcopy/COFF/add-gnu-debuglink.test @@ -0,0 +1,48 @@ +RUN: yaml2obj %p/Inputs/x86_64-exe.yaml > %t.in123.exe + +# Using a debuglink filename with a length that is a multiple of 4, to +# showcase padding in CONTENTS below. + +RUN: llvm-objcopy --add-gnu-debuglink=%t.in123.exe %t.in123.exe %t.out.exe + +# Temporary debugging of issues with this test: +RUN: ls -l %t.out.exe || true +RUN: od -Ax -t x1 %t.out.exe || true +RUN: llvm-readobj -sections %t.out.exe || true + +RUN: llvm-readobj -sections %t.out.exe | FileCheck %s --check-prefix=SECTIONS +RUN: llvm-objdump -s %t.out.exe | FileCheck %s --check-prefix=CONTENTS + +# Show the last of the preexisting sections, which is used for choosing +# a virtual address for the generated one. + +SECTIONS:        Section { +SECTIONS:          Number: 4 +SECTIONS-NEXT:     Name: .pdata +SECTIONS-NEXT:     VirtualSize: 0x18 +SECTIONS-NEXT:     VirtualAddress: 0x4000 +SECTIONS-NEXT:     RawDataSize: 512 +SECTIONS:        Section { +SECTIONS-NEXT:     Number: 5 +SECTIONS-NEXT:     Name: .gnu_debuglink +SECTIONS-NEXT:     VirtualSize: 0x2C +SECTIONS-NEXT:     VirtualAddress: 0x5000 +SECTIONS-NEXT:     RawDataSize: 512 +SECTIONS-NEXT:     PointerToRawData: +SECTIONS-NEXT:     PointerToRelocations: +SECTIONS-NEXT:     PointerToLineNumbers: +SECTIONS-NEXT:     RelocationCount: +SECTIONS-NEXT:     LineNumberCount: +SECTIONS-NEXT:     Characteristics [ (0x42000040) +SECTIONS-NEXT:       IMAGE_SCN_CNT_INITIALIZED_DATA (0x40) +SECTIONS-NEXT:       IMAGE_SCN_MEM_DISCARDABLE (0x2000000) +SECTIONS-NEXT:       IMAGE_SCN_MEM_READ (0x40000000) +SECTIONS-NEXT:     ] + +# Note: The last 4 bytes here are the crc of the referenced file - if the +# yaml2obj generated file changes, this crc changes. + +CONTENTS: Contents of section .gnu_debuglink: +CONTENTS:  40005000 6164642d 676e752d 64656275 676c696e  add-gnu-debuglin +CONTENTS:  40005010 6b2e7465 73742e74 6d702e69 6e313233  k.test.tmp.in123 +CONTENTS:  40005020 2e657865 00000000 7929adc3           .exe | 

