diff mbox series

[edk2,RFC,01/11] MdePkg/ProcessorBind.h: define macro to decorate module entry points

Message ID 20180612152306.25998-2-ard.biesheuvel@linaro.org
State New
Headers show
Series GCC/X64: use hidden visibility for LTO PIE code | expand

Commit Message

Ard Biesheuvel June 12, 2018, 3:22 p.m. UTC
Add a macro EFI_ENTRYPOINT that we will use to decorate functions that
serve as the entry points for EFI modules. This is necessary to work
around a limitation in GCC, which may prune such routines from the
ELF binary if they are defined with hidden visibility, even if they
are explicitly referenced as the entry point on the linker command
line.

The hidden visibility is required to inform the compiler that, even
though we are building the code in PIE mode, we are only doing so
to get code that can run anywhere in the address space without
requiring 64-bit wide absolute symbol references, and we are not
interested in other things that PIE code typically provides, such
as symbol preemptability and a reduced CoW footprint due to the
fact that all dynamic relocations target the same area in the binary.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

---
 MdePkg/Include/Base.h | 7 +++++++
 1 file changed, 7 insertions(+)

-- 
2.17.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
diff mbox series

Patch

diff --git a/MdePkg/Include/Base.h b/MdePkg/Include/Base.h
index 4f7bd4449c36..eee48dcd4b29 100644
--- a/MdePkg/Include/Base.h
+++ b/MdePkg/Include/Base.h
@@ -274,6 +274,13 @@  VERIFY_SIZE_OF (__VERIFY_UINT32_ENUM_SIZE, 4);
   #define PACKED
 #endif
 
+#ifndef EFI_ENTRYPOINT
+  //
+  // Set to empty value if not already set by the arch-specific header
+  //
+  #define EFI_ENTRYPOINT
+#endif
+
 ///
 /// 128 bit buffer containing a unique identifier value.
 /// Unless otherwise specified, aligned on a 64 bit boundary.