Skip to content

Commit 3e66314

Browse files
committed
vmlinux.lds.h: Keep .ctors.* with .ctors
Under some circumstances, the compiler generates .ctors.* sections. This is seen doing a cross compile of x86_64 from a powerpc64el host: x86_64-linux-gnu-ld: warning: orphan section `.ctors.65435' from `kernel/trace/trace_clock.o' being placed in section `.ctors.65435' x86_64-linux-gnu-ld: warning: orphan section `.ctors.65435' from `kernel/trace/ftrace.o' being placed in section `.ctors.65435' x86_64-linux-gnu-ld: warning: orphan section `.ctors.65435' from `kernel/trace/ring_buffer.o' being placed in section `.ctors.65435' Include these orphans along with the regular .ctors section. Reported-by: Stephen Rothwell <sfr@canb.auug.org.au> Tested-by: Stephen Rothwell <sfr@canb.auug.org.au> Fixes: 83109d5 ("x86/build: Warn on orphan section placement") Signed-off-by: Kees Cook <keescook@chromium.org> Acked-by: Nick Desaulniers <ndesaulniers@google.com> Link: https://lore.kernel.org/r/20201005025720.2599682-1-keescook@chromium.org
1 parent 3650b22 commit 3e66314

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

include/asm-generic/vmlinux.lds.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -701,6 +701,7 @@
701701
#ifdef CONFIG_CONSTRUCTORS
702702
#define KERNEL_CTORS() . = ALIGN(8); \
703703
__ctors_start = .; \
704+
KEEP(*(SORT(.ctors.*))) \
704705
KEEP(*(.ctors)) \
705706
KEEP(*(SORT(.init_array.*))) \
706707
KEEP(*(.init_array)) \

0 commit comments

Comments
 (0)