efivar: backport 5 patches to fix build with gold
PATCH 1/1 efivar: backport 5 patches to fix build with gold
* LDFLAGS += "-fuse-ld=bfd" in the recipe doesn't work and it still fails to build with ld-is-gold in DISTRO_FEATURES
removal of this line sent to master in:
https://lists.openembedded.org/g/openembedded-core/message/185167
* the most important ones are the 1st which removes --add-needed and the last which removes src/include/workarounds.mk completely while 2-4 patches just update src/include/workarounds.mk for the last one to apply cleanly
* alternatively we can bump SRCREV to latest 38 as master did in:
https://git.openembedded.org/openembedded-core/commit/?id=4df808c616f847d90203582fd950a49bb8360dd0
which brings 23 commits, but instead of adding 5 more patches allows to remove 5
--- ...ve-deprecated-add-needed-linker-flag.patch | 45 +++ ...002-Add-T-workaround-for-GNU-ld-2.36.patch | 33 +++ ...LL-C-to-force-English-output-from-ld.patch | 33 +++ ...on-and-remove-not-needed-workarounds.patch | 45 +++ ...mp-efi_well_known_-variable-handling.patch | 262 ++++++++++++++++++ meta/recipes-bsp/efivar/efivar_38.bb | 9 +- 6 files changed, 423 insertions(+), 4 deletions(-) create mode 100644 meta/recipes-bsp/efivar/efivar/0001-Remove-deprecated-add-needed-linker-flag.patch create mode 100644 meta/recipes-bsp/efivar/efivar/0002-Add-T-workaround-for-GNU-ld-2.36.patch create mode 100644 meta/recipes-bsp/efivar/efivar/0003-Set-LC_ALL-C-to-force-English-output-from-ld.patch create mode 100644 meta/recipes-bsp/efivar/efivar/0004-LLD-fix-detection-and-remove-not-needed-workarounds.patch create mode 100644 meta/recipes-bsp/efivar/efivar/0005-Revamp-efi_well_known_-variable-handling.patch
meta/recipes-bsp/efivar/efivar/0001-Remove-deprecated-add-needed-linker-flag.patch new file +45 -0
@@ -0,0 +1,45 @@ +From b23aba1469de8bb7a115751f9cd294ad3aaa6680 Mon Sep 17 00:00:00 2001 +From: Ali Abdel-Qader <[email protected]> +Date: Tue, 31 May 2022 11:53:32 -0400 +Subject: [PATCH] Remove deprecated --add-needed linker flag + +Resolves #204 +Signed-off-by: Ali Abdel-Qader <[email protected]> +Signed-off-by: Martin Jansa <[email protected]> +--- +Upstream-Status: Backport [https://github.com/rhboot/efivar/pull/218/commits/b23aba1469de8bb7a115751f9cd294ad3aaa6680] + + src/include/defaults.mk | 2 -- + src/include/gcc.specs | 2 +- + 2 files changed, 1 insertion(+), 3 deletions(-) + +diff --git a/src/include/defaults.mk b/src/include/defaults.mk +index b8cc590..42bd3d6 100644 +--- a/src/include/defaults.mk ++++ b/src/include/defaults.mk +@@ -51,7 +51,6 @@ LDFLAGS ?= + override _CCLDFLAGS := $(CCLDFLAGS) + override _LDFLAGS := $(LDFLAGS) + override LDFLAGS = $(CFLAGS) -L. $(_LDFLAGS) $(_CCLDFLAGS) \ +- -Wl,--add-needed \ + -Wl,--build-id \ + -Wl,--no-allow-shlib-undefined \ + -Wl,--no-undefined-version \ +@@ -98,7 +97,6 @@ override _HOST_LDFLAGS := $(HOST_LDFLAGS) + override _HOST_CCLDFLAGS := $(HOST_CCLDFLAGS) + override HOST_LDFLAGS = $(HOST_CFLAGS) -L. \ + $(_HOST_LDFLAGS) $(_HOST_CCLDFLAGS) \ +- -Wl,--add-needed \ + -Wl,--build-id \ + -Wl,--no-allow-shlib-undefined \ + -Wl,-z,now \ +diff --git a/src/include/gcc.specs b/src/include/gcc.specs +index ef28e2b..d85e865 100644 +--- a/src/include/gcc.specs ++++ b/src/include/gcc.specs +@@ -5,4 +5,4 @@ + + %{!shared:%{!static:%{!r:-pie}}} %{static:-Wl,-no-fatal-warnings -Wl,-static -static -Wl,-z,relro,-z,now} -grecord-gcc-switches + + *link: +-+ %{!static:--fatal-warnings} --no-undefined-version --no-allow-shlib-undefined --add-needed -z now --build-id %{!static:%{!shared:-pie}} %{shared:-z relro} %{static:%<pie} +++ %{!static:--fatal-warnings} --no-undefined-version --no-allow-shlib-undefined -z now --build-id %{!static:%{!shared:-pie}} %{shared:-z relro} %{static:%<pie}
meta/recipes-bsp/efivar/efivar/0002-Add-T-workaround-for-GNU-ld-2.36.patch new file +33 -0
@@ -0,0 +1,33 @@ +From 8469d6f72ee2450753f044080b018f9ad7ff62dc Mon Sep 17 00:00:00 2001 +From: Robbie Harwood <[email protected]> +Date: Mon, 17 Jan 2022 12:34:55 -0500 +Subject: [PATCH] Add -T workaround for GNU ld 2.36 + +Signed-off-by: Robbie Harwood <[email protected]> +Resolves: #195 +Signed-off-by: Martin Jansa <[email protected]> +--- +Upstream-Status: Backport [https://github.com/rhboot/efivar/commit/197a0874ea4010061b98b4b55eff65b33b1cd741] + + src/include/workarounds.mk | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/include/workarounds.mk b/src/include/workarounds.mk +index 3118834..143e790 100644 +--- a/src/include/workarounds.mk ++++ b/src/include/workarounds.mk +@@ -4,12 +4,12 @@ + + LD_FLAVOR := $(shell $(LD) --version | grep -E '^(LLD|GNU ld)'|sed 's/ .*//g') + LD_VERSION := $(shell $(LD) --version | grep -E '^(LLD|GNU ld)'|sed 's/.* //') +-# I haven't tested 2.36 here; 2.35 is definitely broken and 2.37 seems to work ++# 2.35 is definitely broken and 2.36 seems to work + LD_DASH_T := $(shell \ + if [ "x${LD_FLAVOR}" = xLLD ] ; then \ + echo '-T' ; \ + elif [ "x${LD_FLAVOR}" = xGNU ] ; then \ +- if echo "${LD_VERSION}" | grep -q -E '^2\.3[789]|^2\.[456789]|^[3456789]|^[[:digit:]][[:digit:]]' ; then \ ++ if echo "${LD_VERSION}" | grep -q -E '^2\.3[6789]|^2\.[456789]|^[3456789]|^[[:digit:]][[:digit:]]' ; then \ + echo '-T' ; \ + else \ + echo "" ; \
meta/recipes-bsp/efivar/efivar/0003-Set-LC_ALL-C-to-force-English-output-from-ld.patch new file +33 -0
@@ -0,0 +1,33 @@ +From 8ea2cf0ab6182f29ecd8568cdc674b2736f6ffba Mon Sep 17 00:00:00 2001 +From: Mike Gilbert <[email protected]> +Date: Fri, 24 Jun 2022 17:00:33 -0400 +Subject: [PATCH] Set LC_ALL=C to force English output from ld + +If the user has a different locale set, ld --version may not contain the +string "GNU ld". + +For example, in Italian, ld --version outputs "ld di GNU". + +Signed-off-by: Mike Gilbert <[email protected]> +Signed-off-by: Martin Jansa <[email protected]> +--- +Upstream-Status: Backport [https://github.com/rhboot/efivar/commit/01de7438520868650bfaa1ef3e2bfaf00cacbcc6] + + src/include/workarounds.mk | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/include/workarounds.mk b/src/include/workarounds.mk +index 143e790..b72fbaf 100644 +--- a/src/include/workarounds.mk ++++ b/src/include/workarounds.mk +@@ -2,8 +2,8 @@ + # + # workarounds.mk - workarounds for weird stuff behavior + +-LD_FLAVOR := $(shell $(LD) --version | grep -E '^(LLD|GNU ld)'|sed 's/ .*//g') +-LD_VERSION := $(shell $(LD) --version | grep -E '^(LLD|GNU ld)'|sed 's/.* //') ++LD_FLAVOR := $(shell LC_ALL=C $(LD) --version | grep -E '^(LLD|GNU ld)'|sed 's/ .*//g') ++LD_VERSION := $(shell LC_ALL=C $(LD) --version | grep -E '^(LLD|GNU ld)'|sed 's/.* //') + # 2.35 is definitely broken and 2.36 seems to work + LD_DASH_T := $(shell \ + if [ "x${LD_FLAVOR}" = xLLD ] ; then \
meta/recipes-bsp/efivar/efivar/0004-LLD-fix-detection-and-remove-not-needed-workarounds.patch new file +45 -0
45 lines not on this page · raw message
meta/recipes-bsp/efivar/efivar/0005-Revamp-efi_well_known_-variable-handling.patch new file +262 -0
262 lines not on this page · raw message
meta/recipes-bsp/efivar/efivar_38.bb +5 -4
@@ -12,6 +12,11 @@ SRC_URI = "git://github.com/rhinstaller/efivar.git;branch=main;protocol=https \ file://0001-src-Makefile-build-util.c-separately-for-makeguids.patch \ file://efisecdb-fix-build-with-musl-libc.patch \ file://0001-Fix-invalid-free-in-main.patch \ + file://0001-Remove-deprecated-add-needed-linker-flag.patch \ + file://0002-Add-T-workaround-for-GNU-ld-2.36.patch \ + file://0003-Set-LC_ALL-C-to-force-English-output-from-ld.patch \ + file://0004-LLD-fix-detection-and-remove-not-needed-workarounds.patch \ + file://0005-Revamp-efi_well_known_-variable-handling.patch \ " SRCREV = "1753149d4176ebfb2b135ac0aaf79340bf0e7a93"
@@ -21,10 +26,6 @@ inherit pkgconfig export CCLD_FOR_BUILD = "${BUILD_CCLD}" -# Upstream uses --add-needed in gcc.specs which gold doesn't support, so -# enforce BFD. -LDFLAGS += "-fuse-ld=bfd" - do_compile() { oe_runmake ERRORS= HOST_CFLAGS="${BUILD_CFLAGS}" HOST_LDFLAGS="${BUILD_LDFLAGS}" }
Signature · 1 line
2.41.0