Skip to content

Commit b236b4c

Browse files
author
Georgii Rymar
committed
[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
1 parent f47f4c1 commit b236b4c

38 files changed

+61
-109
lines changed

llvm/lib/ObjectYAML/ELFYAML.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -848,7 +848,7 @@ void MappingTraits<ELFYAML::ProgramHeader>::mapping(
848848
IO.mapOptional("Flags", Phdr.Flags, ELFYAML::ELF_PF(0));
849849
IO.mapOptional("Sections", Phdr.Sections);
850850
IO.mapOptional("VAddr", Phdr.VAddr, Hex64(0));
851-
IO.mapOptional("PAddr", Phdr.PAddr, Hex64(0));
851+
IO.mapOptional("PAddr", Phdr.PAddr, Phdr.VAddr);
852852
IO.mapOptional("Align", Phdr.Align);
853853
IO.mapOptional("FileSize", Phdr.FileSize);
854854
IO.mapOptional("MemSize", Phdr.MemSize);

llvm/test/tools/llvm-elfabi/binary-read-add-soname.test

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,13 @@ ProgramHeaders:
3333
- Type: PT_LOAD
3434
Flags: [ PF_R ]
3535
VAddr: 0x0000
36-
PAddr: 0x0000
3736
Align: 8
3837
Sections:
3938
- Section: .dynstr
4039
- Section: .dynamic
4140
- Type: PT_DYNAMIC
4241
Flags: [ PF_X, PF_R ]
4342
VAddr: 0x0008
44-
PAddr: 0x0008
4543
Sections:
4644
- Section: .dynamic
4745

llvm/test/tools/llvm-elfabi/binary-read-arch.test

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,13 @@ ProgramHeaders:
3333
- Type: PT_LOAD
3434
Flags: [ PF_R ]
3535
VAddr: 0x0000
36-
PAddr: 0x0000
3736
Align: 8
3837
Sections:
3938
- Section: .dynstr
4039
- Section: .dynamic
4140
- Type: PT_DYNAMIC
4241
Flags: [ PF_X, PF_R ]
4342
VAddr: 0x0008
44-
PAddr: 0x0008
4543
Sections:
4644
- Section: .dynamic
4745

llvm/test/tools/llvm-elfabi/binary-read-bad-soname.test

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,13 @@ ProgramHeaders:
3535
- Type: PT_LOAD
3636
Flags: [ PF_R ]
3737
VAddr: 0x0000
38-
PAddr: 0x0000
3938
Align: 8
4039
Sections:
4140
- Section: .dynstr
4241
- Section: .dynamic
4342
- Type: PT_DYNAMIC
4443
Flags: [ PF_X, PF_R ]
4544
VAddr: 0x0008
46-
PAddr: 0x0008
4745
Sections:
4846
- Section: .dynamic
4947

llvm/test/tools/llvm-elfabi/binary-read-bad-vaddr.test

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,13 @@ ProgramHeaders:
3535
- Type: PT_LOAD
3636
Flags: [ PF_R ]
3737
VAddr: 0x1000
38-
PAddr: 0x1000
3938
Align: 8
4039
Sections:
4140
- Section: .dynstr
4241
- Section: .dynamic
4342
- Type: PT_DYNAMIC
4443
Flags: [ PF_X, PF_R ]
4544
VAddr: 0x1008
46-
PAddr: 0x1008
4745
Sections:
4846
- Section: .dynamic
4947

llvm/test/tools/llvm-elfabi/binary-read-neededlibs-bad-offset.test

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,13 @@ ProgramHeaders:
3939
- Type: PT_LOAD
4040
Flags: [ PF_R ]
4141
VAddr: 0x1000
42-
PAddr: 0x1000
4342
Align: 8
4443
Sections:
4544
- Section: .dynstr
4645
- Section: .dynamic
4746
- Type: PT_DYNAMIC
4847
Flags: [ PF_X, PF_R ]
4948
VAddr: 0x1024
50-
PAddr: 0x1024
5149
Sections:
5250

5351
# CHECK: DT_NEEDED string offset (0x000000000000ffff) outside of dynamic string table

llvm/test/tools/llvm-elfabi/binary-read-neededlibs.test

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,13 @@ ProgramHeaders:
3838
- Type: PT_LOAD
3939
Flags: [ PF_R ]
4040
VAddr: 0x1000
41-
PAddr: 0x1000
4241
Align: 8
4342
Sections:
4443
- Section: .dynstr
4544
- Section: .dynamic
4645
- Type: PT_DYNAMIC
4746
Flags: [ PF_X, PF_R ]
4847
VAddr: 0x1024
49-
PAddr: 0x1024
5048
Sections:
5149

5250
# CHECK: NeededLibs:

llvm/test/tools/llvm-elfabi/binary-read-no-dt-strsz.test

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,13 @@ ProgramHeaders:
3030
- Type: PT_LOAD
3131
Flags: [ PF_R ]
3232
VAddr: 0x0000
33-
PAddr: 0x0000
3433
Align: 8
3534
Sections:
3635
- Section: .dynstr
3736
- Section: .dynamic
3837
- Type: PT_DYNAMIC
3938
Flags: [ PF_X, PF_R ]
4039
VAddr: 0x0008
41-
PAddr: 0x0008
4240
Sections:
4341
- Section: .dynamic
4442

llvm/test/tools/llvm-elfabi/binary-read-no-dt-strtab.test

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,13 @@ ProgramHeaders:
2929
- Type: PT_LOAD
3030
Flags: [ PF_R ]
3131
VAddr: 0x0000
32-
PAddr: 0x0000
3332
Align: 8
3433
Sections:
3534
- Section: .dynstr
3635
- Section: .dynamic
3736
- Type: PT_DYNAMIC
3837
Flags: [ PF_X, PF_R ]
3938
VAddr: 0x0008
40-
PAddr: 0x0008
4139
Sections:
4240
- Section: .dynamic
4341

llvm/test/tools/llvm-elfabi/binary-read-replace-soname.test

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,13 @@ ProgramHeaders:
3737
- Type: PT_LOAD
3838
Flags: [ PF_R ]
3939
VAddr: 0x1000
40-
PAddr: 0x1000
4140
Align: 8
4241
Sections:
4342
- Section: .dynstr
4443
- Section: .dynamic
4544
- Type: PT_DYNAMIC
4645
Flags: [ PF_X, PF_R ]
4746
VAddr: 0x1018
48-
PAddr: 0x1018
4947
Sections:
5048
- Section: .dynamic
5149

0 commit comments

Comments
 (0)