audk/BaseTools/Source/C/GenFw
Ard Biesheuvel c9f297559b BaseTools X64: fold PLT relocations into simple relative references
For X64/GCC, we use position independent code with hidden visibility
to inform the compiler that symbol references are never resolved at
runtime, which removes the need for PLTs and GOTs. However, in some
cases, GCC has been reported to still emit PLT based relocations, which
we need to handle in the ELF to PE/COFF perform by GenFw.

Unlike GOT based relocations, which are non-trivial to handle since the
indirections in the code can not be fixed up easily (although relocation
types exist for X64 that annotate relocation targets as suitable for
relaxation), PLT relocations simply point to jump targets, and we can
relax such relocations by resolving them using the symbol directly rather
than via a PLT entry that does nothing more than tail call the function
we already know it is going to call (since all symbol references are
resolved in the same module).

So handle R_X86_64_PLT32 as a R_X86_64_PC32 relocation.

Suggested-by: Steven Shi <steven.shi@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2016-08-08 08:26:41 +02:00
..
Elf32Convert.c BaseTools/GenFw: Fix a bug for GCC build 2016-02-18 11:25:54 +08:00
Elf32Convert.h License header updated to match correct format. 2014-08-28 13:53:34 +00:00
Elf64Convert.c BaseTools X64: fold PLT relocations into simple relative references 2016-08-08 08:26:41 +02:00
Elf64Convert.h License header updated to match correct format. 2014-08-28 13:53:34 +00:00
ElfConvert.c BaseTools: Update GenFw to support 4K alignment. 2015-06-29 03:17:34 +00:00
ElfConvert.h BaseTools/GenFw: Enhance error message for bad symbol definitions 2016-02-17 13:21:44 +08:00
GNUmakefile Sync BaseTool trunk (version r2599) into EDKII BaseTools. 2013-08-23 02:18:16 +00:00
GenFw.c BaseTools/GenFw: enhance to use Magic Field to identify the image 2016-05-16 09:06:05 +08:00
GenFw.h License header updated to match correct format. 2014-08-28 13:53:34 +00:00
Makefile Sync EDKII BaseTools to BaseTools project r1971 2010-05-18 05:04:32 +00:00
elf32.h Sync BaseTool trunk (version r2649) into EDKII BaseTools. 2014-01-27 05:23:15 +00:00
elf64.h Sync BaseTool trunk (version r2649) into EDKII BaseTools. 2014-01-27 05:23:15 +00:00
elf_common.h Sync BaseTool trunk (version r2649) into EDKII BaseTools. 2014-01-27 05:23:15 +00:00