[OE-core] [PATCH v3] binutils : enable x86_64-pep for producing EFI binaries on x86/x86-64

Christopher Clark christopher.w.clark at gmail.com
Thu Jul 26 23:51:22 UTC 2018


On x86 and x86_64 architectures, add the x86_64-pep emulation support
to the linker to enable production of Portable Executables for EFI
binaries.

Enables building the x86-64 EFI variant of the Xen hypervisor.

Signed-off-by: Christopher Clark <christopher.clark6 at baesystems.com>
---
Changes in v3:

* Use overrides rather than a function to add the configure flags.

I've used a construction that should allow other layers to override a
single variable to provide different extra targets if needed.

* Only make this change for x86 and x86-64.

The linker flag for x86-64 EFI binaries is known: x86_64-pep.
Make this available on both x86-64 and x86, so multiarch is covered.

The linker flag for constructing 32-bit x86 EFI binaries is not known by me,
and is not easily discoverable via inspecting the binutils source or
queries of the internet. 32-bit x86 UEFI appears to be very uncommon.

* No change for the ARM architectures in this patch.

I have no data on what linker flags are required for EFI on ARM,
and again I'm drawing a blank via source inspection and internet
query. If additional lines for arm and aarch64 are added later,
they will fit well with the structure added by this patch.

The ARM64 build of the Xen hypervisor does not need additional toolchain
support for construction an EFI image as its PE/COFF header is coded in
assembly.

* Using gmail 'From'/'Author' address as it is preferred for contact.
  S-o-b address as provided is required for attribution. Unchanged from v2.

 meta/recipes-devtools/binutils/binutils.inc | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/meta/recipes-devtools/binutils/binutils.inc b/meta/recipes-devtools/binutils/binutils.inc
index 37813dd..9f06d94 100644
--- a/meta/recipes-devtools/binutils/binutils.inc
+++ b/meta/recipes-devtools/binutils/binutils.inc
@@ -74,12 +74,17 @@ EXTRA_OECONF = "--program-prefix=${TARGET_PREFIX} \
                 --enable-deterministic-archives \
                 --enable-plugins \
                 ${LDGOLD} \
-                ${@bb.utils.contains('DISTRO_FEATURES', 'multiarch', '--enable-64-bit-bfd', '', d)}"
+                ${@bb.utils.contains('DISTRO_FEATURES', 'multiarch', '--enable-64-bit-bfd', '', d)} \
+                ${ENABLE_EXTRA_TARGETS}"
 
 LDGOLD_class-native = ""
 LDGOLD_class-crosssdk = ""
 LDGOLD ?= "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-gold', '--enable-gold=default --enable-threads', '--enable-gold --enable-ld=default --enable-threads', d)}"
 
+ARCH_EFI_EMULATION_x86-64 = "x86_64-pep"
+ARCH_EFI_EMULATION_x86 = "x86_64-pep"
+ENABLE_EXTRA_TARGETS ?= "--enable-targets=${ARCH_EFI_EMULATION}"
+
 # This is necessary due to a bug in the binutils Makefiles
 # EXTRA_OEMAKE = "configure-build-libiberty all"
 
-- 
2.7.4




More information about the Openembedded-core mailing list