efivar-38

This commit is contained in:
Rmys
2022-07-10 12:58:40 +03:00
parent df72236e33
commit 2a3c64acb6
55 changed files with 244 additions and 12872 deletions
@@ -0,0 +1,37 @@
https://github.com/rhboot/efivar/pull/164
https://bugs.gentoo.org/749963
From: Sergei Trofimovich <slyfox@gentoo.org>
Date: Mon, 19 Oct 2020 19:05:01 +0100
Subject: [PATCH] gcc.specs: drop --fatal-warnings from linker options (ia64
compatibility)
```
$ LANG=C make HOSTCC=x86_64-pc-linux-gnu-gcc CC=ia64-unknown-linux-gnu-gcc HOST_ARCH=ia64
ia64-unknown-linux-gnu-gcc ... \
-o libefivar.so ...
/usr/libexec/gcc/ia64-unknown-linux-gnu/ld: warning: -z relro ignored
collect2: error: ld returned 1 exit status
make[1]: *** [/home/slyfox/dev/git/efivar/src/include/rules.mk:32: libefivar.so] Error 1
```
ia64 (and a few others) binutils target does not support '-z relro' and always
issues a warning. --fatal-warnings spec option turns the build into always failing one.
The change drops `--fatal-warnings` options from gcc.spec entirely.
Reported-by: Émeric Maschino
Bug: https://bugs.gentoo.org/749963
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
--- a/gcc.specs
+++ b/gcc.specs
@@ -11,7 +11,7 @@
+ %(efivar_cpp_options) -Wmaybe-uninitialized -fno-merge-constants -fvisibility=hidden %{!r:%{!fpie:%{!fPIE:%{!fpic:%{!fPIC:%{!fno-pic:-fPIE}}}}}}
*self_spec:
-+ %{!shared:%{!static:%{!r:-pie}}} %{static:-Wl,-no-fatal-warnings -Wl,-static -static -Wl,-z,relro,-z,now}
++ %{!shared:%{!static:%{!r:-pie}}} %{static:-Wl,-static -static -Wl,-z,relro,-z,now}
*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}
++ --no-undefined-version --no-allow-shlib-undefined --add-needed -z now --build-id %{!static:%{!shared:-pie}} %{shared:-z relro} %{static:%<pie}
@@ -0,0 +1,33 @@
From 847856cd72088fd5f2349be858745c632c46b6c8 Mon Sep 17 00:00:00 2001
From: Mike Gilbert <floppym@gentoo.org>
Date: Mon, 17 Jan 2022 11:42:53 -0500
Subject: [PATCH] Adjust dependency for libefivar and libefiboot objects
Depending on 'prep' causes all objects to be rebuilt every time 'make'
is invoked.
Depending on '$(GENERATED_SOURCES)' causes a build failure because
guid-symbols.c gets passed to the compiler due to a rule in rules.mk.
Depend on 'include/efivar/efivar-guids.h' directly to avoid these
issues.
Fixes: https://github.com/rhboot/efivar/issues/199
Signed-off-by: Mike Gilbert <floppym@gentoo.org>
---
src/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Makefile b/src/Makefile
index 0e423c44..c6006ebf 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -85,7 +85,7 @@ $(MAKEGUIDS_OUTPUT) : guids.txt
prep : makeguids $(GENERATED_SOURCES)
-$(LIBEFIVAR_OBJECTS) $(LIBEFIBOOT_OBJECTS) : prep
+$(LIBEFIVAR_OBJECTS) $(LIBEFIBOOT_OBJECTS) : include/efivar/efivar-guids.h
libefivar.a : | $(GENERATED_SOURCES)
libefivar.a : $(patsubst %.o,%.static.o,$(LIBEFIVAR_OBJECTS))
@@ -0,0 +1,30 @@
From 197a0874ea4010061b98b4b55eff65b33b1cd741 Mon Sep 17 00:00:00 2001
From: Robbie Harwood <rharwood@redhat.com>
Date: Mon, 17 Jan 2022 12:34:55 -0500
Subject: [PATCH] Add -T workaround for GNU ld 2.36
Signed-off-by: Robbie Harwood <rharwood@redhat.com>
Resolves: #195
---
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 31188342..143e7902 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 "" ; \
@@ -0,0 +1,60 @@
From 145c6593fa9206cc27229a9a40c49e4bed046739 Mon Sep 17 00:00:00 2001
From: Sergei Trofimovich <slyfox@gentoo.org>
Date: Mon, 19 Oct 2020 19:05:01 +0100
Subject: [PATCH] gcc.specs: drop --fatal-warnings from linker options (ia64
compatibility)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
```
$ LANG=C make HOSTCC=x86_64-pc-linux-gnu-gcc CC=ia64-unknown-linux-gnu-gcc HOST_ARCH=ia64
ia64-unknown-linux-gnu-gcc ... \
-o libefivar.so ...
/usr/libexec/gcc/ia64-unknown-linux-gnu/ld: warning: -z relro ignored
collect2: error: ld returned 1 exit status
make[1]: *** [/home/slyfox/dev/git/efivar/src/include/rules.mk:32: libefivar.so] Error 1
```
ia64 (and a few others) binutils target does not support '-z relro' and always
issues a warning. --fatal-warnings spec option turns the build into always failing one.
The change drops `--fatal-warnings` option from gcc.spec entirely.
Rejected upstream in https://github.com/rhboot/efivar/pull/164.
[sam: add extra hunk to fix 38 build.]
Reported-by: Émeric Maschino
Bug: https://bugs.gentoo.org/749963
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
---
src/include/gcc.specs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/include/gcc.specs b/src/include/gcc.specs
index ef28e2b..4deead5 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}
++ --no-undefined-version --no-allow-shlib-undefined --add-needed -z now --build-id %{!static:%{!shared:-pie}} %{shared:-z relro} %{static:%<pie}
--
2.34.1
diff --git a/src/include/defaults.mk b/src/include/defaults.mk
index 9024a3a..f5515fa 100644
--- a/src/include/defaults.mk
+++ b/src/include/defaults.mk
@@ -58,7 +58,7 @@ override LDFLAGS = $(CFLAGS) -L. $(_LDFLAGS) $(_CCLDFLAGS) \
-Wl,-z,now \
-Wl,-z,muldefs \
-Wl,-z,relro \
- -Wl,--fatal-warnings \
+ -Wl,--no-fatal-warnings \
$(call family,LDFLAGS) $(call family,CCLDFLAGS) \
$(call pkg-config-ccldflags)
override CCLDFLAGS = $(LDFLAGS)
@@ -0,0 +1,30 @@
From 01de7438520868650bfaa1ef3e2bfaf00cacbcc6 Mon Sep 17 00:00:00 2001
From: Mike Gilbert <floppym@gentoo.org>
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 <floppym@gentoo.org>
---
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 143e7902..b72fbaf6 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 \
@@ -0,0 +1,37 @@
From 43d19f297548208ce549fd87faa41e6bb86bf9c3 Mon Sep 17 00:00:00 2001
From: Mike Gilbert <floppym@gentoo.org>
Date: Mon, 17 Jan 2022 10:13:31 -0500
Subject: [PATCH] Drop "-march=native" from HOST flags
GCC does not support -march=native on some targets (ia64, riscv).
The performance enhancement for makeguids isn't worth the trouble it
causes.
Bug: https://bugs.gentoo.org/831334
Signed-off-by: Mike Gilbert <floppym@gentoo.org>
---
src/include/defaults.mk | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/src/include/defaults.mk b/src/include/defaults.mk
index 632b1551..9024a3a1 100644
--- a/src/include/defaults.mk
+++ b/src/include/defaults.mk
@@ -71,16 +71,10 @@ override SOFLAGS = $(_SOFLAGS) \
-Wl,--version-script=$(MAP) \
$(call family,SOFLAGS)
-HOST_ARCH=$(shell uname -m)
-ifneq ($(HOST_ARCH),ia64)
- HOST_MARCH=-march=native
-else
- HOST_MARCH=
-endif
HOST_CPPFLAGS ?= $(CPPFLAGS)
override _HOST_CPPFLAGS := $(HOST_CPPFLAGS)
override HOST_CPPFLAGS = $(_HOST_CPPFLAGS) \
- -DEFIVAR_BUILD_ENVIRONMENT $(HOST_MARCH)
+ -DEFIVAR_BUILD_ENVIRONMENT
HOST_CFLAGS_GCC ?=
HOST_CFLAGS_CLANG ?=
HOST_CFLAGS ?= $(CFLAGS) $(call family,HOST_CFLAGS)