summaryrefslogtreecommitdiffstats
path: root/arch/Kconfig
diff options
context:
space:
mode:
authorPeter Collingbourne <pcc@google.com>2019-07-31 21:18:42 -0400
committerWill Deacon <will@kernel.org>2019-08-05 07:35:35 -0400
commit5cf896fb6be3effd9aea455b22213e27be8bdb1d (patch)
tree563e83ed04a2de71b65e831896bf52e0eaf31af0 /arch/Kconfig
parent66cbdf5d0c96f5fe570b548e764583ea9d793077 (diff)
arm64: Add support for relocating the kernel with RELR relocations
RELR is a relocation packing format for relative relocations. The format is described in a generic-abi proposal: https://groups.google.com/d/topic/generic-abi/bX460iggiKg/discussion The LLD linker can be instructed to pack relocations in the RELR format by passing the flag --pack-dyn-relocs=relr. This patch adds a new config option, CONFIG_RELR. Enabling this option instructs the linker to pack vmlinux's relative relocations in the RELR format, and causes the kernel to apply the relocations at startup along with the RELA relocations. RELA relocations still need to be applied because the linker will emit RELA relative relocations if they are unrepresentable in the RELR format (i.e. address not a multiple of 2). Enabling CONFIG_RELR reduces the size of a defconfig kernel image with CONFIG_RANDOMIZE_BASE by 3.5MB/16% uncompressed, or 550KB/5% compressed (lz4). Signed-off-by: Peter Collingbourne <pcc@google.com> Tested-by: Nick Desaulniers <ndesaulniers@google.com> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com> Signed-off-by: Will Deacon <will@kernel.org>
Diffstat (limited to 'arch/Kconfig')
-rw-r--r--arch/Kconfig14
1 files changed, 14 insertions, 0 deletions
diff --git a/arch/Kconfig b/arch/Kconfig
index a7b57dd42c26..aa6bdb3df5c1 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -925,6 +925,20 @@ config LOCK_EVENT_COUNTS
925 the chance of application behavior change because of timing 925 the chance of application behavior change because of timing
926 differences. The counts are reported via debugfs. 926 differences. The counts are reported via debugfs.
927 927
928# Select if the architecture has support for applying RELR relocations.
929config ARCH_HAS_RELR
930 bool
931
932config RELR
933 bool "Use RELR relocation packing"
934 depends on ARCH_HAS_RELR && TOOLS_SUPPORT_RELR
935 default y
936 help
937 Store the kernel's dynamic relocations in the RELR relocation packing
938 format. Requires a compatible linker (LLD supports this feature), as
939 well as compatible NM and OBJCOPY utilities (llvm-nm and llvm-objcopy
940 are compatible).
941
928source "kernel/gcov/Kconfig" 942source "kernel/gcov/Kconfig"
929 943
930source "scripts/gcc-plugins/Kconfig" 944source "scripts/gcc-plugins/Kconfig"