arm/build: Refactor linker script headers
authorKees Cook <keescook@chromium.org>
Fri, 21 Aug 2020 19:42:56 +0000 (12:42 -0700)
committerIngo Molnar <mingo@kernel.org>
Tue, 1 Sep 2020 08:03:17 +0000 (10:03 +0200)
In preparation for adding --orphan-handling=warn, refactor the linker
script header includes, and extract common macros.

Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: Russell King <linux@armlinux.org.uk>
Link: https://lore.kernel.org/r/20200821194310.3089815-16-keescook@chromium.org
arch/arm/include/asm/vmlinux.lds.h [moved from arch/arm/kernel/vmlinux.lds.h with 96% similarity]
arch/arm/kernel/vmlinux-xip.lds.S
arch/arm/kernel/vmlinux.lds.S

similarity index 96%
rename from arch/arm/kernel/vmlinux.lds.h
rename to arch/arm/include/asm/vmlinux.lds.h
index 381a8e1..a08f430 100644 (file)
@@ -1,4 +1,5 @@
 /* SPDX-License-Identifier: GPL-2.0 */
+#include <asm-generic/vmlinux.lds.h>
 
 #ifdef CONFIG_HOTPLUG_CPU
 #define ARM_CPU_DISCARD(x)
                EXIT_CALL                                               \
                ARM_MMU_DISCARD(*(.text.fixup))                         \
                ARM_MMU_DISCARD(*(__ex_table))                          \
-               *(.discard)                                             \
-               *(.discard.*)
+               COMMON_DISCARDS
+
+#define ARM_STUBS_TEXT                                                 \
+               *(.gnu.warning)                                         \
+               *(.glue_7)                                              \
+               *(.glue_7t)
 
 #define ARM_TEXT                                                       \
                IDMAP_TEXT                                              \
@@ -64,9 +69,7 @@
                CPUIDLE_TEXT                                            \
                LOCK_TEXT                                               \
                KPROBES_TEXT                                            \
-               *(.gnu.warning)                                         \
-               *(.glue_7)                                              \
-               *(.glue_7t)                                             \
+               ARM_STUBS_TEXT                                          \
                . = ALIGN(4);                                           \
                *(.got)                 /* Global offset table */       \
                ARM_CPU_KEEP(PROC_INFO)
index 3d4e88f..904c31f 100644 (file)
@@ -9,15 +9,13 @@
 
 #include <linux/sizes.h>
 
-#include <asm-generic/vmlinux.lds.h>
+#include <asm/vmlinux.lds.h>
 #include <asm/cache.h>
 #include <asm/thread_info.h>
 #include <asm/memory.h>
 #include <asm/mpu.h>
 #include <asm/page.h>
 
-#include "vmlinux.lds.h"
-
 OUTPUT_ARCH(arm)
 ENTRY(stext)
 
index 5592f14..bb950c8 100644 (file)
@@ -9,15 +9,13 @@
 #else
 
 #include <linux/pgtable.h>
-#include <asm-generic/vmlinux.lds.h>
+#include <asm/vmlinux.lds.h>
 #include <asm/cache.h>
 #include <asm/thread_info.h>
 #include <asm/memory.h>
 #include <asm/mpu.h>
 #include <asm/page.h>
 
-#include "vmlinux.lds.h"
-
 OUTPUT_ARCH(arm)
 ENTRY(stext)