Skip to content

Commit 5a17850

Browse files
keesIngo Molnar
authored andcommitted
arm/build: Warn on orphan section placement
We don't want to depend on the linker's orphan section placement heuristics as these can vary between linkers, and may change between versions. All sections need to be explicitly handled in the linker script. Specifically, this would have made a recently fixed bug very obvious: ld: warning: orphan section `.fixup' from `arch/arm/lib/copy_from_user.o' being placed in section `.fixup' With all sections handled, enable orphan section warning. Signed-off-by: Kees Cook <[email protected]> Signed-off-by: Ingo Molnar <[email protected]> Reviewed-by: Nick Desaulniers <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent b3e5d80 commit 5a17850

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

arch/arm/Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ LDFLAGS_vmlinux += --be8
1616
KBUILD_LDFLAGS_MODULE += --be8
1717
endif
1818

19+
# We never want expected sections to be placed heuristically by the
20+
# linker. All sections should be explicitly named in the linker script.
21+
LDFLAGS_vmlinux += $(call ld-option, --orphan-handling=warn)
22+
1923
ifeq ($(CONFIG_ARM_MODULE_PLTS),y)
2024
KBUILD_LDS_MODULE += $(srctree)/arch/arm/kernel/module.lds
2125
endif

0 commit comments

Comments
 (0)