From 4a8466d4babab43ee6ee46e37c2abb8248661ad5 Mon Sep 17 00:00:00 2001 From: Ard Biesheuvel Date: Sun, 17 Jul 2016 23:20:10 +0200 Subject: BaseTools GCC: introduce GCC5 toolchain to support GCC v5.x in LTO mode This adds support for GCC 5.x in LTO mode for IA32, X64, ARM and AARCH64. Due to the fact that the GCC project switched to a new numbering scheme where the first digit is now incremented for every major release, the new toolchain is simply called 'GCC5', and is intended to support all GCC v5.x releases. Since IA32 and X64 enable compiler optimizations (-Os) for both DEBUG and RELEASE builds, LTO support is equally enabled for both targets. On ARM and AARCH64, DEBUG builds are not optimized, and so the LTO optimizations are only enabled for RELEASE. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel Reviewed-by: Jordan Justen Reviewed-by: Liming Gao --- MdePkg/Include/X64/ProcessorBind.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'MdePkg') diff --git a/MdePkg/Include/X64/ProcessorBind.h b/MdePkg/Include/X64/ProcessorBind.h index 666cc8e8bd..ffcf2b0344 100644 --- a/MdePkg/Include/X64/ProcessorBind.h +++ b/MdePkg/Include/X64/ProcessorBind.h @@ -27,13 +27,17 @@ #pragma pack() #endif -#if defined(__GNUC__) && defined(__pic__) +#if defined(__GNUC__) && defined(__pic__) && !defined(USING_LTO) // // Mark all symbol declarations and references as hidden, meaning they will // not be subject to symbol preemption. This allows the compiler to refer to // symbols directly using relative references rather than via the GOT, which // contains absolute symbol addresses that are subject to runtime relocation. // +// The LTO linker will not emit GOT based relocations when all symbol +// references can be resolved locally, and so there is no need to set the +// pragma in that case (and doing so will cause other issues). +// #pragma GCC visibility push (hidden) #endif -- cgit v1.2.3