43 lines · plain
1## Show that llvm-objcopy correctly updates the elf header and program header2## table when they are within a segment.3 4# RUN: yaml2obj %s -o %t.in5## Validate that the properties are different before the removal.6# RUN: llvm-readobj --file-headers --program-headers %t.in | FileCheck %s --check-prefix=BEFORE7# RUN: llvm-objcopy %t.in %t.out -R .remove_me8# RUN: llvm-readobj --file-headers --program-headers %t.out | FileCheck %s --check-prefix=AFTER9 10# BEFORE: SectionHeaderCount: 611# BEFORE: Type: PT_LOAD12# BEFORE-NEXT: Offset: 0x013# BEFORE: Type: PT_LOAD14# BEFORE-NEXT: Offset: 0xC015 16# AFTER: SectionHeaderCount: 317# AFTER: Type: PT_LOAD18# AFTER-NEXT: Offset: 0x019# AFTER: Type: PT_LOAD20# AFTER-NEXT: Offset: 0xB021 22--- !ELF23FileHeader:24 Class: ELFCLASS6425 Data: ELFDATA2LSB26 Type: ET_EXEC27 Machine: EM_X86_6428Sections:29 - Name: .remove_me30 Type: SHT_PROGBITS31 Size: 0x1032 - Name: .keep_me33 Type: SHT_PROGBITS34 Size: 0x1035ProgramHeaders:36 - Type: PT_LOAD37 Offset: 038 FileSize: 176 # sizeof(Elf64_Ehdr) + 2 * sizeof(Elf64_Phdr)39 - Type: PT_LOAD40 FirstSec: .keep_me41 LastSec: .keep_me42Symbols: []43