From 57d7e4f5029986e97a27fcdea05997ef1cba03e6 Mon Sep 17 00:00:00 2001 From: Warner Losh Date: Sat, 26 Aug 2017 18:30:14 +0000 Subject: [PATCH] Link in libefi for boot1 Add libefi to the list of libraries we'll link in. Move EFI table definitions back to libefi so we don't have drift between the two efi_main routines. Sponsored by: Netflix --- sys/boot/efi/boot1/Makefile | 6 ++++-- sys/boot/efi/boot1/boot1.c | 5 ----- sys/boot/efi/libefi/libefi.c | 5 ++++- sys/boot/efi/loader/efi_main.c | 5 ----- 4 files changed, 8 insertions(+), 13 deletions(-) diff --git a/sys/boot/efi/boot1/Makefile b/sys/boot/efi/boot1/Makefile index 9f62ad9cd634..f6481f494250 100644 --- a/sys/boot/efi/boot1/Makefile +++ b/sys/boot/efi/boot1/Makefile @@ -76,13 +76,15 @@ CFLAGS+= -fPIC LDFLAGS+= -Wl,-znocombreloc .endif +LIBEFI= ${.OBJDIR}/../libefi/libefi.a + # # Add libstand for the runtime functions used by the compiler - for example # __aeabi_* (arm) or __divdi3 (i386). # as well as required string and memory functions for all platforms. # -DPADD+= ${LIBSTAND} -LDADD+= -lstand +DPADD+= ${LIBEFI} ${LIBSTAND} +LDADD+= ${LIBEFI} -lstand DPADD+= ${LDSCRIPT} diff --git a/sys/boot/efi/boot1/boot1.c b/sys/boot/efi/boot1/boot1.c index 102f0898633c..c40ca4ea6bd4 100644 --- a/sys/boot/efi/boot1/boot1.c +++ b/sys/boot/efi/boot1/boot1.c @@ -47,11 +47,6 @@ static const boot_module_t *boot_modules[] = /* The initial number of handles used to query EFI for partitions. */ #define NUM_HANDLES_INIT 24 -EFI_HANDLE IH; -EFI_SYSTEM_TABLE *ST; -EFI_BOOT_SERVICES *BS; -EFI_RUNTIME_SERVICES *RS; - static EFI_GUID BlockIoProtocolGUID = BLOCK_IO_PROTOCOL; static EFI_GUID DevicePathGUID = DEVICE_PATH_PROTOCOL; static EFI_GUID LoadedImageGUID = LOADED_IMAGE_PROTOCOL; diff --git a/sys/boot/efi/libefi/libefi.c b/sys/boot/efi/libefi/libefi.c index 78ebc82884b8..e0a721f58b32 100644 --- a/sys/boot/efi/libefi/libefi.c +++ b/sys/boot/efi/libefi/libefi.c @@ -32,7 +32,10 @@ __FBSDID("$FreeBSD$"); #include #include -extern EFI_SYSTEM_TABLE *ST; +EFI_HANDLE IH; +EFI_SYSTEM_TABLE *ST; +EFI_BOOT_SERVICES *BS; +EFI_RUNTIME_SERVICES *RS; void * efi_get_table(EFI_GUID *tbl) diff --git a/sys/boot/efi/loader/efi_main.c b/sys/boot/efi/loader/efi_main.c index fd8f521bbab6..045ee9bc2f7a 100644 --- a/sys/boot/efi/loader/efi_main.c +++ b/sys/boot/efi/loader/efi_main.c @@ -32,11 +32,6 @@ __FBSDID("$FreeBSD$"); #include #include -EFI_HANDLE IH; -EFI_SYSTEM_TABLE *ST; -EFI_BOOT_SERVICES *BS; -EFI_RUNTIME_SERVICES *RS; - static EFI_PHYSICAL_ADDRESS heap; static UINTN heapsize;