diff options
Diffstat (limited to 'llvm/test')
6 files changed, 146 insertions, 0 deletions
diff --git a/llvm/test/tools/llvm-objcopy/Inputs/compress-debug-sections.yaml b/llvm/test/tools/llvm-objcopy/Inputs/compress-debug-sections.yaml new file mode 100644 index 00000000000..bb1e9e6c338 --- /dev/null +++ b/llvm/test/tools/llvm-objcopy/Inputs/compress-debug-sections.yaml @@ -0,0 +1,21 @@ +--- !ELF +FileHeader: + Class: ELFCLASS64 + Data: ELFDATA2LSB + Type: ET_REL + Machine: EM_X86_64 +Sections: + - Name: .debug_foo + Type: SHT_PROGBITS + Content: 0000000000000000 + - Name: .notdebug_foo + Type: SHT_PROGBITS + Content: 0000000000000000 + - Name: .rela.debug_foo + Type: SHT_RELA + Info: .debug_foo + Relocations: + - Offset: 0x1 + Symbol: .debug_foo + Type: R_X86_64_32 +... diff --git a/llvm/test/tools/llvm-objcopy/compress-debug-sections-default-gnu.test b/llvm/test/tools/llvm-objcopy/compress-debug-sections-default-gnu.test new file mode 100644 index 00000000000..9db3d3b7f9c --- /dev/null +++ b/llvm/test/tools/llvm-objcopy/compress-debug-sections-default-gnu.test @@ -0,0 +1,9 @@ +# REQUIRES: zlib + +# RUN: yaml2obj %p/Inputs/compress-debug-sections.yaml -o %t.o +# RUN: llvm-objcopy --compress-debug-sections --compress-debug-sections=zlib-gnu %t.o %t-compressed.o +# RUN: llvm-objdump -s %t-compressed.o | FileCheck %s + +# CHECK: .zdebug_foo: +# CHECK: ZLIB + diff --git a/llvm/test/tools/llvm-objcopy/compress-debug-sections-default.test b/llvm/test/tools/llvm-objcopy/compress-debug-sections-default.test new file mode 100644 index 00000000000..8ed887da3b0 --- /dev/null +++ b/llvm/test/tools/llvm-objcopy/compress-debug-sections-default.test @@ -0,0 +1,13 @@ +# REQUIRES: zlib + +# RUN: yaml2obj %p/Inputs/compress-debug-sections.yaml -o %t.o +# RUN: llvm-objcopy --compress-debug-sections %t.o %t-compressed.o +# RUN: llvm-readobj -s %t-compressed.o | FileCheck %s + +# CHECK: Name: .debug_foo +# CHECK-NEXT: Type: SHT_PROGBITS +# CHECK-NEXT: Flags [ +# CHECK-NEXT: SHF_COMPRESSED +# CHECK-NEXT: ] +# CHECK-NOT: Name: .debug_foo + diff --git a/llvm/test/tools/llvm-objcopy/compress-debug-sections-invalid-format.test b/llvm/test/tools/llvm-objcopy/compress-debug-sections-invalid-format.test new file mode 100644 index 00000000000..854dfe26560 --- /dev/null +++ b/llvm/test/tools/llvm-objcopy/compress-debug-sections-invalid-format.test @@ -0,0 +1,5 @@ +# RUN: yaml2obj %p/Inputs/compress-debug-sections.yaml -o %t.o +# RUN: not llvm-objcopy --compress-debug-sections=zlib-fake %t.o 2>&1 | FileCheck %s + +# CHECK: Invalid or unsupported --compress-debug-sections format: zlib-fake. + diff --git a/llvm/test/tools/llvm-objcopy/compress-debug-sections-zlib-gnu.test b/llvm/test/tools/llvm-objcopy/compress-debug-sections-zlib-gnu.test new file mode 100644 index 00000000000..eb697522de2 --- /dev/null +++ b/llvm/test/tools/llvm-objcopy/compress-debug-sections-zlib-gnu.test @@ -0,0 +1,49 @@ +# REQUIRES: zlib + +# RUN: yaml2obj %p/Inputs/compress-debug-sections.yaml -o %t.o +# RUN: llvm-objcopy --compress-debug-sections=zlib-gnu %t.o %t-compressed.o + +# RUN: llvm-objdump -s %t.o -section=.debug_foo | FileCheck %s +# RUN: llvm-objdump -s %t-compressed.o | FileCheck %s --check-prefix=CHECK-COMPRESSED +# RUN: llvm-readobj -relocations -s %t-compressed.o | FileCheck %s --check-prefix=CHECK-FLAGS + +# CHECK: .debug_foo: + +# CHECK-COMPRESSED: .zdebug_foo: +# CHECK-COMPRESSED: ZLIB +# CHECK-COMPRESSED: .notdebug_foo: + +# CHECK-FLAGS-NOT: Name: .debug_foo +# CHECK-FLAGS: Index: 1 +# CHECK-FLAGS-NEXT: Name: .zdebug_foo +# CHECK-FLAGS-NEXT: Type: SHT_PROGBITS +# CHECK-FLAGS-NEXT: Flags [ +# CHECK-FLAGS-NEXT: ] +# CHECK-FLAGS-NEXT: Address: +# CHECK-FLAGS-NEXT: Offset: +# CHECK-FLAGS-NEXT: Size: 23 + +# CHECK-FLAGS: Name: .notdebug_foo +# CHECK-FLAGS-NEXT: Type: SHT_PROGBITS +# CHECK-FLAGS-NEXT: Flags [ +# CHECK-FLAGS-NEXT: ] +# CHECK-FLAGS-NEXT: Address: +# CHECK-FLAGS-NEXT: Offset: +# CHECK-FLAGS-NEXT: Size: 8 + +# CHECK-FLAGS: Name: .rela.debug_foo +# CHECK-FLAGS-NEXT: Type: SHT_RELA +# CHECK-FLAGS-NEXT: Flags [ +# CHECK-FLAGS-NEXT: ] +# CHECK-FLAGS-NEXT: Address: +# CHECK-FLAGS-NEXT: Offset: +# CHECK-FLAGS-NEXT: Size: +# CHECK-FLAGS-NEXT: Link: +# CHECK-FLAGS-NEXT: Info: 1 + +# CHECK-FLAGS: Relocations [ +# CHECK-FLAGS-NEXT: .rela.debug_foo { +# CHECK-FLAGS-NEXT: 0x1 R_X86_64_32 - 0x0 +# CHECK-FLAGS-NEXT: } +# CHECK-FLAGS-NEXT: ] + diff --git a/llvm/test/tools/llvm-objcopy/compress-debug-sections-zlib.test b/llvm/test/tools/llvm-objcopy/compress-debug-sections-zlib.test new file mode 100644 index 00000000000..843dbf267d7 --- /dev/null +++ b/llvm/test/tools/llvm-objcopy/compress-debug-sections-zlib.test @@ -0,0 +1,49 @@ +# REQUIRES: zlib + +# RUN: yaml2obj %p/Inputs/compress-debug-sections.yaml -o %t.o +# RUN: llvm-objcopy --compress-debug-sections=zlib %t.o %t-compressed.o + +# RUN: llvm-objdump -s %t.o -section=.debug_foo | FileCheck %s +# RUN: llvm-objdump -s %t-compressed.o | FileCheck %s --check-prefix=CHECK-COMPRESSED +# RUN: llvm-readobj -relocations -s %t-compressed.o | FileCheck %s --check-prefix=CHECK-FLAGS + +# CHECK: .debug_foo: + +# CHECK-COMPRESSED: .debug_foo: +# CHECK-COMPRESSED: .notdebug_foo: + +# CHECK-FLAGS: Index: 1 +# CHECK-FLAGS-NEXT: Name: .debug_foo +# CHECK-FLAGS-NEXT: Type: SHT_PROGBITS +# CHECK-FLAGS-NEXT: Flags [ +# CHECK-FLAGS-NEXT: SHF_COMPRESSED +# CHECK-FLAGS-NEXT: ] +# CHECK-FLAGS-NEXT: Address: +# CHECK-FLAGS-NEXT: Offset: +# CHECK-FLAGS-NEXT: Size: 35 +# CHECK-FLAGS-NOT: Name: .debug_foo + +# CHECK-FLAGS: Name: .notdebug_foo +# CHECK-FLAGS-NEXT: Type: SHT_PROGBITS +# CHECK-FLAGS-NEXT: Flags [ +# CHECK-FLAGS-NEXT: ] +# CHECK-FLAGS-NEXT: Address: +# CHECK-FLAGS-NEXT: Offset: +# CHECK-FLAGS-NEXT: Size: 8 + +# CHECK-FLAGS: Name: .rela.debug_foo +# CHECK-FLAGS-NEXT: Type: SHT_RELA +# CHECK-FLAGS-NEXT: Flags [ +# CHECK-FLAGS-NEXT: ] +# CHECK-FLAGS-NEXT: Address: +# CHECK-FLAGS-NEXT: Offset: +# CHECK-FLAGS-NEXT: Size: +# CHECK-FLAGS-NEXT: Link: +# CHECK-FLAGS-NEXT: Info: 1 + +# CHECK-FLAGS: Relocations [ +# CHECK-FLAGS-NEXT: .rela.debug_foo { +# CHECK-FLAGS-NEXT: 0x1 R_X86_64_32 - 0x0 +# CHECK-FLAGS-NEXT: } +# CHECK-FLAGS-NEXT: ] + |