forked from OSchip/llvm-project
[yaml2obj] - Set a default value for `PAddr` property of a program header to a value of `VAddr`
`PAddr` corresponds to `p_paddr` of a program header, which is the segment's physical address for systems in which physical addressing is relevant. `p_paddr` is often equal to `p_vaddr`, which is the virtual address of a segment. This patch changes the default for `PAddr` from 0 to a value of `VAddr`. Differential revision: https://reviews.llvm.org/D76131
This commit is contained in:
parent
f47f4c137b
commit
b236b4cb43
|
@ -848,7 +848,7 @@ void MappingTraits<ELFYAML::ProgramHeader>::mapping(
|
|||
IO.mapOptional("Flags", Phdr.Flags, ELFYAML::ELF_PF(0));
|
||||
IO.mapOptional("Sections", Phdr.Sections);
|
||||
IO.mapOptional("VAddr", Phdr.VAddr, Hex64(0));
|
||||
IO.mapOptional("PAddr", Phdr.PAddr, Hex64(0));
|
||||
IO.mapOptional("PAddr", Phdr.PAddr, Phdr.VAddr);
|
||||
IO.mapOptional("Align", Phdr.Align);
|
||||
IO.mapOptional("FileSize", Phdr.FileSize);
|
||||
IO.mapOptional("MemSize", Phdr.MemSize);
|
||||
|
|
|
@ -33,7 +33,6 @@ ProgramHeaders:
|
|||
- Type: PT_LOAD
|
||||
Flags: [ PF_R ]
|
||||
VAddr: 0x0000
|
||||
PAddr: 0x0000
|
||||
Align: 8
|
||||
Sections:
|
||||
- Section: .dynstr
|
||||
|
@ -41,7 +40,6 @@ ProgramHeaders:
|
|||
- Type: PT_DYNAMIC
|
||||
Flags: [ PF_X, PF_R ]
|
||||
VAddr: 0x0008
|
||||
PAddr: 0x0008
|
||||
Sections:
|
||||
- Section: .dynamic
|
||||
|
||||
|
|
|
@ -33,7 +33,6 @@ ProgramHeaders:
|
|||
- Type: PT_LOAD
|
||||
Flags: [ PF_R ]
|
||||
VAddr: 0x0000
|
||||
PAddr: 0x0000
|
||||
Align: 8
|
||||
Sections:
|
||||
- Section: .dynstr
|
||||
|
@ -41,7 +40,6 @@ ProgramHeaders:
|
|||
- Type: PT_DYNAMIC
|
||||
Flags: [ PF_X, PF_R ]
|
||||
VAddr: 0x0008
|
||||
PAddr: 0x0008
|
||||
Sections:
|
||||
- Section: .dynamic
|
||||
|
||||
|
|
|
@ -35,7 +35,6 @@ ProgramHeaders:
|
|||
- Type: PT_LOAD
|
||||
Flags: [ PF_R ]
|
||||
VAddr: 0x0000
|
||||
PAddr: 0x0000
|
||||
Align: 8
|
||||
Sections:
|
||||
- Section: .dynstr
|
||||
|
@ -43,7 +42,6 @@ ProgramHeaders:
|
|||
- Type: PT_DYNAMIC
|
||||
Flags: [ PF_X, PF_R ]
|
||||
VAddr: 0x0008
|
||||
PAddr: 0x0008
|
||||
Sections:
|
||||
- Section: .dynamic
|
||||
|
||||
|
|
|
@ -35,7 +35,6 @@ ProgramHeaders:
|
|||
- Type: PT_LOAD
|
||||
Flags: [ PF_R ]
|
||||
VAddr: 0x1000
|
||||
PAddr: 0x1000
|
||||
Align: 8
|
||||
Sections:
|
||||
- Section: .dynstr
|
||||
|
@ -43,7 +42,6 @@ ProgramHeaders:
|
|||
- Type: PT_DYNAMIC
|
||||
Flags: [ PF_X, PF_R ]
|
||||
VAddr: 0x1008
|
||||
PAddr: 0x1008
|
||||
Sections:
|
||||
- Section: .dynamic
|
||||
|
||||
|
|
|
@ -39,7 +39,6 @@ ProgramHeaders:
|
|||
- Type: PT_LOAD
|
||||
Flags: [ PF_R ]
|
||||
VAddr: 0x1000
|
||||
PAddr: 0x1000
|
||||
Align: 8
|
||||
Sections:
|
||||
- Section: .dynstr
|
||||
|
@ -47,7 +46,6 @@ ProgramHeaders:
|
|||
- Type: PT_DYNAMIC
|
||||
Flags: [ PF_X, PF_R ]
|
||||
VAddr: 0x1024
|
||||
PAddr: 0x1024
|
||||
Sections:
|
||||
|
||||
# CHECK: DT_NEEDED string offset (0x000000000000ffff) outside of dynamic string table
|
||||
|
|
|
@ -38,7 +38,6 @@ ProgramHeaders:
|
|||
- Type: PT_LOAD
|
||||
Flags: [ PF_R ]
|
||||
VAddr: 0x1000
|
||||
PAddr: 0x1000
|
||||
Align: 8
|
||||
Sections:
|
||||
- Section: .dynstr
|
||||
|
@ -46,7 +45,6 @@ ProgramHeaders:
|
|||
- Type: PT_DYNAMIC
|
||||
Flags: [ PF_X, PF_R ]
|
||||
VAddr: 0x1024
|
||||
PAddr: 0x1024
|
||||
Sections:
|
||||
|
||||
# CHECK: NeededLibs:
|
||||
|
|
|
@ -30,7 +30,6 @@ ProgramHeaders:
|
|||
- Type: PT_LOAD
|
||||
Flags: [ PF_R ]
|
||||
VAddr: 0x0000
|
||||
PAddr: 0x0000
|
||||
Align: 8
|
||||
Sections:
|
||||
- Section: .dynstr
|
||||
|
@ -38,7 +37,6 @@ ProgramHeaders:
|
|||
- Type: PT_DYNAMIC
|
||||
Flags: [ PF_X, PF_R ]
|
||||
VAddr: 0x0008
|
||||
PAddr: 0x0008
|
||||
Sections:
|
||||
- Section: .dynamic
|
||||
|
||||
|
|
|
@ -29,7 +29,6 @@ ProgramHeaders:
|
|||
- Type: PT_LOAD
|
||||
Flags: [ PF_R ]
|
||||
VAddr: 0x0000
|
||||
PAddr: 0x0000
|
||||
Align: 8
|
||||
Sections:
|
||||
- Section: .dynstr
|
||||
|
@ -37,7 +36,6 @@ ProgramHeaders:
|
|||
- Type: PT_DYNAMIC
|
||||
Flags: [ PF_X, PF_R ]
|
||||
VAddr: 0x0008
|
||||
PAddr: 0x0008
|
||||
Sections:
|
||||
- Section: .dynamic
|
||||
|
||||
|
|
|
@ -37,7 +37,6 @@ ProgramHeaders:
|
|||
- Type: PT_LOAD
|
||||
Flags: [ PF_R ]
|
||||
VAddr: 0x1000
|
||||
PAddr: 0x1000
|
||||
Align: 8
|
||||
Sections:
|
||||
- Section: .dynstr
|
||||
|
@ -45,7 +44,6 @@ ProgramHeaders:
|
|||
- Type: PT_DYNAMIC
|
||||
Flags: [ PF_X, PF_R ]
|
||||
VAddr: 0x1018
|
||||
PAddr: 0x1018
|
||||
Sections:
|
||||
- Section: .dynamic
|
||||
|
||||
|
|
|
@ -36,7 +36,6 @@ ProgramHeaders:
|
|||
- Type: PT_LOAD
|
||||
Flags: [ PF_R ]
|
||||
VAddr: 0x1000
|
||||
PAddr: 0x1000
|
||||
Align: 8
|
||||
Sections:
|
||||
- Section: .dynstr
|
||||
|
@ -44,7 +43,6 @@ ProgramHeaders:
|
|||
- Type: PT_DYNAMIC
|
||||
Flags: [ PF_X, PF_R ]
|
||||
VAddr: 0x1018
|
||||
PAddr: 0x1018
|
||||
Sections:
|
||||
- Section: .dynamic
|
||||
|
||||
|
|
|
@ -36,7 +36,6 @@ ProgramHeaders:
|
|||
- Type: PT_LOAD
|
||||
Flags: [ PF_R ]
|
||||
VAddr: 0x1000
|
||||
PAddr: 0x1000
|
||||
Align: 8
|
||||
Sections:
|
||||
- Section: .dynstr
|
||||
|
@ -44,7 +43,6 @@ ProgramHeaders:
|
|||
- Type: PT_DYNAMIC
|
||||
Flags: [ PF_X, PF_R ]
|
||||
VAddr: 0x1018
|
||||
PAddr: 0x1018
|
||||
Sections:
|
||||
- Section: .dynamic
|
||||
|
||||
|
|
|
@ -388,7 +388,6 @@ ProgramHeaders:
|
|||
- Type: PT_LOAD
|
||||
Flags: [ PF_X, PF_R ]
|
||||
VAddr: 0x0000000000400000
|
||||
PAddr: 0x0000000000400000
|
||||
Align: 1024
|
||||
Sections:
|
||||
- Section: .interp
|
||||
|
|
|
@ -47,14 +47,12 @@ ProgramHeaders:
|
|||
- Type: PT_LOAD
|
||||
Flags: [ PF_X, PF_R ]
|
||||
VAddr: 0x1000
|
||||
PAddr: 0x1000
|
||||
Align: 0x1000
|
||||
Sections:
|
||||
- Section: .text
|
||||
- Type: PT_LOAD
|
||||
Flags: [ PF_R, PF_W ]
|
||||
VAddr: 0x2000
|
||||
PAddr: 0x2000
|
||||
Align: 0x1000
|
||||
Sections:
|
||||
- Section: .data
|
||||
|
|
|
@ -26,7 +26,6 @@ ProgramHeaders:
|
|||
- Type: PT_LOAD
|
||||
Flags: [ PF_R ]
|
||||
VAddr: 0x1000
|
||||
PAddr: 0x1000
|
||||
Sections:
|
||||
- Section: .note
|
||||
- Section: .rodata
|
||||
|
|
|
@ -127,6 +127,5 @@ ProgramHeaders:
|
|||
- Type: PT_LOAD
|
||||
Flags: [ PF_R, PF_W ]
|
||||
VAddr: 0x3000
|
||||
PAddr: 0x3000
|
||||
Sections:
|
||||
- Section: .data
|
||||
|
|
|
@ -35,7 +35,6 @@ ProgramHeaders:
|
|||
- Type: PT_LOAD
|
||||
Flags: [ PF_R ]
|
||||
VAddr: 0x1000
|
||||
PAddr: 0x1000
|
||||
Sections:
|
||||
- Section: .text
|
||||
- Section: .text2
|
||||
|
|
|
@ -35,7 +35,6 @@ ProgramHeaders:
|
|||
- Type: PT_LOAD
|
||||
Flags: [ PF_R ]
|
||||
VAddr: 0x1000
|
||||
PAddr: 0x1000
|
||||
Sections:
|
||||
- Section: .text
|
||||
- Section: .text2
|
||||
|
|
|
@ -35,7 +35,6 @@ ProgramHeaders:
|
|||
- Type: PT_LOAD
|
||||
Flags: [ PF_R ]
|
||||
VAddr: 0x1000
|
||||
PAddr: 0x1000
|
||||
Sections:
|
||||
- Section: .text
|
||||
- Section: .text2
|
||||
|
|
|
@ -25,14 +25,12 @@ ProgramHeaders:
|
|||
- Type: PT_LOAD
|
||||
Flags: [ PF_X, PF_R ]
|
||||
VAddr: 0x1000
|
||||
PAddr: 0x1000
|
||||
Align: 0x1000
|
||||
Sections:
|
||||
- Section: .text
|
||||
- Type: PT_LOAD
|
||||
Flags: [ PF_R, PF_W ]
|
||||
VAddr: 0x1008
|
||||
PAddr: 0x1008
|
||||
Align: 0x1000
|
||||
Sections:
|
||||
- Section: .data
|
||||
|
|
|
@ -25,14 +25,12 @@ ProgramHeaders:
|
|||
- Type: PT_LOAD
|
||||
Flags: [ PF_X, PF_R ]
|
||||
VAddr: 0x1000
|
||||
PAddr: 0x1000
|
||||
Align: 0x1000
|
||||
Sections:
|
||||
- Section: .text
|
||||
- Type: PT_LOAD
|
||||
Flags: [ PF_R, PF_W ]
|
||||
VAddr: 0x1008
|
||||
PAddr: 0x1008
|
||||
Align: 0x1000
|
||||
Sections:
|
||||
- Section: .data
|
||||
|
|
|
@ -81,13 +81,11 @@ Sections:
|
|||
ProgramHeaders:
|
||||
- Type: PT_LOAD
|
||||
VAddr: 0
|
||||
PAddr: 0
|
||||
Align: 0x100
|
||||
Sections:
|
||||
- Section: .foo
|
||||
- Type: PT_LOAD
|
||||
VAddr: 0x1000
|
||||
PAddr: 0x1000
|
||||
Align: 0x1000
|
||||
Sections:
|
||||
- Section: .empty
|
||||
|
|
|
@ -32,26 +32,22 @@ ProgramHeaders:
|
|||
- Type: PT_LOAD
|
||||
Flags: [ PF_X, PF_R ]
|
||||
VAddr: 0x1000
|
||||
PAddr: 0x1000
|
||||
Align: 0x1000
|
||||
Sections:
|
||||
- Section: .text
|
||||
- Type: PT_LOAD
|
||||
Flags: [ PF_R, PF_W ]
|
||||
VAddr: 0x2000
|
||||
PAddr: 0x2000
|
||||
Align: 0x1000
|
||||
Sections:
|
||||
- Section: .data
|
||||
- Type: PT_GNU_STACK
|
||||
Flags: [ PF_R, PF_W ]
|
||||
VAddr: 0x0000
|
||||
PAddr: 0x0000
|
||||
Align: 0x0000
|
||||
- Type: PT_LOAD
|
||||
Flags: [ PF_R ]
|
||||
VAddr: 0x2010
|
||||
PAddr: 0x2010
|
||||
Sections:
|
||||
- Section: .xdata
|
||||
- Section: .after
|
||||
|
|
|
@ -21,9 +21,9 @@
|
|||
|
||||
# CHECK: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
|
||||
# CHECK-NEXT: LOAD 0x000000 0x0000000000000000 0x0000000000000000 0x000402 0x000403 R E 0x1000
|
||||
# CHECK-NEXT: LOAD 0x000480 0x0000000000001480 0x0000000000000000 0x000000 0x00005f RW 0x1000
|
||||
# CHECK-NEXT: TLS 0x000480 0x0000000000001480 0x0000000000000000 0x000000 0x00000c RW 0x80
|
||||
# CHECK-NEXT: NOTE 0x000400 0x0000000000000400 0x0000000000000000 0x000002 0x000002 0x400
|
||||
# CHECK-NEXT: LOAD 0x000480 0x0000000000001480 0x0000000000001480 0x000000 0x00005f RW 0x1000
|
||||
# CHECK-NEXT: TLS 0x000480 0x0000000000001480 0x0000000000001480 0x000000 0x00000c RW 0x80
|
||||
# CHECK-NEXT: NOTE 0x000400 0x0000000000000400 0x0000000000000400 0x000002 0x000002 0x400
|
||||
|
||||
## Contents of SHT_NOTE and .debug* are kept.
|
||||
|
||||
|
@ -136,9 +136,9 @@ ProgramHeaders:
|
|||
|
||||
## Check that p_offset or p_filesz of empty segments or PT_PHDR are not modified.
|
||||
# CHECK2: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
|
||||
# CHECK2-NEXT: PHDR 0x000040 0x0000000000000040 0x0000000000000000 0x0000a8 0x0000a8 R 0x8
|
||||
# CHECK2-NEXT: PHDR 0x000040 0x0000000000000040 0x0000000000000040 0x0000a8 0x0000a8 R 0x8
|
||||
# CHECK2-NEXT: LOAD 0x000000 0x0000000000000000 0x0000000000000000 0x000202 0x000202 R E 0x1000
|
||||
# CHECK2-NEXT: LOAD 0x000202 0x0000000000000202 0x0000000000000000 0x00000e 0x00000e RW 0x1
|
||||
# CHECK2-NEXT: LOAD 0x000202 0x0000000000000202 0x0000000000000202 0x00000e 0x00000e RW 0x1
|
||||
|
||||
--- !ELF
|
||||
FileHeader:
|
||||
|
|
|
@ -36,14 +36,12 @@ ProgramHeaders:
|
|||
- Type: PT_LOAD
|
||||
Flags: [ PF_R ]
|
||||
VAddr: 0x1000
|
||||
PAddr: 0x1000
|
||||
Sections:
|
||||
- Section: .note
|
||||
- Section: .rodata
|
||||
- Type: PT_NOTE
|
||||
Flags: [ PF_R ]
|
||||
VAddr: 0x1000
|
||||
PAddr: 0x1000
|
||||
Sections:
|
||||
- Section: .note
|
||||
|
||||
|
|
|
@ -313,7 +313,6 @@ ProgramHeaders:
|
|||
# First segment has unlabelled space at start and end.
|
||||
- Type: 0x6ABCDEF0 # Non-specific segment type.
|
||||
VAddr: 0x2000
|
||||
PAddr: 0x2000
|
||||
Align: 0x2000
|
||||
Sections:
|
||||
- Section: blob1
|
||||
|
@ -326,7 +325,6 @@ ProgramHeaders:
|
|||
# Second segment has sections at start and end.
|
||||
- Type: 0x6ABCDEF0
|
||||
VAddr: 0x2100
|
||||
PAddr: 0x2100
|
||||
Align: 0x100
|
||||
Sections:
|
||||
- Section: section4
|
||||
|
@ -335,28 +333,24 @@ ProgramHeaders:
|
|||
# Third segment is all covered by a section.
|
||||
- Type: 0x6ABCDEF0
|
||||
VAddr: 0x2200
|
||||
PAddr: 0x2200
|
||||
Align: 0x100
|
||||
Sections:
|
||||
- Section: section6
|
||||
# Fourth segment has no sections (after removing blob headers).
|
||||
- Type: 0x6ABCDEF0
|
||||
VAddr: 0x2300
|
||||
PAddr: 0x2300
|
||||
Align: 0x100
|
||||
Sections:
|
||||
- Section: blob6
|
||||
# Fifth segment is empty.
|
||||
- Type: 0x6ABCDEF0
|
||||
VAddr: 0x2308
|
||||
PAddr: 0x2308
|
||||
Offset: 0x2308
|
||||
|
||||
# The next few segments test behaviour of fully nested segments.
|
||||
# Sixth segment is the "parent" segment.
|
||||
- Type: 0x6ABCDEF0
|
||||
VAddr: 0x3000
|
||||
PAddr: 0x3000
|
||||
Align: 0x1000
|
||||
Sections:
|
||||
- Section: sectionA
|
||||
|
@ -379,24 +373,20 @@ ProgramHeaders:
|
|||
# Seventh segment is empty and nested.
|
||||
- Type: 0x6ABCDEF0
|
||||
VAddr: 0x3002
|
||||
PAddr: 0x3002
|
||||
Offset: 0x3002
|
||||
# Eighth segment contains only a section and is nested.
|
||||
- Type: 0x6ABCDEF0
|
||||
VAddr: 0x3004
|
||||
PAddr: 0x3004
|
||||
Sections:
|
||||
- Section: sectionB
|
||||
# Ninth segment contains only unlabelled space and is nested.
|
||||
- Type: 0x6ABCDEF0
|
||||
VAddr: 0x3008
|
||||
PAddr: 0x3008
|
||||
Sections:
|
||||
- Section: blobA
|
||||
# Tenth segment contains two sections with space between and is nested.
|
||||
- Type: 0x6ABCDEF0
|
||||
VAddr: 0x300C
|
||||
PAddr: 0x300C
|
||||
Sections:
|
||||
- Section: sectionC
|
||||
- Section: blobB
|
||||
|
@ -404,7 +394,6 @@ ProgramHeaders:
|
|||
# Eleventh segment contains two sections with space between and at ends and is nested.
|
||||
- Type: 0x6ABCDEF0
|
||||
VAddr: 0x3018
|
||||
PAddr: 0x3018
|
||||
Sections:
|
||||
- Section: blobC
|
||||
- Section: sectionE
|
||||
|
@ -414,7 +403,6 @@ ProgramHeaders:
|
|||
# Twelfth segment contains one section with space at ends adjacent to space in parent segment.
|
||||
- Type: 0x6ABCDEF0
|
||||
VAddr: 0x302E
|
||||
PAddr: 0x302E
|
||||
Offset: 0x302E
|
||||
FileSize: 8
|
||||
Sections:
|
||||
|
@ -422,7 +410,6 @@ ProgramHeaders:
|
|||
# Thirteenth segment contains overlaps sections at either end in parent segment.
|
||||
- Type: 0x6ABCDEF0
|
||||
VAddr: 0x303A
|
||||
PAddr: 0x303A
|
||||
Offset: 0x303A
|
||||
FileSize: 0x8
|
||||
Sections:
|
||||
|
@ -434,13 +421,11 @@ ProgramHeaders:
|
|||
# Segment15: |--|-Sec-|-unlabelled-|
|
||||
- Type: 0x6ABCDEF0
|
||||
VAddr: 0x4000
|
||||
PAddr: 0x4000
|
||||
Sections:
|
||||
- Section: blobz
|
||||
- Section: sectionz
|
||||
- Type: 0x6ABCDEF0
|
||||
VAddr: 0x4002
|
||||
PAddr: 0x4002
|
||||
Offset: 0x4002
|
||||
Sections:
|
||||
- Section: sectionz
|
||||
|
@ -450,13 +435,11 @@ ProgramHeaders:
|
|||
# Segment17: |--|----unlabelled---|
|
||||
- Type: 0x6ABCDEF0
|
||||
VAddr: 0x400C
|
||||
PAddr: 0x400C
|
||||
FileSize: 6
|
||||
Sections:
|
||||
- Section: sectiony
|
||||
- Type: 0x6ABCDEF0
|
||||
VAddr: 0x400E
|
||||
PAddr: 0x400E
|
||||
Offset: 0x400E
|
||||
Sections:
|
||||
- Section: blobx
|
||||
|
@ -465,13 +448,11 @@ ProgramHeaders:
|
|||
# Segment19: |-Sec-|-unlabelled-|
|
||||
- Type: 0x6ABCDEF0
|
||||
VAddr: 0x4014
|
||||
PAddr: 0x4014
|
||||
Sections:
|
||||
- Section: blobw
|
||||
- Section: sectionx
|
||||
- Type: 0x6ABCDEF0
|
||||
VAddr: 0x4018
|
||||
PAddr: 0x4018
|
||||
Sections:
|
||||
- Section: sectionx
|
||||
- Section: blobv
|
||||
|
@ -480,12 +461,10 @@ ProgramHeaders:
|
|||
# Segment21: |--|-unlabelled-|-Sec-|
|
||||
- Type: 0x6ABCDEF0
|
||||
VAddr: 0x4020
|
||||
PAddr: 0x4020
|
||||
Sections:
|
||||
- Section: sectionw
|
||||
- Type: 0x6ABCDEF0
|
||||
VAddr: 0x4022
|
||||
PAddr: 0x4022
|
||||
Offset: 0x4022
|
||||
Sections:
|
||||
- Section: blobu
|
||||
|
@ -495,12 +474,10 @@ ProgramHeaders:
|
|||
# Segment23: |--|-Sec-|
|
||||
- Type: 0x6ABCDEF0
|
||||
VAddr: 0x402C
|
||||
PAddr: 0x402C
|
||||
Sections:
|
||||
- Section: sectionu
|
||||
- Type: 0x6ABCDEF0
|
||||
VAddr: 0x402E
|
||||
PAddr: 0x402E
|
||||
Offset: 0x402E
|
||||
Sections:
|
||||
- Section: sectiont
|
||||
|
@ -509,13 +486,11 @@ ProgramHeaders:
|
|||
# Segment25: |--Sec--|
|
||||
- Type: 0x6ABCDEF0
|
||||
VAddr: 0x4034
|
||||
PAddr: 0x4034
|
||||
FileSize: 6
|
||||
Sections:
|
||||
- Section: blobt
|
||||
- Type: 0x6ABCDEF0
|
||||
VAddr: 0x4038
|
||||
PAddr: 0x4038
|
||||
Sections:
|
||||
- Section: sections
|
||||
|
||||
|
@ -527,7 +502,6 @@ ProgramHeaders:
|
|||
# Segment28: |-Sec-|------------|
|
||||
- Type: 0x6ABCDEF0
|
||||
VAddr: 0x5000
|
||||
PAddr: 0x5000
|
||||
Align: 0x1000
|
||||
Sections:
|
||||
- Section: bloba
|
||||
|
@ -535,13 +509,11 @@ ProgramHeaders:
|
|||
- Section: blobb
|
||||
- Type: 0x6ABCDEF0
|
||||
VAddr: 0x5000
|
||||
PAddr: 0x5000
|
||||
FileSize: 6
|
||||
Sections:
|
||||
- Section: bloba
|
||||
- Type: 0x6ABCDEF0
|
||||
VAddr: 0x5004
|
||||
PAddr: 0x5004
|
||||
Sections:
|
||||
- Section: sectiona
|
||||
- Section: blobb
|
||||
|
@ -551,20 +523,17 @@ ProgramHeaders:
|
|||
# Segment31: |---------|-Sec-|
|
||||
- Type: 0x6ABCDEF0
|
||||
VAddr: 0x500C
|
||||
PAddr: 0x500C
|
||||
Sections:
|
||||
- Section: sectionb
|
||||
- Section: blobc
|
||||
- Section: sectionc
|
||||
- Type: 0x6ABCDEF0
|
||||
VAddr: 0x500C
|
||||
PAddr: 0x500C
|
||||
FileSize: 7
|
||||
Sections:
|
||||
- Section: sectionb
|
||||
- Type: 0x6ABCDEF0
|
||||
VAddr: 0x5011
|
||||
PAddr: 0x5011
|
||||
Offset: 0x5011
|
||||
Sections:
|
||||
- Section: sectionc
|
||||
|
@ -574,20 +543,17 @@ ProgramHeaders:
|
|||
# Segment34: |------------|-Sec-|
|
||||
- Type: 0x6ABCDEF0
|
||||
VAddr: 0x5018
|
||||
PAddr: 0x5018
|
||||
Sections:
|
||||
- Section: sectiond
|
||||
- Section: blobd
|
||||
- Section: sectione
|
||||
- Type: 0x6ABCDEF0
|
||||
VAddr: 0x5018
|
||||
PAddr: 0x5018
|
||||
Sections:
|
||||
- Section: sectiond
|
||||
- Section: blobd
|
||||
- Type: 0x6ABCDEF0
|
||||
VAddr: 0x501C
|
||||
PAddr: 0x501C
|
||||
Sections:
|
||||
- Section: blobd
|
||||
- Section: sectione
|
||||
|
@ -597,20 +563,17 @@ ProgramHeaders:
|
|||
# Segment37: |-Sec-|------------|
|
||||
- Type: 0x6ABCDEF0
|
||||
VAddr: 0x5024
|
||||
PAddr: 0x5024
|
||||
Sections:
|
||||
- Section: blobe
|
||||
- Section: sectionf
|
||||
- Section: blobf
|
||||
- Type: 0x6ABCDEF0
|
||||
VAddr: 0x5024
|
||||
PAddr: 0x5024
|
||||
Sections:
|
||||
- Section: blobe
|
||||
- Section: sectionf
|
||||
- Type: 0x6ABCDEF0
|
||||
VAddr: 0x5028
|
||||
PAddr: 0x5028
|
||||
Sections:
|
||||
- Section: sectionf
|
||||
- Section: blobf
|
||||
|
@ -620,20 +583,17 @@ ProgramHeaders:
|
|||
# Segment40: |---|------------|
|
||||
- Type: 0x6ABCDEF0
|
||||
VAddr: 0x5030
|
||||
PAddr: 0x5030
|
||||
Sections:
|
||||
- Section: blobg
|
||||
- Section: sectiong
|
||||
- Section: blobh
|
||||
- Type: 0x6ABCDEF0
|
||||
VAddr: 0x5030
|
||||
PAddr: 0x5030
|
||||
FileSize: 7
|
||||
Sections:
|
||||
- Section: blobg
|
||||
- Type: 0x6ABCDEF0
|
||||
VAddr: 0x5035
|
||||
PAddr: 0x5035
|
||||
Offset: 0x5035
|
||||
Sections:
|
||||
- Section: blobh
|
||||
|
|
|
@ -31,13 +31,11 @@ ProgramHeaders:
|
|||
- Type: PT_LOAD
|
||||
Flags: [ PF_R ]
|
||||
VAddr: 0x1000
|
||||
PAddr: 0x1000
|
||||
Sections:
|
||||
- Section: .text
|
||||
- Type: PT_LOAD
|
||||
Flags: [ PF_X, PF_R ]
|
||||
VAddr: 0x3000
|
||||
PAddr: 0x3000
|
||||
Sections:
|
||||
- Section: .text3
|
||||
## TODO (grimar): without the following line (i.e. without an empty symbol table),
|
||||
|
|
|
@ -31,13 +31,11 @@ ProgramHeaders:
|
|||
- Type: PT_LOAD
|
||||
Flags: [ PF_R ]
|
||||
VAddr: 0x1000
|
||||
PAddr: 0x1000
|
||||
Sections:
|
||||
- Section: .text
|
||||
- Type: PT_LOAD
|
||||
Flags: [ PF_X, PF_R ]
|
||||
VAddr: 0x3000
|
||||
PAddr: 0x3000
|
||||
Sections:
|
||||
- Section: .text3
|
||||
|
||||
|
|
|
@ -42,14 +42,12 @@ ProgramHeaders:
|
|||
- Type: PT_LOAD
|
||||
Flags: [ PF_R ]
|
||||
VAddr: 0x1000
|
||||
PAddr: 0x1000
|
||||
Sections:
|
||||
- Section: .text
|
||||
- Section: .text2
|
||||
- Type: PT_LOAD
|
||||
Flags: [ PF_R ]
|
||||
VAddr: 0x3000
|
||||
PAddr: 0x3000
|
||||
Sections:
|
||||
- Section: .text3
|
||||
- Section: .text4
|
||||
|
|
|
@ -42,14 +42,12 @@ ProgramHeaders:
|
|||
- Type: PT_LOAD
|
||||
Flags: [ PF_R ]
|
||||
VAddr: 0x1000
|
||||
PAddr: 0x1000
|
||||
Sections:
|
||||
- Section: .text
|
||||
- Section: .text2
|
||||
- Type: PT_LOAD
|
||||
Flags: [ PF_R ]
|
||||
VAddr: 0x3000
|
||||
PAddr: 0x3000
|
||||
Sections:
|
||||
- Section: .text3
|
||||
- Section: .text4
|
||||
|
|
|
@ -42,14 +42,12 @@ ProgramHeaders:
|
|||
- Type: PT_LOAD
|
||||
Flags: [ PF_R ]
|
||||
VAddr: 0x1000
|
||||
PAddr: 0x1000
|
||||
Sections:
|
||||
- Section: .text
|
||||
- Section: .text2
|
||||
- Type: PT_LOAD
|
||||
Flags: [ PF_R ]
|
||||
VAddr: 0x3000
|
||||
PAddr: 0x3000
|
||||
Sections:
|
||||
- Section: .text3
|
||||
- Section: .text4
|
||||
|
|
|
@ -48,13 +48,11 @@ ProgramHeaders:
|
|||
- Type: PT_LOAD
|
||||
Flags: [ PF_X, PF_R ]
|
||||
VAddr: 0x00001000
|
||||
PAddr: 0x00001000
|
||||
Sections:
|
||||
- Section: .text
|
||||
- Section: .init
|
||||
- Type: PT_LOAD
|
||||
Flags: [ PF_R ]
|
||||
VAddr: 0x00002000
|
||||
PAddr: 0x00002000
|
||||
Sections:
|
||||
- Section: .data
|
||||
|
|
|
@ -212,7 +212,6 @@ ProgramHeaders:
|
|||
- Type: PT_LOAD
|
||||
Flags: [ PF_R, PF_X ]
|
||||
VAddr: 0x0
|
||||
PAddr: 0x0
|
||||
Sections:
|
||||
- Section: .dynsym
|
||||
- Section: .dynstr
|
||||
|
@ -222,6 +221,5 @@ ProgramHeaders:
|
|||
- Type: PT_DYNAMIC
|
||||
Flags: [ PF_R ]
|
||||
VAddr: 0x1000
|
||||
PAddr: 0x1000
|
||||
Sections:
|
||||
- Section: .dynamic
|
||||
|
|
|
@ -363,7 +363,6 @@ ProgramHeaders:
|
|||
- Type: PT_LOAD
|
||||
Flags: [ PF_R, PF_X ]
|
||||
VAddr: 0x0
|
||||
PAddr: 0x0
|
||||
Sections:
|
||||
- Section: .dynsym
|
||||
- Section: .dynstr
|
||||
|
@ -372,7 +371,6 @@ ProgramHeaders:
|
|||
- Type: PT_DYNAMIC
|
||||
Flags: [ PF_R ]
|
||||
VAddr: 0x1000
|
||||
PAddr: 0x1000
|
||||
Sections:
|
||||
- Section: .dynamic
|
||||
|
||||
|
|
|
@ -44,7 +44,6 @@ ProgramHeaders:
|
|||
- Type: PT_LOAD
|
||||
Flags: [ PF_R ]
|
||||
VAddr: 0x0000
|
||||
PAddr: 0x0000
|
||||
Sections:
|
||||
- Section: .dynstr
|
||||
- Section: .dynamic
|
||||
|
|
|
@ -124,14 +124,12 @@ Sections:
|
|||
ProgramHeaders:
|
||||
- Type: PT_LOAD
|
||||
VAddr: 0x100
|
||||
PAddr: 0x100
|
||||
Sections:
|
||||
- Section: fill1
|
||||
- Section: .bar
|
||||
- Section: fill2
|
||||
- Type: PT_GNU_RELRO
|
||||
VAddr: 0x105
|
||||
PAddr: 0x105
|
||||
Sections:
|
||||
- Section: fill2
|
||||
|
||||
|
|
|
@ -31,13 +31,11 @@ ProgramHeaders:
|
|||
- Type: PT_LOAD
|
||||
Flags: [ PF_R ]
|
||||
VAddr: 0x0000
|
||||
PAddr: 0x0000
|
||||
Align: 8
|
||||
Sections:
|
||||
- Section: .dynamic
|
||||
- Type: PT_DYNAMIC
|
||||
Flags: [ PF_X, PF_R ]
|
||||
VAddr: 0x0008
|
||||
PAddr: 0x0008
|
||||
Sections:
|
||||
- Section: .dynamic
|
||||
|
|
|
@ -0,0 +1,55 @@
|
|||
## Show how yaml2obj sets physical and virtual addresses of program headers.
|
||||
|
||||
# RUN: yaml2obj %s -o %t
|
||||
# RUN: llvm-readelf --sections --segments %t | FileCheck %s
|
||||
|
||||
# CHECK: Section Headers:
|
||||
# CHECK: [Nr] Name Type Address Off Size ES Flg
|
||||
# CHECK: [ 1] .foo PROGBITS 0000000000001234 000120 000001 00 A
|
||||
|
||||
# CHECK: Program Headers:
|
||||
# CHECK-NEXT: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
|
||||
# CHECK-NEXT: LOAD 0x000000 0x0000000000000000 0x0000000000000000 0x000000 0x000000 R E 0x1
|
||||
# CHECK-NEXT: LOAD 0x000120 0x0000000000000000 0x0000000000000000 0x000001 0x000001 R E 0x1
|
||||
# CHECK-NEXT: LOAD 0x000120 0x00000000aaaa1000 0x00000000aaaa1000 0x000001 0x000001 R E 0x1
|
||||
# CHECK-NEXT: LOAD 0x000120 0x00000000aaaa1000 0x00000000bbbb2000 0x000001 0x000001 R E 0x1
|
||||
|
||||
--- !ELF
|
||||
FileHeader:
|
||||
Class: ELFCLASS64
|
||||
Data: ELFDATA2LSB
|
||||
Type: ET_EXEC
|
||||
Machine: EM_X86_64
|
||||
Sections:
|
||||
- Name: .foo
|
||||
Type: SHT_PROGBITS
|
||||
Flags: [ SHF_ALLOC ]
|
||||
Size: 0x1
|
||||
Address: 0x1234
|
||||
ProgramHeaders:
|
||||
## Show addresses we emit by default for a case when a program header
|
||||
## has no sections included.
|
||||
- Type: PT_LOAD
|
||||
Flags: [ PF_X, PF_R ]
|
||||
Sections: []
|
||||
## Show addresses we emit by default for a case when a program header
|
||||
## includes a section with a virtual address that is explicitly set.
|
||||
- Type: PT_LOAD
|
||||
Flags: [ PF_X, PF_R ]
|
||||
Sections:
|
||||
- Section: .foo
|
||||
## Now we have a program header that has a virtual address different from
|
||||
## a address of the section included. Show that the default physical address
|
||||
## is equal to virtual address.
|
||||
- Type: PT_LOAD
|
||||
Flags: [ PF_X, PF_R ]
|
||||
VAddr: 0xAAAA1000
|
||||
Sections:
|
||||
- Section: .foo
|
||||
## Show that we are able to set different virtual and physical addresses.
|
||||
- Type: PT_LOAD
|
||||
Flags: [ PF_X, PF_R ]
|
||||
VAddr: 0xAAAA1000
|
||||
PAddr: 0xBBBB2000
|
||||
Sections:
|
||||
- Section: .foo
|
Loading…
Reference in New Issue