| 1 |
## Disallow (de)compression for sections within a segment as they are |
| 2 |
## effectively immutable. |
| 3 |
# RUN: rm -rf %t && mkdir %t && cd %t |
| 4 |
# RUN: yaml2obj %s -o a |
| 5 |
# RUN: not llvm-objcopy a /dev/null --compress-sections .text=zlib 2>&1 | FileCheck %s --implicit-check-not=error: |
| 6 |
|
| 7 |
# CHECK: error: 'a': section '.text' within a segment cannot be (de)compressed |
| 8 |
|
| 9 |
# RUN: not llvm-objcopy a /dev/null --compress-sections foo=none 2>&1 | FileCheck %s --check-prefix=CHECK2 --implicit-check-not=error: |
| 10 |
|
| 11 |
# CHECK2: error: 'a': section 'foo' within a segment cannot be (de)compressed |
| 12 |
|
| 13 |
## There is an error even if 'foo' is already compressed with zlib. |
| 14 |
# RUN: not llvm-objcopy a /dev/null --compress-sections foo=zlib 2>&1 | FileCheck %s --check-prefix=CHECK3 --implicit-check-not=error: |
| 15 |
|
| 16 |
# CHECK3: error: 'a': section 'foo' within a segment cannot be (de)compressed |
| 17 |
|
| 18 |
--- !ELF |
| 19 |
FileHeader: |
| 20 |
Class: ELFCLASS64 |
| 21 |
Data: ELFDATA2LSB |
| 22 |
Type: ET_EXEC |
| 23 |
Machine: EM_X86_64 |
| 24 |
ProgramHeaders: |
| 25 |
- Type: PT_LOAD |
| 26 |
FirstSec: .text |
| 27 |
LastSec: foo |
| 28 |
Align: 0x1000 |
| 29 |
Offset: 0x1000 |
| 30 |
Sections: |
| 31 |
- Name: .text |
| 32 |
Type: SHT_PROGBITS |
| 33 |
Offset: 0x1000 |
| 34 |
Content: C3 |
| 35 |
- Name: foo |
| 36 |
Type: SHT_PROGBITS |
| 37 |
Flags: [ SHF_COMPRESSED ] |
| 38 |
Content: 010000000000000040000000000000000100000000000000789cd36280002d3269002f800151 |