Commit ab42fad0 authored by Nicolas Pitre's avatar Nicolas Pitre

ARM: linker script: factor out stuff for the DISCARD section

Move common entries to vmlinux.lds.h and leave XIP and non-XIP entries
in their respective file. The ARM_NOMMU_KEEP() and ARM_NOMMU_DISCARD()
macros are added to be usable within the definition of ARM_DISCARD macro.
Signed-off-by: default avatarNicolas Pitre <nico@linaro.org>
Tested-by: default avatarChris Brandt <Chris.Brandt@renesas.com>
parent 2f181e0b
...@@ -38,20 +38,9 @@ SECTIONS ...@@ -38,20 +38,9 @@ SECTIONS
* unwind sections get included. * unwind sections get included.
*/ */
/DISCARD/ : { /DISCARD/ : {
*(.ARM.exidx.exit.text) ARM_DISCARD
*(.ARM.extab.exit.text)
ARM_CPU_DISCARD(*(.ARM.exidx.cpuexit.text))
ARM_CPU_DISCARD(*(.ARM.extab.cpuexit.text))
ARM_EXIT_DISCARD(EXIT_TEXT)
ARM_EXIT_DISCARD(EXIT_DATA)
EXIT_CALL
#ifndef CONFIG_MMU
*(.text.fixup)
*(__ex_table)
#endif
*(.alt.smp.init) *(.alt.smp.init)
*(.discard) *(.pv_table)
*(.discard.*)
} }
. = XIP_VIRT_ADDR(CONFIG_XIP_PHYS_ADDR); . = XIP_VIRT_ADDR(CONFIG_XIP_PHYS_ADDR);
...@@ -89,9 +78,7 @@ SECTIONS ...@@ -89,9 +78,7 @@ SECTIONS
. = ALIGN(4); . = ALIGN(4);
__ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) { __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) {
__start___ex_table = .; __start___ex_table = .;
#ifdef CONFIG_MMU ARM_MMU_KEEP(*(__ex_table))
*(__ex_table)
#endif
__stop___ex_table = .; __stop___ex_table = .;
} }
......
...@@ -38,22 +38,10 @@ SECTIONS ...@@ -38,22 +38,10 @@ SECTIONS
* unwind sections get included. * unwind sections get included.
*/ */
/DISCARD/ : { /DISCARD/ : {
*(.ARM.exidx.exit.text) ARM_DISCARD
*(.ARM.extab.exit.text)
ARM_CPU_DISCARD(*(.ARM.exidx.cpuexit.text))
ARM_CPU_DISCARD(*(.ARM.extab.cpuexit.text))
ARM_EXIT_DISCARD(EXIT_TEXT)
ARM_EXIT_DISCARD(EXIT_DATA)
EXIT_CALL
#ifndef CONFIG_MMU
*(.text.fixup)
*(__ex_table)
#endif
#ifndef CONFIG_SMP_ON_UP #ifndef CONFIG_SMP_ON_UP
*(.alt.smp.init) *(.alt.smp.init)
#endif #endif
*(.discard)
*(.discard.*)
} }
. = PAGE_OFFSET + TEXT_OFFSET; . = PAGE_OFFSET + TEXT_OFFSET;
...@@ -98,9 +86,7 @@ SECTIONS ...@@ -98,9 +86,7 @@ SECTIONS
. = ALIGN(4); . = ALIGN(4);
__ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) { __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) {
__start___ex_table = .; __start___ex_table = .;
#ifdef CONFIG_MMU ARM_MMU_KEEP(*(__ex_table))
*(__ex_table)
#endif
__stop___ex_table = .; __stop___ex_table = .;
} }
......
...@@ -17,6 +17,14 @@ ...@@ -17,6 +17,14 @@
#define ARM_EXIT_DISCARD(x) x #define ARM_EXIT_DISCARD(x) x
#endif #endif
#ifdef CONFIG_MMU
#define ARM_MMU_KEEP(x) x
#define ARM_MMU_DISCARD(x)
#else
#define ARM_MMU_KEEP(x)
#define ARM_MMU_DISCARD(x) x
#endif
#define PROC_INFO \ #define PROC_INFO \
. = ALIGN(4); \ . = ALIGN(4); \
VMLINUX_SYMBOL(__proc_info_begin) = .; \ VMLINUX_SYMBOL(__proc_info_begin) = .; \
...@@ -38,3 +46,15 @@ ...@@ -38,3 +46,15 @@
*(.hyp.idmap.text) \ *(.hyp.idmap.text) \
VMLINUX_SYMBOL(__hyp_idmap_text_end) = .; VMLINUX_SYMBOL(__hyp_idmap_text_end) = .;
#define ARM_DISCARD \
*(.ARM.exidx.exit.text) \
*(.ARM.extab.exit.text) \
ARM_CPU_DISCARD(*(.ARM.exidx.cpuexit.text)) \
ARM_CPU_DISCARD(*(.ARM.extab.cpuexit.text)) \
ARM_EXIT_DISCARD(EXIT_TEXT) \
ARM_EXIT_DISCARD(EXIT_DATA) \
EXIT_CALL \
ARM_MMU_DISCARD(*(.text.fixup)) \
ARM_MMU_DISCARD(*(__ex_table)) \
*(.discard) \
*(.discard.*)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment