efi/libstub: move efi_system_table global var into separate object
authorArd Biesheuvel <ardb@kernel.org>
Fri, 6 May 2022 09:37:50 +0000 (11:37 +0200)
committerArd Biesheuvel <ardb@kernel.org>
Mon, 19 Sep 2022 09:19:35 +0000 (11:19 +0200)
To avoid pulling in the wrong object when using the libstub static
library to build the decompressor, define efi_system_table in a separate
compilation unit.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
drivers/firmware/efi/libstub/Makefile
drivers/firmware/efi/libstub/efi-stub.c
drivers/firmware/efi/libstub/systable.c [new file with mode: 0644]

index 834c0bd..da27980 100644 (file)
@@ -66,7 +66,8 @@ $(obj)/lib-%.o: $(srctree)/lib/%.c FORCE
        $(call if_changed_rule,cc_o_c)
 
 lib-$(CONFIG_EFI_GENERIC_STUB) += efi-stub.o fdt.o string.o intrinsics.o \
-                                  $(patsubst %.c,lib-%.o,$(efi-deps-y))
+                                  $(patsubst %.c,lib-%.o,$(efi-deps-y)) \
+                                  systable.o
 
 lib-$(CONFIG_ARM)              += arm32-stub.o
 lib-$(CONFIG_ARM64)            += arm64-stub.o
index 4bf7514..57ea043 100644 (file)
@@ -57,8 +57,6 @@
 static u64 virtmap_base = EFI_RT_VIRTUAL_BASE;
 static bool flat_va_mapping = (EFI_RT_VIRTUAL_OFFSET != 0);
 
-const efi_system_table_t *efi_system_table;
-
 static struct screen_info *setup_graphics(void)
 {
        efi_guid_t gop_proto = EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID;
diff --git a/drivers/firmware/efi/libstub/systable.c b/drivers/firmware/efi/libstub/systable.c
new file mode 100644 (file)
index 0000000..91d016b
--- /dev/null
@@ -0,0 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0
+
+#include <linux/efi.h>
+#include <asm/efi.h>
+
+#include "efistub.h"
+
+const efi_system_table_t *efi_system_table;