diff options
author | Ard Biesheuvel <ard.biesheuvel@linaro.org> | 2014-11-05 11:00:56 -0500 |
---|---|---|
committer | Matt Fleming <matt.fleming@intel.com> | 2014-11-11 17:23:11 -0500 |
commit | 243b6754cd17112bbf0724ed3c13446b48cf6a28 (patch) | |
tree | d105e79e798f37fabc49ae2996534af800c77379 /arch/x86/boot | |
parent | af5a29aee4d1e5b5fbfbaf45cb097f9c6257c7b8 (diff) |
efi/x86: Move x86 back to libstub
This reverts commit 84be880560fb, which itself reverted my original
attempt to move x86 from #include'ing .c files from across the tree
to using the EFI stub built as a static library.
The issue that affected the original approach was that splitting
the implementation into several .o files resulted in the variable
'efi_early' becoming a global with external linkage, which under
-fPIC implies that references to it must go through the GOT. However,
dealing with this additional GOT entry turned out to be troublesome
on some EFI implementations. (GCC's visibility=hidden attribute is
supposed to lift this requirement, but it turned out not to work on
the 32-bit build.)
Instead, use a pure getter function to get a reference to efi_early.
This approach results in no additional GOT entries being generated,
so there is no need for any changes in the early GOT handling.
Tested-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Diffstat (limited to 'arch/x86/boot')
-rw-r--r-- | arch/x86/boot/compressed/Makefile | 3 | ||||
-rw-r--r-- | arch/x86/boot/compressed/eboot.c | 8 | ||||
-rw-r--r-- | arch/x86/boot/compressed/eboot.h | 16 |
3 files changed, 6 insertions, 21 deletions
diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile index 704f58aa79cd..20db5b3609de 100644 --- a/arch/x86/boot/compressed/Makefile +++ b/arch/x86/boot/compressed/Makefile | |||
@@ -35,7 +35,8 @@ vmlinux-objs-$(CONFIG_RANDOMIZE_BASE) += $(obj)/aslr.o | |||
35 | 35 | ||
36 | $(obj)/eboot.o: KBUILD_CFLAGS += -fshort-wchar -mno-red-zone | 36 | $(obj)/eboot.o: KBUILD_CFLAGS += -fshort-wchar -mno-red-zone |
37 | 37 | ||
38 | vmlinux-objs-$(CONFIG_EFI_STUB) += $(obj)/eboot.o $(obj)/efi_stub_$(BITS).o | 38 | vmlinux-objs-$(CONFIG_EFI_STUB) += $(obj)/eboot.o $(obj)/efi_stub_$(BITS).o \ |
39 | $(objtree)/drivers/firmware/efi/libstub/lib.a | ||
39 | 40 | ||
40 | $(obj)/vmlinux: $(vmlinux-objs-y) FORCE | 41 | $(obj)/vmlinux: $(vmlinux-objs-y) FORCE |
41 | $(call if_changed,ld) | 42 | $(call if_changed,ld) |
diff --git a/arch/x86/boot/compressed/eboot.c b/arch/x86/boot/compressed/eboot.c index 1acf605a646d..92b9a5f2aed6 100644 --- a/arch/x86/boot/compressed/eboot.c +++ b/arch/x86/boot/compressed/eboot.c | |||
@@ -21,8 +21,10 @@ static efi_system_table_t *sys_table; | |||
21 | 21 | ||
22 | static struct efi_config *efi_early; | 22 | static struct efi_config *efi_early; |
23 | 23 | ||
24 | #define efi_call_early(f, ...) \ | 24 | __pure const struct efi_config *__efi_early(void) |
25 | efi_early->call(efi_early->f, __VA_ARGS__); | 25 | { |
26 | return efi_early; | ||
27 | } | ||
26 | 28 | ||
27 | #define BOOT_SERVICES(bits) \ | 29 | #define BOOT_SERVICES(bits) \ |
28 | static void setup_boot_services##bits(struct efi_config *c) \ | 30 | static void setup_boot_services##bits(struct efi_config *c) \ |
@@ -285,8 +287,6 @@ void efi_char16_printk(efi_system_table_t *table, efi_char16_t *str) | |||
285 | } | 287 | } |
286 | } | 288 | } |
287 | 289 | ||
288 | #include "../../../../drivers/firmware/efi/libstub/efi-stub-helper.c" | ||
289 | |||
290 | static void find_bits(unsigned long mask, u8 *pos, u8 *size) | 290 | static void find_bits(unsigned long mask, u8 *pos, u8 *size) |
291 | { | 291 | { |
292 | u8 first, len; | 292 | u8 first, len; |
diff --git a/arch/x86/boot/compressed/eboot.h b/arch/x86/boot/compressed/eboot.h index c88c31ecad12..d487e727f1ec 100644 --- a/arch/x86/boot/compressed/eboot.h +++ b/arch/x86/boot/compressed/eboot.h | |||
@@ -103,20 +103,4 @@ struct efi_uga_draw_protocol { | |||
103 | void *blt; | 103 | void *blt; |
104 | }; | 104 | }; |
105 | 105 | ||
106 | struct efi_config { | ||
107 | u64 image_handle; | ||
108 | u64 table; | ||
109 | u64 allocate_pool; | ||
110 | u64 allocate_pages; | ||
111 | u64 get_memory_map; | ||
112 | u64 free_pool; | ||
113 | u64 free_pages; | ||
114 | u64 locate_handle; | ||
115 | u64 handle_protocol; | ||
116 | u64 exit_boot_services; | ||
117 | u64 text_output; | ||
118 | efi_status_t (*call)(unsigned long, ...); | ||
119 | bool is64; | ||
120 | } __packed; | ||
121 | |||
122 | #endif /* BOOT_COMPRESSED_EBOOT_H */ | 106 | #endif /* BOOT_COMPRESSED_EBOOT_H */ |