47 lines · plain
1# Show that --remove-section removes sections in segments.2 3# RUN: yaml2obj %s -o %t4 5# Validate the offsets for the later parts of the test.6# RUN: llvm-objcopy %t %t.copy7# Skip to the start of the sections, which should be immediately after the8# program header table (i.e. sizeof(Elf64_Ehdr) + sizeof(Elf64_Phdr) == 120).9# RUN: od -t x1 -N 16 -j 120 %t.copy | FileCheck %s --check-prefix=COPY10 11# COPY: 11 22 33 44 55 66 77 8812 13# RUN: llvm-objcopy --remove-section non_alloc %t %t.nonalloc14# RUN: llvm-readelf --sections %t.nonalloc | FileCheck %s --check-prefix=NONALLOC-SHDRS15# RUN: od -t x1 -N 16 -j 120 %t.nonalloc | FileCheck %s --check-prefix=NONALLOC-BYTES16 17# NONALLOC-SHDRS-NOT: non_alloc18# NONALLOC-BYTES: 11 22 33 44 00 00 00 0019 20# RUN: llvm-objcopy --remove-section shf_alloc %t %t.alloc21# RUN: llvm-readelf --sections %t.alloc | FileCheck %s --check-prefix=ALLOC-SHDRS22# RUN: od -t x1 -N 16 -j 120 %t.alloc | FileCheck %s --check-prefix=ALLOC-BYTES23 24# ALLOC-SHDRS-NOT: shf_alloc25# ALLOC-BYTES: 00 00 00 00 55 66 77 8826 27--- !ELF28FileHeader:29 Class: ELFCLASS6430 Data: ELFDATA2LSB31 Type: ET_EXEC32 Machine: EM_X86_6433Sections:34 - Name: shf_alloc35 Type: SHT_PROGBITS36 Flags: [SHF_ALLOC]37 Content: '11223344'38 - Name: non_alloc39 Type: SHT_PROGBITS40 Flags: []41 Content: '55667788'42ProgramHeaders:43 # Use an arbitrary segment type to show that the segment type is unimportant.44 - Type: 0x6123456745 FirstSec: shf_alloc46 LastSec: non_alloc47