Skip to content

Commit 2f181e0

Browse files
author
Nicolas Pitre
committed
ARM: linker script: factor out some common definitions between XIP and non-XIP
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>
1 parent 91ab883 commit 2f181e0

3 files changed

Lines changed: 44 additions & 69 deletions

File tree

‎arch/arm/kernel/vmlinux-xip.lds.S‎

Lines changed: 3 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -15,38 +15,7 @@
1515
#include <asm/memory.h>
1616
#include <asm/page.h>
1717

18-
#define PROC_INFO \
19-
. = ALIGN(4); \
20-
VMLINUX_SYMBOL(__proc_info_begin) = .; \
21-
*(.proc.info.init) \
22-
VMLINUX_SYMBOL(__proc_info_end) = .;
23-
24-
#define IDMAP_TEXT \
25-
ALIGN_FUNCTION(); \
26-
VMLINUX_SYMBOL(__idmap_text_start) = .; \
27-
*(.idmap.text) \
28-
VMLINUX_SYMBOL(__idmap_text_end) = .; \
29-
. = ALIGN(PAGE_SIZE); \
30-
VMLINUX_SYMBOL(__hyp_idmap_text_start) = .; \
31-
*(.hyp.idmap.text) \
32-
VMLINUX_SYMBOL(__hyp_idmap_text_end) = .;
33-
34-
#ifdef CONFIG_HOTPLUG_CPU
35-
#define ARM_CPU_DISCARD(x)
36-
#define ARM_CPU_KEEP(x) x
37-
#else
38-
#define ARM_CPU_DISCARD(x) x
39-
#define ARM_CPU_KEEP(x)
40-
#endif
41-
42-
#if (defined(CONFIG_SMP_ON_UP) && !defined(CONFIG_DEBUG_SPINLOCK)) || \
43-
defined(CONFIG_GENERIC_BUG)
44-
#define ARM_EXIT_KEEP(x) x
45-
#define ARM_EXIT_DISCARD(x)
46-
#else
47-
#define ARM_EXIT_KEEP(x)
48-
#define ARM_EXIT_DISCARD(x) x
49-
#endif
18+
#include "vmlinux.lds.h"
5019

5120
OUTPUT_ARCH(arm)
5221
ENTRY(stext)
@@ -100,10 +69,12 @@ SECTIONS
10069
*(.entry.text)
10170
__entry_text_end = .;
10271
IRQENTRY_TEXT
72+
SOFTIRQENTRY_TEXT
10373
TEXT_TEXT
10474
SCHED_TEXT
10575
CPUIDLE_TEXT
10676
LOCK_TEXT
77+
HYPERVISOR_TEXT
10778
KPROBES_TEXT
10879
*(.gnu.warning)
10980
*(.glue_7)

‎arch/arm/kernel/vmlinux.lds.S‎

Lines changed: 1 addition & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -15,43 +15,7 @@
1515
#include <asm/page.h>
1616
#include <asm/pgtable.h>
1717

18-
#define PROC_INFO \
19-
. = ALIGN(4); \
20-
VMLINUX_SYMBOL(__proc_info_begin) = .; \
21-
*(.proc.info.init) \
22-
VMLINUX_SYMBOL(__proc_info_end) = .;
23-
24-
#define HYPERVISOR_TEXT \
25-
VMLINUX_SYMBOL(__hyp_text_start) = .; \
26-
*(.hyp.text) \
27-
VMLINUX_SYMBOL(__hyp_text_end) = .;
28-
29-
#define IDMAP_TEXT \
30-
ALIGN_FUNCTION(); \
31-
VMLINUX_SYMBOL(__idmap_text_start) = .; \
32-
*(.idmap.text) \
33-
VMLINUX_SYMBOL(__idmap_text_end) = .; \
34-
. = ALIGN(PAGE_SIZE); \
35-
VMLINUX_SYMBOL(__hyp_idmap_text_start) = .; \
36-
*(.hyp.idmap.text) \
37-
VMLINUX_SYMBOL(__hyp_idmap_text_end) = .;
38-
39-
#ifdef CONFIG_HOTPLUG_CPU
40-
#define ARM_CPU_DISCARD(x)
41-
#define ARM_CPU_KEEP(x) x
42-
#else
43-
#define ARM_CPU_DISCARD(x) x
44-
#define ARM_CPU_KEEP(x)
45-
#endif
46-
47-
#if (defined(CONFIG_SMP_ON_UP) && !defined(CONFIG_DEBUG_SPINLOCK)) || \
48-
defined(CONFIG_GENERIC_BUG) || defined(CONFIG_JUMP_LABEL)
49-
#define ARM_EXIT_KEEP(x) x
50-
#define ARM_EXIT_DISCARD(x)
51-
#else
52-
#define ARM_EXIT_KEEP(x)
53-
#define ARM_EXIT_DISCARD(x) x
54-
#endif
18+
#include "vmlinux.lds.h"
5519

5620
OUTPUT_ARCH(arm)
5721
ENTRY(stext)

‎arch/arm/kernel/vmlinux.lds.h‎

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/* SPDX-License-Identifier: GPL-2.0 */
2+
3+
#ifdef CONFIG_HOTPLUG_CPU
4+
#define ARM_CPU_DISCARD(x)
5+
#define ARM_CPU_KEEP(x) x
6+
#else
7+
#define ARM_CPU_DISCARD(x) x
8+
#define ARM_CPU_KEEP(x)
9+
#endif
10+
11+
#if (defined(CONFIG_SMP_ON_UP) && !defined(CONFIG_DEBUG_SPINLOCK)) || \
12+
defined(CONFIG_GENERIC_BUG) || defined(CONFIG_JUMP_LABEL)
13+
#define ARM_EXIT_KEEP(x) x
14+
#define ARM_EXIT_DISCARD(x)
15+
#else
16+
#define ARM_EXIT_KEEP(x)
17+
#define ARM_EXIT_DISCARD(x) x
18+
#endif
19+
20+
#define PROC_INFO \
21+
. = ALIGN(4); \
22+
VMLINUX_SYMBOL(__proc_info_begin) = .; \
23+
*(.proc.info.init) \
24+
VMLINUX_SYMBOL(__proc_info_end) = .;
25+
26+
#define HYPERVISOR_TEXT \
27+
VMLINUX_SYMBOL(__hyp_text_start) = .; \
28+
*(.hyp.text) \
29+
VMLINUX_SYMBOL(__hyp_text_end) = .;
30+
31+
#define IDMAP_TEXT \
32+
ALIGN_FUNCTION(); \
33+
VMLINUX_SYMBOL(__idmap_text_start) = .; \
34+
*(.idmap.text) \
35+
VMLINUX_SYMBOL(__idmap_text_end) = .; \
36+
. = ALIGN(PAGE_SIZE); \
37+
VMLINUX_SYMBOL(__hyp_idmap_text_start) = .; \
38+
*(.hyp.idmap.text) \
39+
VMLINUX_SYMBOL(__hyp_idmap_text_end) = .;
40+

0 commit comments

Comments
 (0)