diff options
author | Olivier Martin <olivier.martin@arm.com> | 2014-11-05 18:56:17 +0000 |
---|---|---|
committer | oliviermartin <oliviermartin@Edk2> | 2014-11-05 18:56:17 +0000 |
commit | b85f57995e010db57dc46be445c444d42a8939f2 (patch) | |
tree | 9fe84b1bb214eada52a260730cce01dccbfc3851 /BaseTools/Source/C | |
parent | be91c7706958e822885ebec36b48483b142755cd (diff) | |
download | edk2-platforms-b85f57995e010db57dc46be445c444d42a8939f2.tar.xz |
BaseTools/GenFw: Fixed R_AARCH64_CALL26/R_AARCH64_JUMP26 when referring to start of a section
When R_AARCH64_CALL26/R_AARCH64_JUMP26 relocations referred to static
functions, they sometime refer to the start of the '.text' section + addend.
It means the addend is different of '0'.
The non-patched code (before applying the relocation) already contains
the correct offset.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Olivier Martin <olivier.martin@arm.com>
Reviewed-by: Yingke Liu <yingke.d.liu@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16302 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'BaseTools/Source/C')
-rw-r--r-- | BaseTools/Source/C/GenFw/Elf64Convert.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/BaseTools/Source/C/GenFw/Elf64Convert.c b/BaseTools/Source/C/GenFw/Elf64Convert.c index 526ab5d41f..290f04cb98 100644 --- a/BaseTools/Source/C/GenFw/Elf64Convert.c +++ b/BaseTools/Source/C/GenFw/Elf64Convert.c @@ -710,13 +710,15 @@ WriteSections64 ( break;
case R_AARCH64_CALL26:
- if (Rel->r_addend != 0 ) { /* TODO */
- Error (NULL, 0, 3000, "Invalid", "AArch64: R_AARCH64_CALL26 Need to fixup with addend!.");
- }
- break;
-
case R_AARCH64_JUMP26:
- if (Rel->r_addend != 0 ) { /* TODO : AArch64 '-O2' optimisation. */
+ if (Rel->r_addend != 0 ) {
+ // Some references to static functions sometime start at the base of .text + addend.
+ // It is safe to ignore these relocations because they patch a `BL` instructions that
+ // contains an offset from the instruction itself and there is only a single .text section.
+ // So we check if the symbol is a "section symbol"
+ if (ELF64_ST_TYPE (Sym->st_info) == STT_SECTION) {
+ break;
+ }
Error (NULL, 0, 3000, "Invalid", "AArch64: R_AARCH64_JUMP26 Need to fixup with addend!.");
}
break;
|