brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.9 KiB · bde1c2f Raw
60 lines · plain
1# REQUIRES: zstd2## Test --compress-debug-sections=zstd and decompression.3 4# RUN: yaml2obj %p/Inputs/compress-debug-sections.yaml -o %t && llvm-objcopy %t5# RUN: llvm-objcopy --compress-debug-sections=zstd %t %t-zstd6# RUN: llvm-objcopy --decompress-debug-sections %t-zstd %t-de7# RUN: cmp %t %t-de8 9# RUN: llvm-readelf -S -r -x .debug_foo %t-zstd | FileCheck %s --check-prefixes=CHECK,COMPRESSED10# RUN: llvm-readelf -S -r -x .debug_foo %t-de | FileCheck %s --check-prefixes=CHECK,DECOMPRESSED11 12# CHECK:             Name              Type            Address          Off    Size   ES Flg Lk Inf Al13# COMPRESSED:        .debug_foo        PROGBITS        0000000000000000 000040 {{.*}} 00   C  0   0  814# COMPRESSED-NEXT:   .notdebug_foo     PROGBITS        0000000000000000 {{.*}} 000008 00      0   0  015# COMPRESSED:        .debug_alloc      PROGBITS        0000000000000000 {{.*}} 000040 00   A  0   0  016# DECOMPRESSED:      .debug_foo        PROGBITS        0000000000000000 000040 000008 00      0   0  017# DECOMPRESSED-NEXT: .notdebug_foo     PROGBITS        0000000000000000 {{.*}} 000008 00      0   0  018# DECOMPRESSED:      .debug_alloc      PROGBITS        0000000000000000 {{.*}} 000040 00   A  0   0  019 20## Relocations do not change.21# CHECK:             Relocation section '.rela.debug_foo' at offset {{.*}} contains 2 entries:22# CHECK-NEXT:            Offset23# CHECK-NEXT:        0000000000000001  000000010000000a R_X86_64_32            0000000000000000 .debug_foo + 024# CHECK-NEXT:        0000000000000002  000000020000000a R_X86_64_32            0000000000000000 .notdebug_foo + 025 26# COMPRESSED:        Hex dump of section '.debug_foo':27## ch_type == ELFCOMPRESS_ZSTD (2)28# COMPRESSED-NEXT:   0x00000000 02000000 00000000 08000000 0000000029# COMPRESSED-NEXT:   0x00000010 00000000 00000000 {{.*}}30 31## --compress-debug-sections does not update a compressed section. Its compression32## type does not change.33# RUN: llvm-objcopy --compress-debug-sections=zstd %t-zstd %t-zstd-zstd34# RUN: cmp %t-zstd %t-zstd-zstd35# RUN: %if zlib %{ llvm-objcopy --compress-debug-sections=zlib %t-zstd %t-zstd-zlib && cmp %t-zstd %t-zstd-zlib %}36 37## Test roundtrip for ELFCLASS32.38# RUN: yaml2obj %p/Inputs/compress-debug-sections.yaml -o %t32 && llvm-objcopy %t3239# RUN: llvm-objcopy --compress-debug-sections=zstd %t32 %t32-zstd40# RUN: llvm-objcopy --decompress-debug-sections %t32-zstd %t32-de41# RUN: cmp %t32 %t32-de42 43# RUN: yaml2obj %s -o %t-corrupted44# RUN: not llvm-objcopy --decompress-debug-sections %t-corrupted /dev/null 2>&1 | FileCheck %s -DFILE=%t-corrupted --check-prefix=ERR45 46# ERR: error: '[[FILE]]': failed to decompress section '.debug_info': Src size is incorrect47 48--- !ELF49FileHeader:50  Class:   ELFCLASS6451  Data:    ELFDATA2LSB52  Type:    ET_REL53  Machine: EM_X86_6454Sections:55  - Type:         SHT_PROGBITS56    Name:         .debug_info57    Flags:        [ SHF_COMPRESSED ]58    AddressAlign: 859    Content:      "020000000000000004000000000000000100000000000000ffffffff"60