ARM: linker script: factor out some common definitions between XIP and non-XIP
authorNicolas Pitre <nicolas.pitre@linaro.org>
Wed, 28 Feb 2018 03:39:27 +0000 (22:39 -0500)
committerNicolas Pitre <nicolas.pitre@linaro.org>
Sat, 10 Mar 2018 01:19:01 +0000 (20:19 -0500)
Lots of duplications between vmlinux.lds.S and vmlinux-xip.lds.S.
This may lead to one file being updated but not the other. For example,
SOFTIRQENTRY_TEXT and HYPERVISOR_TEXT were missing from the XIP version.

This creates vmlinux.lds.h where a bunch of common defines are moved.

Signed-off-by: Nicolas Pitre <nico@linaro.org>
Tested-by: Chris Brandt <Chris.Brandt@renesas.com>
arch/arm/kernel/vmlinux-xip.lds.S
arch/arm/kernel/vmlinux.lds.S
arch/arm/kernel/vmlinux.lds.h [new file with mode: 0644]

index 12b87591eb7ce2c267ec9d9065366d795af61460..0a8922b6161301d8fad34e545f2e4d32356fc7d1 100644 (file)
 #include <asm/memory.h>
 #include <asm/page.h>
 
-#define PROC_INFO                                                      \
-       . = ALIGN(4);                                                   \
-       VMLINUX_SYMBOL(__proc_info_begin) = .;                          \
-       *(.proc.info.init)                                              \
-       VMLINUX_SYMBOL(__proc_info_end) = .;
-
-#define IDMAP_TEXT                                                     \
-       ALIGN_FUNCTION();                                               \
-       VMLINUX_SYMBOL(__idmap_text_start) = .;                         \
-       *(.idmap.text)                                                  \
-       VMLINUX_SYMBOL(__idmap_text_end) = .;                           \
-       . = ALIGN(PAGE_SIZE);                                           \
-       VMLINUX_SYMBOL(__hyp_idmap_text_start) = .;                     \
-       *(.hyp.idmap.text)                                              \
-       VMLINUX_SYMBOL(__hyp_idmap_text_end) = .;
-
-#ifdef CONFIG_HOTPLUG_CPU
-#define ARM_CPU_DISCARD(x)
-#define ARM_CPU_KEEP(x)                x
-#else
-#define ARM_CPU_DISCARD(x)     x
-#define ARM_CPU_KEEP(x)
-#endif
-
-#if (defined(CONFIG_SMP_ON_UP) && !defined(CONFIG_DEBUG_SPINLOCK)) || \
-       defined(CONFIG_GENERIC_BUG)
-#define ARM_EXIT_KEEP(x)       x
-#define ARM_EXIT_DISCARD(x)
-#else
-#define ARM_EXIT_KEEP(x)
-#define ARM_EXIT_DISCARD(x)    x
-#endif
+#include "vmlinux.lds.h"
 
 OUTPUT_ARCH(arm)
 ENTRY(stext)
@@ -100,10 +69,12 @@ SECTIONS
                        *(.entry.text)
                        __entry_text_end = .;
                        IRQENTRY_TEXT
+                       SOFTIRQENTRY_TEXT
                        TEXT_TEXT
                        SCHED_TEXT
                        CPUIDLE_TEXT
                        LOCK_TEXT
+                       HYPERVISOR_TEXT
                        KPROBES_TEXT
                        *(.gnu.warning)
                        *(.glue_7)
index 84a1ae3ce46e24ad19d2003a9e339c18644a3f0b..6a6eb483d92c007069da7bb96cb1dd27a8a1f6f0 100644 (file)
 #include <asm/page.h>
 #include <asm/pgtable.h>
 
-#define PROC_INFO                                                      \
-       . = ALIGN(4);                                                   \
-       VMLINUX_SYMBOL(__proc_info_begin) = .;                          \
-       *(.proc.info.init)                                              \
-       VMLINUX_SYMBOL(__proc_info_end) = .;
-
-#define HYPERVISOR_TEXT                                                        \
-       VMLINUX_SYMBOL(__hyp_text_start) = .;                           \
-       *(.hyp.text)                                                    \
-       VMLINUX_SYMBOL(__hyp_text_end) = .;
-
-#define IDMAP_TEXT                                                     \
-       ALIGN_FUNCTION();                                               \
-       VMLINUX_SYMBOL(__idmap_text_start) = .;                         \
-       *(.idmap.text)                                                  \
-       VMLINUX_SYMBOL(__idmap_text_end) = .;                           \
-       . = ALIGN(PAGE_SIZE);                                           \
-       VMLINUX_SYMBOL(__hyp_idmap_text_start) = .;                     \
-       *(.hyp.idmap.text)                                              \
-       VMLINUX_SYMBOL(__hyp_idmap_text_end) = .;
-
-#ifdef CONFIG_HOTPLUG_CPU
-#define ARM_CPU_DISCARD(x)
-#define ARM_CPU_KEEP(x)                x
-#else
-#define ARM_CPU_DISCARD(x)     x
-#define ARM_CPU_KEEP(x)
-#endif
-
-#if (defined(CONFIG_SMP_ON_UP) && !defined(CONFIG_DEBUG_SPINLOCK)) || \
-       defined(CONFIG_GENERIC_BUG) || defined(CONFIG_JUMP_LABEL)
-#define ARM_EXIT_KEEP(x)       x
-#define ARM_EXIT_DISCARD(x)
-#else
-#define ARM_EXIT_KEEP(x)
-#define ARM_EXIT_DISCARD(x)    x
-#endif
+#include "vmlinux.lds.h"
 
 OUTPUT_ARCH(arm)
 ENTRY(stext)
diff --git a/arch/arm/kernel/vmlinux.lds.h b/arch/arm/kernel/vmlinux.lds.h
new file mode 100644 (file)
index 0000000..0a86e8a
--- /dev/null
@@ -0,0 +1,40 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+
+#ifdef CONFIG_HOTPLUG_CPU
+#define ARM_CPU_DISCARD(x)
+#define ARM_CPU_KEEP(x)                x
+#else
+#define ARM_CPU_DISCARD(x)     x
+#define ARM_CPU_KEEP(x)
+#endif
+
+#if (defined(CONFIG_SMP_ON_UP) && !defined(CONFIG_DEBUG_SPINLOCK)) || \
+       defined(CONFIG_GENERIC_BUG) || defined(CONFIG_JUMP_LABEL)
+#define ARM_EXIT_KEEP(x)       x
+#define ARM_EXIT_DISCARD(x)
+#else
+#define ARM_EXIT_KEEP(x)
+#define ARM_EXIT_DISCARD(x)    x
+#endif
+
+#define PROC_INFO                                                      \
+               . = ALIGN(4);                                           \
+               VMLINUX_SYMBOL(__proc_info_begin) = .;                  \
+               *(.proc.info.init)                                      \
+               VMLINUX_SYMBOL(__proc_info_end) = .;
+
+#define HYPERVISOR_TEXT                                                        \
+               VMLINUX_SYMBOL(__hyp_text_start) = .;                   \
+               *(.hyp.text)                                            \
+               VMLINUX_SYMBOL(__hyp_text_end) = .;
+
+#define IDMAP_TEXT                                                     \
+               ALIGN_FUNCTION();                                       \
+               VMLINUX_SYMBOL(__idmap_text_start) = .;                 \
+               *(.idmap.text)                                          \
+               VMLINUX_SYMBOL(__idmap_text_end) = .;                   \
+               . = ALIGN(PAGE_SIZE);                                   \
+               VMLINUX_SYMBOL(__hyp_idmap_text_start) = .;             \
+               *(.hyp.idmap.text)                                      \
+               VMLINUX_SYMBOL(__hyp_idmap_text_end) = .;
+