From 382c5213b20dd49dbe234c5830ab1681d1ee075d Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Mon, 8 Nov 2021 17:20:19 -0500 Subject: [PATCH 01/15] gitignore: Add some more creature comforts This adds: .gdb_history - gdb command history .C - sometimes the output of gcc -E /.cache/ - clangd cache .cer - x509 certs .esl - efi signature lists compile_commands.json - bear / clangd / etc helper Signed-off-by: Peter Jones --- .gitignore | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 1e629343..8f4237b5 100644 --- a/.gitignore +++ b/.gitignore @@ -2,11 +2,16 @@ .*.h.P .*.d .*.sw? +.gdb_history *~ *.a *.bin -*.env +*.C +/.cache/ +*.cer *.E +*.env +*.esl *.o *.map *.pc @@ -17,6 +22,7 @@ *.strace *.tar.* *.var +compile_commands.json core.* cov-int vgcore.* From bded9c7a7858b5d936a0669ed7fd57750d9bb771 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Mon, 8 Nov 2021 14:18:50 -0500 Subject: [PATCH 02/15] make: Temporarily disable gcc -flto Currently, with binutils 2.37, linking with -flto is broken: > gcc -Og -flto -g3 -Wall -Wextra -Werror -std=gnu11 -funsigned-char -fvisibility=hidden -specs=/home/pjones/devel/github.com/efivar/security/src/include/gcc.specs -fno-merge-constants -L. -Wl,--add-needed -Wl,--build-id -Wl,--no-allow-shlib-undefined -Wl,--no-undefined-version -Wl,-z,now -Wl,-z,muldefs -Wl,-z,relro -Wl,--fatal-warnings -DLIBEFIVAR_VERSION=37 -D_GNU_SOURCE -I/home/pjones/devel/github.com/efivar/security/src/include/ -shared -Wl,-soname,libefivar.so.1 -Wl,--version-script=libefivar.map \ > -o libefivar.so crc32.o dp.o dp-acpi.o dp-hw.o dp-media.o dp-message.o efivarfs.o error.o export.o guid.o guids.o guid-symbols.o lib.o vars.o -ldl > collect2: fatal error: ld terminated with signal 11 [Segmentation fault], core dumped > compilation terminated. > make[1]: *** [/home/pjones/devel/github.com/efivar/security/src/include/rules.mk:32: libefivar.so] Error 1 This commit disables -flto temporarily until the fix[0] is more widely deployed, and forces the compiler to make the .o files for efivar and efisecdb independently. It also switches to specifying .o instead of .c on the command line, because gcc won't allow multiple .c files without -flto, and makes the "% : %.o" rule use $(sort $^) instead of just $^ in order to de-duplicate, so we're not trying to link makeguids.o into makeguids twice. [0] https://sourceware.org/bugzilla/show_bug.cgi?id=28264 Signed-off-by: Peter Jones --- efivar.spec.in | 4 +++- src/Makefile | 8 +++++--- src/include/defaults.mk | 4 +++- src/include/rules.mk | 8 ++++---- 4 files changed, 15 insertions(+), 9 deletions(-) diff --git a/efivar.spec.in b/efivar.spec.in index 180e5374..afcf435c 100644 --- a/efivar.spec.in +++ b/efivar.spec.in @@ -38,7 +38,9 @@ git config --unset user.email git config --unset user.name %build -make LIBDIR=%{_libdir} BINDIR=%{_bindir} CFLAGS="$RPM_OPT_FLAGS -flto" LDFLAGS="$RPM_LD_FLAGS -flto" +%define _lto_cflags %{nil} + +make LIBDIR=%{_libdir} BINDIR=%{_bindir} CFLAGS="$RPM_OPT_FLAGS" LDFLAGS="$RPM_LD_FLAGS" %install rm -rf $RPM_BUILD_ROOT diff --git a/src/Makefile b/src/Makefile index a286dfbb..873a351a 100644 --- a/src/Makefile +++ b/src/Makefile @@ -21,8 +21,10 @@ LIBEFIVAR_SOURCES = crc32.c dp.c dp-acpi.c dp-hw.c dp-media.c dp-message.c \ lib.c vars.c LIBEFIVAR_OBJECTS = $(patsubst %.S,%.o,$(patsubst %.c,%.o,$(LIBEFIVAR_SOURCES))) EFIVAR_SOURCES = efivar.c +EFIVAR_OBJECTS = $(patsubst %.S,%.o,$(patsubst %.c,%.o,$(EFIVAR_SOURCES))) GENERATED_SOURCES = include/efivar/efivar-guids.h guid-symbols.c MAKEGUIDS_SOURCES = makeguids.c guid.c +MAKEGUIDS_OBJECTS = $(patsubst %.S,%.o,$(patsubst %.c,%.o,$(MAKEGUIDS_SOURCES))) ALL_SOURCES=$(LIBEFIBOOT_SOURCES) $(LIBEFIVAR_SOURCES) $(MAKEGUIDS_SOURCES) \ $(sort $(wildcard include/efivar/*.h)) $(GENERATED_SOURCES) $(EFIVAR_SOURCES) @@ -58,7 +60,7 @@ makeguids : CCLD=$(HOSTCCLD) makeguids : CFLAGS=$(HOST_CFLAGS) makeguids : LDFLAGS=$(HOST_LDFLAGS) makeguids : CCLDFLAGS=$(HOST_CCLDFLAGS) -makeguids : $(MAKEGUIDS_SOURCES) +makeguids : $(MAKEGUIDS_OBJECTS) guids.o : guids.S | guids.bin names.bin @@ -72,10 +74,10 @@ libefivar.so : | $(GENERATED_SOURCES) libefivar.map libefivar.so : LIBS=dl libefivar.so : MAP=libefivar.map -efivar : efivar.c | libefivar.so +efivar : $(EFIVAR_OBJECTS) | libefivar.so efivar : LIBS=efivar dl -efivar-static : efivar.c $(patsubst %.o,%.static.o,$(LIBEFIVAR_OBJECTS)) +efivar-static : $(EFIVAR_OBJECTS) $(patsubst %.o,%.static.o,$(LIBEFIVAR_OBJECTS)) efivar-static : | $(GENERATED_SOURCES) efivar-static : LIBS=dl diff --git a/src/include/defaults.mk b/src/include/defaults.mk index 511f4dae..d45aa037 100644 --- a/src/include/defaults.mk +++ b/src/include/defaults.mk @@ -19,7 +19,9 @@ $(call set-if-undefined,CCLD,$(CC)) $(call set-if-undefined,HOSTCC,$(COMPILER)) $(call set-if-undefined,HOSTCCLD,$(HOSTCC)) -OPTIMIZE_GCC = -flto +# temporary, see https://sourceware.org/bugzilla/show_bug.cgi?id=28264 +#OPTIMIZE_GCC = -flto +OPTIMIZE_GCC = OPTIMIZE ?= -Og $(call family,OPTIMIZE) DEBUGINFO ?= -g3 WARNINGS_GCC ?= diff --git a/src/include/rules.mk b/src/include/rules.mk index 99a6329e..6357d2ab 100644 --- a/src/include/rules.mk +++ b/src/include/rules.mk @@ -21,12 +21,12 @@ family = $(foreach FAMILY_SUFFIX,$(FAMILY_SUFFIXES),$($(1)_$(FAMILY_SUFFIX))) % : %.c -% : %.c - $(CCLD) $(CCLDFLAGS) $(CPPFLAGS) -o $@ $^ $(LDLIBS) +% : %.o + $(CCLD) $(CCLDFLAGS) $(CPPFLAGS) -o $@ $(sort $^) $(LDLIBS) %-static : CCLDFLAGS+=-static -%-static : %.c - $(CCLD) $(CCLDFLAGS) $(CPPFLAGS) -o $@ $^ $(LDLIBS) +%-static : %.o + $(CCLD) $(CCLDFLAGS) $(CPPFLAGS) -o $@ $(sort $^) $(LDLIBS) %.so : $(CCLD) $(CCLDFLAGS) $(CPPFLAGS) $(SOFLAGS) \ From 3de09fe25da4e23e9431ec1a46d7d0c68d3a108f Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Mon, 8 Nov 2021 17:29:49 -0500 Subject: [PATCH 03/15] abixml: Rebuild the abixml files for newer abidw version This just updates the files to a newer version of abidw. Signed-off-by: Peter Jones --- src/libefiboot.abixml | 3009 ++++++++++++++++++++++---------------- src/libefivar.abixml | 3210 +++++++++++++++++++++++------------------ 2 files changed, 3566 insertions(+), 2653 deletions(-) diff --git a/src/libefiboot.abixml b/src/libefiboot.abixml index ab75cbbe..7f82c016 100644 --- a/src/libefiboot.abixml +++ b/src/libefiboot.abixml @@ -1,4 +1,4 @@ - + @@ -22,1828 +22,2341 @@ - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - + + - - + + - - + + + + + - - + + - - + + - - + + - - + + - - + + - - + + + + - - + + - - + + + + - - + + - - + + - - + + - - + + - - + + + + - - + + - - + + - - + + - - + + + + - - + + - - + + - - + + - - + + - - + + + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + + + - - + + - - + + - - + + - - + + - - + + + + - - + + - - + + - - + + - - + + + + - - + + - - + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + - - + + - - + + - - + + - - + + - - + + + + - - + + - + - + - - + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + - + - - + + - - + + + + + + + + + + + - - + + + + + + - + - - + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + - + - - + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + - + - - + + - + + - + - + - - + + + + + + + + - + - - + + - - - - - - - - - - - - - + + + + + + + + + + + + + + - + - + - - + + - + - + - + - - + + - + - + - + - - + + - + - + - + - + - + - - - - - - - + + - + - + - - - - - - - + + - + - + - + - + - - + + - + - + - + - - + + - + - + - + - + - - + + - + - + - + - + - - - - - - - + + - + - + - + - - + + - + - + - + - - + + - + - + - + - + - + - + - - + + - + - + - + - + - + - - + + - + - + - - + + - + - + - + - + - - + + - + - + - - + + - + - + - + - - - - - - - + + - + - + - + - + - + - + - + - + - + - - - - - - - - + + - + - + - + - + - + - + - + - + - + - - - - - - - + + - + - + - - + + - + - + - + - + - + - + - - - - - - - - + + + - - + + - - + + - + - + - + - + - + - + - - + + - + - + - + - - + + - + - + - + - - + + - + - + - + - + - + - + - + - + - - + + - + - + - + - + - + - + - - + + - + - + - + - + - + - + - - + + - + - + - + - - + + - + - + - - + + - + - + - + - - + + - + - + - - + + - + - + - - + + - + - + - - + + - + - + - - + + - + - + - + - - + + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - + + - + - + - - + + - + - + - + - + - + - + - + - - + + - + - + - + - + - - + + - + - + - + - - + + - + - + - - + + - + - + - - + + - + - + - - + + - + - + - - + + - + - + - + - + - - + + - + - + - + - + - + - - + + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - + - - - - - + + + + - - + + - - - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - - - - - - - - - - - - + + - - + + - - - - - - - - - - - + + - - + + - - + + - - + + - - + + - - + + - - - - + + - - + + - - - - + + - - + + - - + + - - + + - - + + - - - - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + - - - - + - - + + - - + + - + + + - - - - - - - - - - - - - + - + + - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - + + + + - - + + - - + + - - + + + - + - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + - - - - - - - - - - - - - - - - - diff --git a/src/libefivar.abixml b/src/libefivar.abixml index 2dbb8387..cf4f24da 100644 --- a/src/libefivar.abixml +++ b/src/libefivar.abixml @@ -1,7 +1,7 @@ - + - + @@ -22,12 +22,12 @@ - + - + @@ -114,1918 +114,2318 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + - - + + + - - + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - - + + + - + - + - + - - + + - + - + - - + + - + - + - + - + - - + + - + - + - + - - - - - - - + + - + - + - - + + - + - + - + - - + + - + - + - + - - + + - + - + - + - + - + - - - - - - - + + - + - + - - - - - - - + + - + - + - + - + - - + + - + - + - + - - + + - + - + - + - + - - + + - + - + - + - + - - - - - - - + + - + - + - + - - + + - + - + - + - - + + - + - + - + - + - + - + - - + + - + - + - + - + - + - - - - - - - + + - + - + - - + + - + - + - + - + - - + + - + - + - - + + - + - + - + - - - - - - - + + - + - + - + - + - + - + - + - + - + - - - - - - - - + + - + - + - + - + - + - + - + - + - + - - - - - - - + + - + - + - - + + - + - + - + - + - + - + - - - - - - - - + + + - - + + - - + + - + - + - + - + - + - + - - + + - + - + - + - - + + - + - + - + - - + + - + - + - + - + - + - + - + - + - - + + - + - + - + - + - + - + - - + + - + - + - + - + - + - + - - + + - + - + - + - - + + - + - + - - + + - + - + - + - - + + - + - + - - + + - + - + - - + + - + - + - - + + - + - + - - + + - + - + - + - - + + - + - + - + - - - - - - - - - - - - - - - - - + + - + - - - - - + + - - - - - - - - - + + - + - - - - - - - - - - + - + - + - + - + - + - - + + - + - + - + - + - - + + - + - + - + - - + + - + - + - - + + - + - + - - + + - + - + - - + + - + - + - - + + - + - + - + - + - - + + - + - + - + - + - + - - + + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + - - - - + + + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - - - + + + + + + + + + + + - - + + + - - - - - - - + + + + + + + + - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 16851499116b7c4e20020a9f1685571150501723 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Wed, 10 Nov 2021 16:57:07 -0500 Subject: [PATCH 04/15] efivar: Fix guid sort order For a long time, we've compared guids and their symbolic names with memcmp(). That provides a stable sort order, and very little (if anything) depends on the sorted order of a list of GUIDs for anything other than searching. Unfortunately, when you're actually looking at the sorted output of a list of guids, this winds up being incredibly confusing, because the first element of a guid is a little endian uint23_t, which means memcmp() is evaluating the bytes in a different order than sorting a text file full of guids would. This patch switches to comparing the internal integral members of the guid as unsigned integers, which is still slightly confusing when it comes to the 4th one (it is compared opposite of how it appears, because GUIDs are terrible), and to comparing the symbolic names with strncmp(). Signed-off-by: Peter Jones --- src/guid.c | 6 +++--- src/guid.h | 28 ++++++++++++++++++++++++++++ src/libefivar.abixml | 6 ++++++ src/makeguids.c | 5 +++-- 4 files changed, 40 insertions(+), 5 deletions(-) diff --git a/src/guid.c b/src/guid.c index 0d6ed981..04c54be4 100644 --- a/src/guid.c +++ b/src/guid.c @@ -19,7 +19,7 @@ extern const efi_guid_t efi_guid_zero; int NONNULL(1, 2) PUBLIC efi_guid_cmp(const efi_guid_t *a, const efi_guid_t *b) { - return memcmp(a, b, sizeof (efi_guid_t)); + return efi_guid_cmp_(a, b); } int NONNULL(1) PUBLIC @@ -91,7 +91,7 @@ cmpguidp(const void *p1, const void *p2) struct guidname *gn1 = (struct guidname *)p1; struct guidname *gn2 = (struct guidname *)p2; - return memcmp(&gn1->guid, &gn2->guid, sizeof (gn1->guid)); + return efi_guid_cmp_(&gn1->guid, &gn2->guid); } static int NONNULL(1, 2) @@ -100,7 +100,7 @@ cmpnamep(const void *p1, const void *p2) struct guidname *gn1 = (struct guidname *)p1; struct guidname *gn2 = (struct guidname *)p2; - return memcmp(gn1->name, gn2->name, sizeof (gn1->name)); + return strncmp(gn1->name, gn2->name, sizeof (gn1->name)); } static int NONNULL(1, 2) diff --git a/src/guid.h b/src/guid.h index f384bccb..0068a9f3 100644 --- a/src/guid.h +++ b/src/guid.h @@ -169,6 +169,34 @@ struct guidname { char name[256]; }; +static inline int +efi_int_cmp_(uint64_t a, uint64_t b) +{ + if (a < b) + return -1; + if (a > b) + return 1; + return 0; +} + +static inline int NONNULL(1, 2) +efi_guid_cmp_(const efi_guid_t *a, const efi_guid_t *b) +{ + if (a->a != b->a) + return efi_int_cmp_(a->a, b->a); + if (a->b != b->b) + return efi_int_cmp_(a->b, b->b); + if (a->c != b->c) + return efi_int_cmp_(a->c, b->c); + if (a->d != b->d) + return efi_int_cmp_(be16_to_cpu(a->d), be16_to_cpu(b->d)); + for (size_t i = 0; i < sizeof(a->e)/sizeof(a->e[0]); i++) { + if (a->e[i] != b->e[i]) + return efi_int_cmp_(a->e[i], b->e[i]); + } + return 0; +} + #endif /* LIBEFIVAR_GUID */ // vim:fenc=utf-8:tw=75:noet diff --git a/src/libefivar.abixml b/src/libefivar.abixml index cf4f24da..d5a87541 100644 --- a/src/libefivar.abixml +++ b/src/libefivar.abixml @@ -2320,6 +2320,12 @@ + + + + + + diff --git a/src/makeguids.c b/src/makeguids.c index 2648a121..3633b8ec 100644 --- a/src/makeguids.c +++ b/src/makeguids.c @@ -14,6 +14,7 @@ #include #include "efivar.h" +#include "guid.h" efi_guid_t const efi_guid_zero = {0}; efi_guid_t const efi_guid_empty = {0}; @@ -29,7 +30,7 @@ cmpguidp(const void *p1, const void *p2) struct guidname *gn1 = (struct guidname *)p1; struct guidname *gn2 = (struct guidname *)p2; - return memcmp(&gn1->guid, &gn2->guid, sizeof (gn1->guid)); + return efi_guid_cmp_(&gn1->guid, &gn2->guid); } static int @@ -38,7 +39,7 @@ cmpnamep(const void *p1, const void *p2) struct guidname *gn1 = (struct guidname *)p1; struct guidname *gn2 = (struct guidname *)p2; - return memcmp(gn1->name, gn2->name, sizeof (gn1->name)); + return strncmp(gn1->name, gn2->name, sizeof (gn1->name)); } struct guid_aliases { From 430829c6443d61951fcbc28de3155226e43c70bd Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Mon, 8 Nov 2021 20:10:07 -0500 Subject: [PATCH 05/15] make: remove makeguids dependency from 'make clean' This will keep makeguids from being built when you run 'make clean', which was annoying. Signed-off-by: Peter Jones --- Makefile | 5 +++++ docs/Makefile | 2 ++ src/Makefile | 35 +++++++++++++++++++++++------------ src/guid.c | 6 +----- src/guid.h | 10 ++++++++++ src/include/deps.mk | 6 ++++-- src/libefivar.abixml | 24 ++++++++++++------------ src/makeguids.c | 2 +- 8 files changed, 58 insertions(+), 32 deletions(-) diff --git a/Makefile b/Makefile index 7a4ac8c6..d5fa3eac 100644 --- a/Makefile +++ b/Makefile @@ -20,6 +20,11 @@ install : $(MAKE) -C $$x $@ ; \ done +prep : + @set -e ; for x in $(SUBDIRS) ; do \ + $(MAKE) -C $$x $@ ; \ + done + abidw abicheck efivar efivar-static static: $(MAKE) -C src $@ diff --git a/docs/Makefile b/docs/Makefile index 2f6fc89b..24d96bf5 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -40,6 +40,8 @@ all : clean : +prep : + test : install : diff --git a/src/Makefile b/src/Makefile index 873a351a..e12d194b 100644 --- a/src/Makefile +++ b/src/Makefile @@ -23,13 +23,15 @@ LIBEFIVAR_OBJECTS = $(patsubst %.S,%.o,$(patsubst %.c,%.o,$(LIBEFIVAR_SOURCES))) EFIVAR_SOURCES = efivar.c EFIVAR_OBJECTS = $(patsubst %.S,%.o,$(patsubst %.c,%.o,$(EFIVAR_SOURCES))) GENERATED_SOURCES = include/efivar/efivar-guids.h guid-symbols.c -MAKEGUIDS_SOURCES = makeguids.c guid.c +MAKEGUIDS_SOURCES = makeguids.c MAKEGUIDS_OBJECTS = $(patsubst %.S,%.o,$(patsubst %.c,%.o,$(MAKEGUIDS_SOURCES))) ALL_SOURCES=$(LIBEFIBOOT_SOURCES) $(LIBEFIVAR_SOURCES) $(MAKEGUIDS_SOURCES) \ $(sort $(wildcard include/efivar/*.h)) $(GENERATED_SOURCES) $(EFIVAR_SOURCES) +ifneq ($(MAKECMDGOALS),clean) $(call deps-of,$(ALL_SOURCES)) : | deps -include $(call deps-of,$(ALL_SOURCES)) +endif all : $(TARGETS) @@ -46,13 +48,6 @@ abidw : $(patsubst %.so,%.abixml,$(LIBTARGETS)) abicheck : $(patsubst %.so,%.abicheck,$(LIBTARGETS)) -./guid-symbols.c : include/efivar/efivar-guids.h -./guids.bin : include/efivar/efivar-guids.h -./names.bin : include/efivar/efivar-guids.h -include/efivar/efivar-guids.h : makeguids guids.txt - ./makeguids guids.txt guids.bin names.bin \ - guid-symbols.c include/efivar/efivar-guids.h - makeguids : CPPFLAGS=$(HOST_CPPFLAGS) makeguids : LIBS=dl makeguids : CC=$(HOSTCC) @@ -62,9 +57,27 @@ makeguids : LDFLAGS=$(HOST_LDFLAGS) makeguids : CCLDFLAGS=$(HOST_CCLDFLAGS) makeguids : $(MAKEGUIDS_OBJECTS) +guid-symbols.c : makeguids | guids.txt + ./makeguids guids.txt guids.bin names.bin \ + guid-symbols.c include/efivar/efivar-guids.h + +guids.bin : makeguids | guids.txt + ./makeguids guids.txt guids.bin names.bin \ + guid-symbols.c include/efivar/efivar-guids.h + +names.bin : makeguids | guids.txt + ./makeguids guids.txt guids.bin names.bin \ + guid-symbols.c include/efivar/efivar-guids.h + +include/efivar/efivar-guids.h : makeguids | guids.txt + ./makeguids guids.txt guids.bin names.bin \ + guid-symbols.c include/efivar/efivar-guids.h + guids.o : guids.S | guids.bin names.bin -$(LIBEFIVAR_OBJECTS) $(LIBEFIBOOT_OBJECTS) : | $(GENERATED_SOURCES) +prep : makeguids $(GENERATED_SOURCES) + +$(LIBEFIVAR_OBJECTS) $(LIBEFIBOOT_OBJECTS) : prep libefivar.a : | $(GENERATED_SOURCES) libefivar.a : $(patsubst %.o,%.static.o,$(LIBEFIVAR_OBJECTS)) @@ -122,6 +135,4 @@ test : all .PHONY: test deps abiclean abixml .SECONDARY : libefivar.so.1.$(VERSION) libefivar.so.1 .SECONDARY : libefiboot.so.1.$(VERSION) libefiboot.so.1 -.SECONDARY : include/efivar/efivar-guids.h guid-symbols.c -.INTERMEDIATE : guids.bin names.bin -.PRECIOUS : guid-symbols.o makeguids +.PRECIOUS : makeguids diff --git a/src/guid.c b/src/guid.c index 04c54be4..676a70b4 100644 --- a/src/guid.c +++ b/src/guid.c @@ -35,11 +35,7 @@ efi_guid_is_empty(const efi_guid_t *guid) int NONNULL(1, 2) PUBLIC efi_str_to_guid(const char *s, efi_guid_t *guid) { - int rc; - rc = text_to_guid(s, guid); - if (rc < 0) - efi_error("text_to_guid(\"%s\",...)", s); - return rc; + return efi_str_to_guid_(s, guid); } int NONNULL(1) PUBLIC diff --git a/src/guid.h b/src/guid.h index 0068a9f3..198a7009 100644 --- a/src/guid.h +++ b/src/guid.h @@ -197,6 +197,16 @@ efi_guid_cmp_(const efi_guid_t *a, const efi_guid_t *b) return 0; } +static inline int NONNULL(1, 2) +efi_str_to_guid_(const char *s, efi_guid_t *guid) +{ + int rc; + rc = text_to_guid(s, guid); + if (rc < 0) + efi_error("text_to_guid(\"%s\",...)", s); + return rc; +} + #endif /* LIBEFIVAR_GUID */ // vim:fenc=utf-8:tw=75:noet diff --git a/src/include/deps.mk b/src/include/deps.mk index 3c824314..b33a926f 100644 --- a/src/include/deps.mk +++ b/src/include/deps.mk @@ -7,10 +7,12 @@ include $(TOPDIR)/src/include/rules.mk include $(TOPDIR)/src/include/defaults.mk .%.d : %.c - $(CC) $(CFLAGS) $(CPPFLAGS) -MM -MG -MF $@ $^ + @$(CC) $(CFLAGS) $(CPPFLAGS) -MM -MG -MF $@ $^ + @sed -i 's/:/: |/g' $@ .%.d : %.S - $(CC) $(CFLAGS) $(CPPFLAGS) -MM -MG -MF $@ $^ + @$(CC) $(CFLAGS) $(CPPFLAGS) -MM -MG -MF $@ $^ + @sed -i 's/:/: |/g' $@ SOURCES ?= diff --git a/src/libefivar.abixml b/src/libefivar.abixml index d5a87541..46b935f9 100644 --- a/src/libefivar.abixml +++ b/src/libefivar.abixml @@ -2286,24 +2286,24 @@ - - - + + + - - - + + + - - - + + + - - - + + + diff --git a/src/makeguids.c b/src/makeguids.c index 3633b8ec..ffe6eeea 100644 --- a/src/makeguids.c +++ b/src/makeguids.c @@ -159,7 +159,7 @@ main(int argc, char *argv[]) *end = '\0'; efi_guid_t guid; - rc = efi_str_to_guid(guidstr, &guid); + rc = efi_str_to_guid_(guidstr, &guid); if (rc < 0) err(1, "makeguids: \"%s\": 4 invalid data on line %d", argv[1], line); From 680790c4bf74f46de5cb45a9d694a1ae7dc06aab Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Tue, 9 Nov 2021 10:34:21 -0500 Subject: [PATCH 06/15] make: make "make -j48 clean all" work better Signed-off-by: Peter Jones --- Makefile | 36 +++++++++++++++--------------------- src/Makefile | 28 +++++++++++++--------------- 2 files changed, 28 insertions(+), 36 deletions(-) diff --git a/Makefile b/Makefile index d5fa3eac..66f15a54 100644 --- a/Makefile +++ b/Makefile @@ -9,23 +9,13 @@ include $(TOPDIR)/src/include/scan-build.mk SUBDIRS := src docs -all : | efivar.spec src/include/version.mk -all : +all : | efivar.spec src/include/version.mk prep +all clean install prep : @set -e ; for x in $(SUBDIRS) ; do \ $(MAKE) -C $$x $@ ; \ done -install : - @set -e ; for x in $(SUBDIRS) ; do \ - $(MAKE) -C $$x $@ ; \ - done - -prep : - @set -e ; for x in $(SUBDIRS) ; do \ - $(MAKE) -C $$x $@ ; \ - done - -abidw abicheck efivar efivar-static static: +abicheck abidw efivar efivar-static static : | all $(MAKE) -C src $@ abiupdate : @@ -33,10 +23,13 @@ abiupdate : $(MAKE) -C src abiclean abixml $(SUBDIRS) : - $(MAKE) -C $@ + $(MAKE) -C $@ all brick : all - @set -e ; for x in $(SUBDIRS) ; do $(MAKE) -C $${x} test ; done + @echo -n $(info this is the rule for brick PWD:$(PWD) MAKECMDGOALS:$(MAKECMDGOALS)) + @set -e ; for x in $(SUBDIRS) ; do \ + $(MAKE) -C $${x} test ; \ + done a : @if [ $${EUID} != 0 ]; then \ @@ -44,16 +37,12 @@ a : exit 1 ; \ fi -.PHONY: $(SUBDIRS) a brick abiupdate - GITTAG = $(shell bash -c "echo $$(($(VERSION) + 1))") efivar.spec : | Makefile src/include/version.mk -clean : - @set -e ; for x in $(SUBDIRS) ; do \ - $(MAKE) -C $$x $@ ; \ - done +clean : clean-toplevel +clean-toplevel: @rm -vf efivar.spec vgcore.* core.* test : all @@ -88,4 +77,9 @@ archive: abicheck bumpver abidw tag efivar.spec @rm -rf /tmp/efivar-$(GITTAG) @echo "The archive is in efivar-$(GITTAG).tar.bz2" +.PHONY: $(SUBDIRS) +.PHONY: a abiclean abicheck abidw abiupdate all archive +.PHONY: brick bumpver clean clean-toplevel +.PHONY: efivar efivar-static +.PHONY: install prep tag test test-archive .NOTPARALLEL: diff --git a/src/Makefile b/src/Makefile index e12d194b..87a62744 100644 --- a/src/Makefile +++ b/src/Makefile @@ -25,6 +25,8 @@ EFIVAR_OBJECTS = $(patsubst %.S,%.o,$(patsubst %.c,%.o,$(EFIVAR_SOURCES))) GENERATED_SOURCES = include/efivar/efivar-guids.h guid-symbols.c MAKEGUIDS_SOURCES = makeguids.c MAKEGUIDS_OBJECTS = $(patsubst %.S,%.o,$(patsubst %.c,%.o,$(MAKEGUIDS_SOURCES))) +MAKEGUIDS_OUTPUT = guids.bin names.bin $(GENERATED_SOURCES) + ALL_SOURCES=$(LIBEFIBOOT_SOURCES) $(LIBEFIVAR_SOURCES) $(MAKEGUIDS_SOURCES) \ $(sort $(wildcard include/efivar/*.h)) $(GENERATED_SOURCES) $(EFIVAR_SOURCES) @@ -37,6 +39,9 @@ all : $(TARGETS) static : $(STATICTARGETS) +$(BINTARGETS) : | $(LIBTARGETS) $(PCTARGETS) +$(STATICTARGETS) : | $(STATICLIBTARGETS) $(PCTARGETS) + abiclean : @rm -vf $(patsubst %.so,%.abixml,$@) @@ -57,23 +62,13 @@ makeguids : LDFLAGS=$(HOST_LDFLAGS) makeguids : CCLDFLAGS=$(HOST_CCLDFLAGS) makeguids : $(MAKEGUIDS_OBJECTS) -guid-symbols.c : makeguids | guids.txt - ./makeguids guids.txt guids.bin names.bin \ - guid-symbols.c include/efivar/efivar-guids.h - -guids.bin : makeguids | guids.txt - ./makeguids guids.txt guids.bin names.bin \ - guid-symbols.c include/efivar/efivar-guids.h - -names.bin : makeguids | guids.txt - ./makeguids guids.txt guids.bin names.bin \ - guid-symbols.c include/efivar/efivar-guids.h - -include/efivar/efivar-guids.h : makeguids | guids.txt +$(MAKEGUIDS_OUTPUT) : makeguids +$(MAKEGUIDS_OUTPUT) : guids.txt ./makeguids guids.txt guids.bin names.bin \ guid-symbols.c include/efivar/efivar-guids.h -guids.o : guids.S | guids.bin names.bin +guids.o : | makeguids +guids.o : guids.S guids.bin names.bin prep : makeguids $(GENERATED_SOURCES) @@ -132,7 +127,10 @@ install : all test : all $(MAKE) -C test $@ -.PHONY: test deps abiclean abixml +.PHONY: abiclean abicheck abidw abixml all +.PHONY: clean deps install test .SECONDARY : libefivar.so.1.$(VERSION) libefivar.so.1 .SECONDARY : libefiboot.so.1.$(VERSION) libefiboot.so.1 +.SECONDARY : $(GENERATED_SOURCES) +.INTERMEDIATE : guids.bin names.bin .PRECIOUS : makeguids From d55683627a77bfff0ed194bcffb97e38f28c69ac Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Tue, 9 Nov 2021 09:58:53 -0500 Subject: [PATCH 07/15] make: Don't install our unit-test targets Signed-off-by: Peter Jones --- src/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Makefile b/src/Makefile index 87a62744..2325dfbc 100644 --- a/src/Makefile +++ b/src/Makefile @@ -122,7 +122,7 @@ install : all $(INSTALL) -d -m 755 $(DESTDIR)$(INCLUDEDIR)/efivar $(foreach x, $(sort $(wildcard $(TOPDIR)/src/include/efivar/*.h)), $(INSTALL) -m 644 $(x) $(DESTDIR)$(INCLUDEDIR)/efivar/$(notdir $(x));) $(INSTALL) -d -m 755 $(DESTDIR)$(BINDIR) - $(foreach x, $(BINTARGETS), $(INSTALL) -m 755 $(x) $(DESTDIR)$(BINDIR);) + $(foreach x, $(filter-out %-test,$(BINTARGETS)), $(INSTALL) -m 755 $(x) $(DESTDIR)$(BINDIR);) test : all $(MAKE) -C test $@ From b153486bc873ef8c4cb71b4be3ba9b306c0caa18 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Tue, 9 Nov 2021 11:28:31 -0500 Subject: [PATCH 08/15] make: fix all our unset variable references Signed-off-by: Peter Jones --- src/include/defaults.mk | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/include/defaults.mk b/src/include/defaults.mk index d45aa037..a889a2e7 100644 --- a/src/include/defaults.mk +++ b/src/include/defaults.mk @@ -7,6 +7,7 @@ INCLUDEDIR ?= $(PREFIX)/include BINDIR ?= $(EXEC_PREFIX)/bin PCDIR ?= $(LIBDIR)/pkgconfig DESTDIR ?= +PKGS ?= CROSS_COMPILE ?= COMPILER ?= gcc @@ -27,6 +28,7 @@ DEBUGINFO ?= -g3 WARNINGS_GCC ?= WARNINGS_CCC_ANALYZER ?= $(WARNINGS_GCC) WARNINGS ?= -Wall -Wextra $(call family,WARNINGS) +ERRORS_GCC ?= ERRORS ?= -Werror $(call family,ERRORS) CPPFLAGS ?= override _CPPFLAGS := $(CPPFLAGS) @@ -79,6 +81,7 @@ HOST_CPPFLAGS ?= $(CPPFLAGS) override _HOST_CPPFLAGS := $(HOST_CPPFLAGS) override HOST_CPPFLAGS = $(_HOST_CPPFLAGS) \ -DEFIVAR_BUILD_ENVIRONMENT $(HOST_MARCH) +HOST_CFLAGS_GCC ?= HOST_CFLAGS_CLANG ?= HOST_CFLAGS ?= $(CFLAGS) $(call family,HOST_CFLAGS) override _HOST_CFLAGS := $(HOST_CFLAGS) @@ -109,8 +112,6 @@ RANLIB := $(CROSS_COMPILE)$(COMPILER)-ranlib ABIDW := abidw ABIDIFF := abidiff -PKGS = - LDLIBS=$(foreach lib,$(LIBS),-l$(lib)) $(call pkg-config-ldlibs) COMMIT_ID=$(shell git log -1 --pretty=%H 2>/dev/null || echo master) From e30e54d426c6a694cde09faada44be83346dbf3d Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Tue, 9 Nov 2021 09:59:19 -0500 Subject: [PATCH 09/15] rpm spec: Fix our license tag Signed-off-by: Peter Jones --- efivar.spec.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/efivar.spec.in b/efivar.spec.in index afcf435c..bc640470 100644 --- a/efivar.spec.in +++ b/efivar.spec.in @@ -2,7 +2,7 @@ Name: efivar Version: @@VERSION@@ Release: 1%{?dist} Summary: Tools to manage UEFI variables -License: LGPLv2.1 +License: LGPL-2.1 URL: https://github.com/rhinstaller/efivar Requires: %{name}-libs = %{version}-%{release} ExclusiveArch: %{ix86} x86_64 aarch64 From 15895030b0b35258532d91a738ab24716773b2cd Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Tue, 9 Nov 2021 10:08:03 -0500 Subject: [PATCH 10/15] rpm spec: use efi-srpm-macros Signed-off-by: Peter Jones --- efivar.spec.in | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/efivar.spec.in b/efivar.spec.in index bc640470..8d34d6df 100644 --- a/efivar.spec.in +++ b/efivar.spec.in @@ -5,9 +5,12 @@ Summary: Tools to manage UEFI variables License: LGPL-2.1 URL: https://github.com/rhinstaller/efivar Requires: %{name}-libs = %{version}-%{release} -ExclusiveArch: %{ix86} x86_64 aarch64 +ExclusiveArch: %{efi} -BuildRequires: git glibc-static libabigail +BuildRequires: efi-srpm-macros +BuildRequires: git +BuildRequires: glibc-static +BuildRequires: libabigail Source0: https://github.com/rhboot/efivar/archive/%{version}.tar.gz %description From a258adcea1767fb7d816137b310cfbc2b02a97d2 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Tue, 9 Nov 2021 10:09:39 -0500 Subject: [PATCH 11/15] rpm spec: fix our URLs Signed-off-by: Peter Jones --- efivar.spec.in | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/efivar.spec.in b/efivar.spec.in index 8d34d6df..d7032f02 100644 --- a/efivar.spec.in +++ b/efivar.spec.in @@ -3,7 +3,7 @@ Version: @@VERSION@@ Release: 1%{?dist} Summary: Tools to manage UEFI variables License: LGPL-2.1 -URL: https://github.com/rhinstaller/efivar +URL: https://github.com/rhboot/efivar Requires: %{name}-libs = %{version}-%{release} ExclusiveArch: %{efi} @@ -11,7 +11,9 @@ BuildRequires: efi-srpm-macros BuildRequires: git BuildRequires: glibc-static BuildRequires: libabigail -Source0: https://github.com/rhboot/efivar/archive/%{version}.tar.gz +# please don't fix this to reflect github's incomprehensible url that goes +# to a different tarball. +Source0: https://github.com/rhboot/efivar/releases/download/%{version}/efivar-%{version}.tar.bz2 %description efivar provides a simple command line interface to the UEFI variable facility. From 472ff04c7605a54c48f37ad3dad2352eb0fae14e Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Tue, 9 Nov 2021 10:10:27 -0500 Subject: [PATCH 12/15] rpm spec: general housekeeping Signed-off-by: Peter Jones --- efivar.spec.in | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/efivar.spec.in b/efivar.spec.in index d7032f02..3d78d1e5 100644 --- a/efivar.spec.in +++ b/efivar.spec.in @@ -48,20 +48,14 @@ git config --unset user.name make LIBDIR=%{_libdir} BINDIR=%{_bindir} CFLAGS="$RPM_OPT_FLAGS" LDFLAGS="$RPM_LD_FLAGS" %install -rm -rf $RPM_BUILD_ROOT %makeinstall -%clean -rm -rf $RPM_BUILD_ROOT - %check %ifarch x86_64 make abicheck %endif -%post libs -p /sbin/ldconfig - -%postun libs -p /sbin/ldconfig +%ldconfig_scriptlets libs %files %{!?_licensedir:%global license %%doc} From 16ce3c573618ffcb44b6a5285da48930758c408f Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Tue, 9 Nov 2021 10:11:01 -0500 Subject: [PATCH 13/15] rpm spec: install our abignore file Signed-off-by: Peter Jones --- efivar.spec.in | 1 + 1 file changed, 1 insertion(+) diff --git a/efivar.spec.in b/efivar.spec.in index 3d78d1e5..911b87ac 100644 --- a/efivar.spec.in +++ b/efivar.spec.in @@ -49,6 +49,7 @@ make LIBDIR=%{_libdir} BINDIR=%{_bindir} CFLAGS="$RPM_OPT_FLAGS" LDFLAGS="$RPM_L %install %makeinstall +install -m 0644 src/abignore %{buildroot}%{_includedir}/efivar/.abignore %check %ifarch x86_64 From 5ae48d406babe90e481371fe8d900d8738fcf7bc Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Tue, 9 Nov 2021 09:59:33 -0500 Subject: [PATCH 14/15] rpm spec: update some build deps Some of the systems we build in now make us explicitly list gcc and make, so here they are. Signed-off-by: Peter Jones --- efivar.spec.in | 3 +++ 1 file changed, 3 insertions(+) diff --git a/efivar.spec.in b/efivar.spec.in index 911b87ac..ecf0895d 100644 --- a/efivar.spec.in +++ b/efivar.spec.in @@ -8,9 +8,12 @@ Requires: %{name}-libs = %{version}-%{release} ExclusiveArch: %{efi} BuildRequires: efi-srpm-macros +BuildRequires: gcc BuildRequires: git BuildRequires: glibc-static BuildRequires: libabigail +BuildRequires: mandoc +BuildRequires: make # please don't fix this to reflect github's incomprehensible url that goes # to a different tarball. Source0: https://github.com/rhboot/efivar/releases/download/%{version}/efivar-%{version}.tar.bz2 From b4b14d4995efa47590ac16d12694d8f739c7cbd7 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Tue, 9 Nov 2021 13:33:10 -0500 Subject: [PATCH 15/15] Fix missing ABI exports for some db/dbx guids This adds a couple of guids to our libefivar ABI, and also adds a checker so builds will fail if more are incorrectly added. Signed-off-by: Peter Jones [rharwood@redhat.com: commit message tweak] --- src/Makefile | 11 +++++++++++ src/libefivar.abixml | 6 ++++-- src/libefivar.map.in | 2 ++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/Makefile b/src/Makefile index 2325dfbc..debda257 100644 --- a/src/Makefile +++ b/src/Makefile @@ -64,6 +64,17 @@ makeguids : $(MAKEGUIDS_OBJECTS) $(MAKEGUIDS_OUTPUT) : makeguids $(MAKEGUIDS_OUTPUT) : guids.txt + @set -e ; \ + missing=no ; \ + for x in $$(cat guids.txt | awk '{ print $$2 }' | grep -v ^zz) ; do \ + if ! grep -q "efi_guid_$${x}" libefivar.map.in ; then \ + echo missing symbol "efi_guid_$${x}" ; \ + missing=yes ; \ + fi ; \ + done ; \ + if [ "$${missing}" != "no" ]; then \ + exit 1 ; \ + fi ./makeguids guids.txt guids.bin names.bin \ guid-symbols.c include/efivar/efivar-guids.h diff --git a/src/libefivar.abixml b/src/libefivar.abixml index 46b935f9..32b84c06 100644 --- a/src/libefivar.abixml +++ b/src/libefivar.abixml @@ -75,7 +75,9 @@ + + @@ -2254,7 +2256,7 @@ - + @@ -2263,7 +2265,7 @@ - + diff --git a/src/libefivar.map.in b/src/libefivar.map.in index 54bfb765..94e3370f 100644 --- a/src/libefivar.map.in +++ b/src/libefivar.map.in @@ -135,7 +135,9 @@ LIBEFIVAR_1.38 { global: efi_error_pop; efi_set_loglevel; efi_get_libefivar_version; + efi_guid_auto_created_boot_option; efi_guid_grub; + efi_guid_external_management; efi_variable_alloc; efi_variable_export_dmpstore; } LIBEFIVAR_1.37;