diff options
author | Ard Biesheuvel <ard.biesheuvel@linaro.org> | 2015-12-18 06:52:50 +0000 |
---|---|---|
committer | vanjeff <vanjeff@Edk2> | 2015-12-18 06:52:50 +0000 |
commit | 7f33c1d949d8ce1f1bff57a230d42d1c2ac1b1f8 (patch) | |
tree | 036fa8a8da10fa68c4351b7f945793ee648d1b8f /BaseTools/.gitignore | |
parent | 8bc5c95c550103317b739d3d620b189d03121062 (diff) | |
download | edk2-platforms-7f33c1d949d8ce1f1bff57a230d42d1c2ac1b1f8.tar.xz |
BaseTools/GenFw RVCT: fix relocation processing of PT_DYNAMIC sections
Unlike GNU ld, which can be instructed to emit symbol based static
relocations into fully linked binaries using the --emit-relocs command
line switch, the RVCT armlink tool can only emit dynamic relocations
into the PT_DYNAMIC segment.
This has two consequences
. we can only identify absolute relocations, so there is no way to fix
up relative relocations between sections, or check their validity in
the PE/COFF layout
. the r_offset fields of the PT_DYNAMIC DT_REL entries are relative
either to the base of the image or to any of its segments but *not* to
the base of the input section that contains the location they refer
to, and converting them to PE/COFF image offsets is non-trivial unless
the sections are laid out in the same way in the ELF and PE/COFF
versions of the binary.
There is really only one way to deal with this, and that is to require
that the ELF and PE/COFF versions of the binary are identical in memory.
So enforce that in the code.
Also, fix the utterly broken relocation fixup code that dereferences
ELF32_R_SYM(r_info) both as a 1-based program header index and a 0-based
section header index. If this code ever produced working binaries, it
was purely by chance.
(Sync patch r19236 from main trunk.)
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Liming Gao <liming.gao@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/branches/UDK2015@19383 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'BaseTools/.gitignore')
0 files changed, 0 insertions, 0 deletions