55 lines · yaml
1## Show how yaml2obj sets physical and virtual addresses of program headers.2 3# RUN: yaml2obj %s -o %t4# RUN: llvm-readelf --sections --segments %t | FileCheck %s5 6# CHECK: Section Headers:7# CHECK: [Nr] Name Type Address Off Size ES Flg8# CHECK: [ 1] .foo PROGBITS 0000000000001234 000120 000001 00 A9 10# CHECK: Program Headers:11# CHECK-NEXT: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align12# CHECK-NEXT: LOAD 0x000000 0x0000000000000000 0x0000000000000000 0x000000 0x000000 R E 0x113# CHECK-NEXT: LOAD 0x000120 0x0000000000000000 0x0000000000000000 0x000001 0x000001 R E 0x114# CHECK-NEXT: LOAD 0x000120 0x00000000aaaa1000 0x00000000aaaa1000 0x000001 0x000001 R E 0x115# CHECK-NEXT: LOAD 0x000120 0x00000000aaaa1000 0x00000000bbbb2000 0x000001 0x000001 R E 0x116 17--- !ELF18FileHeader:19 Class: ELFCLASS6420 Data: ELFDATA2LSB21 Type: ET_EXEC22Sections:23 - Name: .foo24 Type: SHT_PROGBITS25 Flags: [ SHF_ALLOC ]26 Size: 0x127 Address: 0x123428ProgramHeaders:29## Show what virtual and physical address we set by default for the case where30## a program header has no sections.31 - Type: PT_LOAD32 Flags: [ PF_X, PF_R ]33## Show what virtual and physical address we set by default for the case34## where a program header includes a section with a virtual address that35## is explicitly set.36 - Type: PT_LOAD37 Flags: [ PF_X, PF_R ]38 FirstSec: .foo39 LastSec: .foo40## Now we have a program header that has a virtual address different to41## the address of the section included. Show that the default physical address42## is equal to the program header's virtual address.43 - Type: PT_LOAD44 Flags: [ PF_X, PF_R ]45 VAddr: 0xAAAA100046 FirstSec: .foo47 LastSec: .foo48## Show that we are able to set different virtual and physical addresses.49 - Type: PT_LOAD50 Flags: [ PF_X, PF_R ]51 VAddr: 0xAAAA100052 PAddr: 0xBBBB200053 FirstSec: .foo54 LastSec: .foo55