File: compress-debug-sections-zlib.test

package info (click to toggle)
llvm-toolchain-19 1%3A19.1.7-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,998,520 kB
  • sloc: cpp: 6,951,680; ansic: 1,486,157; asm: 913,598; python: 232,024; f90: 80,126; objc: 75,281; lisp: 37,276; pascal: 16,990; sh: 10,009; ml: 5,058; perl: 4,724; awk: 3,523; makefile: 3,167; javascript: 2,504; xml: 892; fortran: 664; cs: 573
file content (50 lines) | stat: -rw-r--r-- 2,558 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# REQUIRES: zlib
## Test --compress-debug-sections=zlib and uncompression.

# RUN: yaml2obj %p/Inputs/compress-debug-sections.yaml -o %t.o && llvm-objcopy %t.o
# RUN: llvm-objcopy --compress-debug-sections=zlib %t.o %t-zlib.o
# RUN: llvm-objcopy --decompress-debug-sections %t-zlib.o %t-un.o
# RUN: cmp %t.o %t-un.o

# RUN: llvm-readelf -S -r -x .debug_foo %t-zlib.o | FileCheck %s --check-prefixes=CHECK,COMPRESSED
# RUN: llvm-readelf -S -r -x .debug_foo %t-un.o | FileCheck %s --check-prefixes=CHECK,UNCOMPRESSED

# CHECK:             Name              Type            Address          Off    Size   ES Flg Lk Inf Al
# COMPRESSED:        .debug_foo        PROGBITS        0000000000000000 000040 {{.*}} 00   C  0   0  8
# COMPRESSED-NEXT:   .notdebug_foo     PROGBITS        0000000000000000 {{.*}} 000008 00      0   0  0
# COMPRESSED:        .debug_alloc      PROGBITS        0000000000000000 {{.*}} 000040 00   A  0   0  0
# UNCOMPRESSED:      .debug_foo        PROGBITS        0000000000000000 000040 000008 00      0   0  0
# UNCOMPRESSED-NEXT: .notdebug_foo     PROGBITS        0000000000000000 {{.*}} 000008 00      0   0  0
# UNCOMPRESSED:      .debug_alloc      PROGBITS        0000000000000000 {{.*}} 000040 00   A  0   0  0

## Relocations do not change.
# CHECK:             Relocation section '.rela.debug_foo' at offset {{.*}} contains 2 entries:
# CHECK-NEXT:            Offset
# CHECK-NEXT:        0000000000000001  000000010000000a R_X86_64_32            0000000000000000 .debug_foo + 0
# CHECK-NEXT:        0000000000000002  000000020000000a R_X86_64_32            0000000000000000 .notdebug_foo + 0

# COMPRESSED:        Hex dump of section '.debug_foo':
# COMPRESSED-NEXT:   0x00000000 01000000 {{.*}}   08000000 00000000
# COMPRESSED-NEXT:   0x00000010 00000000 00000000 {{.*}}

## --compress-debug-sections does not update a compressed section.
# RUN: llvm-objcopy --compress-debug-sections=zlib %t-zlib.o %t-zlib-zlib.o
# RUN: cmp %t-zlib.o %t-zlib-zlib.o

# RUN: yaml2obj %s -o %t-corrupted
# RUN: not llvm-objcopy --decompress-debug-sections %t-corrupted /dev/null 2>&1 | FileCheck %s -DFILE=%t-corrupted --check-prefix=ERR

# ERR: error: '[[FILE]]': failed to decompress section '.debug_info': zlib error: Z_DATA_ERROR

--- !ELF
FileHeader:
  Class:   ELFCLASS64
  Data:    ELFDATA2LSB
  Type:    ET_REL
  Machine: EM_X86_64
Sections:
  - Type:         SHT_PROGBITS
    Name:         .debug_info
    Flags:        [ SHF_COMPRESSED ]
    AddressAlign: 8
    Content:      "010000000000000004000000000000000100000000000000ffffffff"