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