summaryrefslogtreecommitdiff
path: root/MdePkg
diff options
context:
space:
mode:
Diffstat (limited to 'MdePkg')
-rw-r--r--MdePkg/Include/X64/ProcessorBind.h6
1 files changed, 5 insertions, 1 deletions
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