xref: /llvm-project/lld/test/ELF/compress-sections-special.s (revision e53c53559bb6ca6d69b9c0f45988e33fd0cefb6e)
1# REQUIRES: x86, zlib
2
3# RUN: rm -rf %t && mkdir %t && cd %t
4# RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o a.o
5# RUN: ld.lld -pie a.o --compress-sections .strtab=zlib --compress-sections .symtab=zlib -o out
6# RUN: llvm-readelf -Ss -x .strtab out 2>&1 | FileCheck %s
7
8# CHECK:      nonalloc0  PROGBITS 0000000000000000 [[#%x,]] [[#%x,]] 00     0 0  1
9# CHECK:      .symtab    SYMTAB   0000000000000000 [[#%x,]] [[#%x,]] 18  C 12 3  1
10# CHECK-NEXT: .shstrtab  STRTAB   0000000000000000 [[#%x,]] [[#%x,]] 00     0 0  1
11# CHECK-NEXT: .strtab    STRTAB   0000000000000000 [[#%x,]] [[#%x,]] 00  C  0 0  1
12
13## TODO Add compressed SHT_STRTAB/SHT_SYMTAB support to llvm-readelf
14# CHECK:      warning: {{.*}}: unable to get the string table for the SHT_SYMTAB section: SHT_STRTAB string table section
15
16# CHECK:      Hex dump of section '.strtab':
17# CHECK-NEXT: 01000000 00000000 5c000000 00000000
18# CHECK-NEXT: 01000000 00000000 {{.*}}
19
20# RUN: not ld.lld -shared a.o --compress-sections .dynstr=zlib 2>&1 | FileCheck %s --check-prefix=ERR-ALLOC
21# ERR-ALLOC: error: --compress-sections: section '.dynstr' with the SHF_ALLOC flag cannot be compressed
22
23.globl _start, g0, g1
24_start:
25l0:
26g0:
27g1:
28.globl ggggggggggggggggggggggggggggggg0
29.globl ggggggggggggggggggggggggggggggg1
30
31.section nonalloc0,""
32.quad .text+1
33.quad .text+2
34