linux/drivers/firmware/efi
Ard Biesheuvel b0dddf6c14 efi/arm: Fix absolute relocation detection for older toolchains
When building the ARM kernel with CONFIG_EFI=y, the following build
error may occur when using a less recent version of binutils (2.23 or
older):

   STUBCPY drivers/firmware/efi/libstub/lib-sort.stub.o
 00000000 R_ARM_ABS32       sort
 00000004 R_ARM_ABS32       __ksymtab_strings
 drivers/firmware/efi/libstub/lib-sort.stub.o: absolute symbol references not allowed in the EFI stub

(and when building with debug symbols, the list above is much longer, and
contains all the internal references between the .debug sections and the
actual code)

This issue is caused by the fact that objcopy v2.23 or earlier does not
support wildcards in its -R and -j options, which means the following
line from the Makefile:

  STUBCOPY_FLAGS-y		:= -R .debug* -R *ksymtab* -R *kcrctab*

fails to take effect, leaving harmless absolute relocations in the binary
that are indistinguishable from relocations that may cause crashes at
runtime due to the fact that these relocations are resolved at link time
using the virtual address of the kernel, which is always different from
the address at which the EFI firmware loads and invokes the stub.

So, as a workaround, disable debug symbols explicitly when building the
stub for ARM, and strip the ksymtab and kcrctab symbols for the only
exported symbol we currently reuse in the stub, which is 'sort'.

Tested-by: Jon Hunter <jonathanh@nvidia.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Matt Fleming <matt@codeblueprint.co.uk>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-efi@vger.kernel.org
Link: http://lkml.kernel.org/r/1476805991-7160-2-git-send-email-ard.biesheuvel@linaro.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2016-10-19 14:49:44 +02:00
..
libstub efi/arm: Fix absolute relocation detection for older toolchains 2016-10-19 14:49:44 +02:00
test efi: Add efi_test driver for exporting UEFI runtime service interfaces 2016-09-09 16:08:53 +01:00
arm-init.c efi/arm64: Treat regions with WT/WC set but WB cleared as memory 2016-09-09 16:08:54 +01:00
arm-runtime.c efi/arm64: Add debugfs node to dump UEFI runtime page tables 2016-09-09 16:08:51 +01:00
capsule-loader.c efi/capsule: Allocate whole capsule into virtual memory 2016-08-11 13:55:36 +02:00
capsule.c efi/capsule: Allocate whole capsule into virtual memory 2016-08-11 13:55:36 +02:00
cper.c efi: Handle memory error structures produced based on old versions of standard 2015-07-15 13:30:38 +01:00
efi-pstore.c Fix bug in module unloading. 2016-10-06 15:16:16 -07:00
efi.c * Refactor the EFI memory map code into architecture neutral files 2016-09-13 20:21:55 +02:00
efibc.c efibc: Report more information in the error messages 2016-06-27 13:06:54 +02:00
efivars.c efi: Don't use spinlocks for efi vars 2016-09-09 16:08:42 +01:00
esrt.c efi/esrt: Use memremap not ioremap to access ESRT table in memory 2016-09-09 16:08:39 +01:00
fake_mem.c efi: Add efi_memmap_install() for installing new EFI memory maps 2016-09-09 16:07:47 +01:00
Kconfig efi: Add efi_test driver for exporting UEFI runtime service interfaces 2016-09-09 16:08:53 +01:00
Makefile efi: Add efi_test driver for exporting UEFI runtime service interfaces 2016-09-09 16:08:53 +01:00
memattr.c efi: Implement generic support for the Memory Attributes table 2016-04-28 11:33:54 +02:00
memmap.c x86/efi: Round EFI memmap reservations to EFI_PAGE_SIZE 2016-09-20 15:43:31 +01:00
reboot.c efi: Add 'capsule' update support 2016-04-28 11:34:03 +02:00
runtime-map.c efi/runtime-map: Use efi.memmap directly instead of a copy 2016-09-09 16:08:36 +01:00
runtime-wrappers.c efi: Replace runtime services spinlock with semaphore 2016-09-09 16:08:43 +01:00
vars.c efi: Don't use spinlocks for efi vars 2016-09-09 16:08:42 +01:00