48 lines · plain
1# This test has a subtle purpose. Because of the specifics of the layout2# algorithm if we're not careful cycles can occur when we resolve the order3# that we should layout segments in. In this test we're making sure that the4# PT_LOAD segment won't set the PT_NOTE segment as the first to be laid out5# while the PT_NOTE segment sets the PT_LOAD load to be the first to be laid6# out. This problem becomes visible if the layout of the file changes due to7# the removal of a section. We use -O binary here because removing a section8# in this way won't cause the location of the PT_LOAD segment to change if we9# don't.10 11# RUN: yaml2obj %s -o %t12# RUN: llvm-objcopy -R .note -O binary %t %t213# RUN: od -Ax -t x1 %t2 | FileCheck %s14 15!ELF16FileHeader:17 Class: ELFCLASS6418 Data: ELFDATA2LSB19 Type: ET_EXEC20 Machine: EM_X86_6421Sections:22 - Name: .note23 Type: SHT_PROGBITS24 Flags: [ SHF_ALLOC ]25 Address: 0x100026 AddressAlign: 0x100027 Content: "32323232"28 Size: 3229 - Name: .rodata30 Flags: [ SHF_ALLOC ]31 Type: SHT_PROGBITS32 Address: 0x102033 Size: 406434 Content: "DEADBEEF"35ProgramHeaders:36 - Type: PT_LOAD37 Flags: [ PF_R ]38 VAddr: 0x100039 FirstSec: .note40 LastSec: .rodata41 - Type: PT_NOTE42 Flags: [ PF_R ]43 VAddr: 0x100044 FirstSec: .note45 LastSec: .note46 47# CHECK: 000000 de ad be ef48