summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2019-10-02 16:29:25 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2019-10-14 12:09:50 +0200
commitc5d38e92010174f58d733274430ee91f340553b5 (patch)
tree0292e40df43b2e59bd910c11ae68227a79b3d5f8
parent1bb55ab2d12ebf9be0f9999c3865a658ba928a9e (diff)
downloadbarebox-c5d38e92010174f58d733274430ee91f340553b5.tar.gz
lds: Add and use RO_DATA_SECTION macro
We have many different pointer arrays which we put into linker sections and each time there's one added we have to adjust all linker scripts. This adds a common RO_DATA_SECTION define and uses it for all architectures. This makes it easier to add a new linker array. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--arch/arm/lib32/barebox.lds.S14
-rw-r--r--arch/arm/lib64/barebox.lds.S16
-rw-r--r--arch/mips/lib/barebox.lds.S16
-rw-r--r--arch/nios2/cpu/barebox.lds.S12
-rw-r--r--arch/openrisc/cpu/barebox.lds.S11
-rw-r--r--arch/ppc/boards/pcm030/barebox.lds.S9
-rw-r--r--arch/ppc/mach-mpc85xx/barebox.lds.S8
-rw-r--r--arch/riscv/lib/barebox.lds.S12
-rw-r--r--arch/sandbox/board/barebox.lds.S8
-rw-r--r--arch/x86/lib/barebox.lds.S31
-rw-r--r--arch/x86/mach-efi/elf_ia32_efi.lds.S9
-rw-r--r--arch/x86/mach-efi/elf_x86_64_efi.lds.S9
-rw-r--r--include/asm-generic/barebox.lds.h11
13 files changed, 40 insertions, 126 deletions
diff --git a/arch/arm/lib32/barebox.lds.S b/arch/arm/lib32/barebox.lds.S
index 3a19d8f..c479e02 100644
--- a/arch/arm/lib32/barebox.lds.S
+++ b/arch/arm/lib32/barebox.lds.S
@@ -55,7 +55,10 @@ SECTIONS
BAREBOX_BARE_INIT_SIZE
. = ALIGN(4);
- .rodata : { *(.rodata*) }
+ .rodata : {
+ *(.rodata*)
+ RO_DATA_SECTION
+ }
#ifdef CONFIG_ARM_UNWIND
/*
@@ -82,15 +85,6 @@ SECTIONS
.barebox_imd : { BAREBOX_IMD }
. = .;
- .barebox_cmd : { BAREBOX_CMDS }
- .barebox_ratp_cmd : { BAREBOX_RATP_CMDS }
- .barebox_magicvar : { BAREBOX_MAGICVARS }
- .barebox_initcalls : { BAREBOX_INITCALLS }
- .barebox_exitcalls : { BAREBOX_EXITCALLS }
- __usymtab : { BAREBOX_SYMS }
- .pci_fixup : { BAREBOX_PCI_FIXUP }
- .oftables : { BAREBOX_CLK_TABLE }
- .dtb : { BAREBOX_DTB }
.rel_dyn_start : { *(.__rel_dyn_start) }
.rel.dyn : { *(.rel*) }
diff --git a/arch/arm/lib64/barebox.lds.S b/arch/arm/lib64/barebox.lds.S
index 3ad9d5f..cf6ef18 100644
--- a/arch/arm/lib64/barebox.lds.S
+++ b/arch/arm/lib64/barebox.lds.S
@@ -53,7 +53,10 @@ SECTIONS
BAREBOX_BARE_INIT_SIZE
. = ALIGN(4);
- .rodata : { *(.rodata*) }
+ .rodata : {
+ *(.rodata*)
+ RO_DATA_SECTION
+ }
_etext = .; /* End of text and rodata section */
_sdata = .;
@@ -63,17 +66,6 @@ SECTIONS
.barebox_imd : { BAREBOX_IMD }
- . = .;
- .barebox_cmd : { BAREBOX_CMDS }
- .barebox_ratp_cmd : { BAREBOX_RATP_CMDS }
- .barebox_magicvar : { BAREBOX_MAGICVARS }
- .barebox_initcalls : { BAREBOX_INITCALLS }
- .barebox_exitcalls : { BAREBOX_EXITCALLS }
- __usymtab : { BAREBOX_SYMS }
- .pci_fixup : { BAREBOX_PCI_FIXUP }
- .oftables : { BAREBOX_CLK_TABLE }
- .dtb : { BAREBOX_DTB }
-
.rel_dyn_start : { *(.__rel_dyn_start) }
.rela.dyn : { *(.rela*) }
.rel_dyn_end : { *(.__rel_dyn_end) }
diff --git a/arch/mips/lib/barebox.lds.S b/arch/mips/lib/barebox.lds.S
index f9a0b44..e96c3bf 100644
--- a/arch/mips/lib/barebox.lds.S
+++ b/arch/mips/lib/barebox.lds.S
@@ -30,7 +30,10 @@ SECTIONS
PRE_IMAGE
. = ALIGN(4);
- .rodata : { *(.rodata*) }
+ .rodata : {
+ *(.rodata*)
+ RO_DATA_SECTION
+ }
_etext = .; /* End of text and rodata section */
_sdata = .;
@@ -40,17 +43,6 @@ SECTIONS
.barebox_imd : { BAREBOX_IMD }
- . = .;
- .barebox_cmd : { BAREBOX_CMDS }
- .barebox_ratp_cmd : { BAREBOX_RATP_CMDS }
- .barebox_magicvar : { BAREBOX_MAGICVARS }
- .barebox_initcalls : { BAREBOX_INITCALLS }
- .barebox_exitcalls : { BAREBOX_EXITCALLS }
- __usymtab : { BAREBOX_SYMS }
- .pci_fixup : { BAREBOX_PCI_FIXUP }
- .oftables : { BAREBOX_CLK_TABLE }
- .dtb : { BAREBOX_DTB }
-
_edata = .;
.image_end : { *(.__image_end) }
diff --git a/arch/nios2/cpu/barebox.lds.S b/arch/nios2/cpu/barebox.lds.S
index efe8e10..8d82aa5 100644
--- a/arch/nios2/cpu/barebox.lds.S
+++ b/arch/nios2/cpu/barebox.lds.S
@@ -48,15 +48,11 @@ SECTIONS
BAREBOX_BARE_INIT_SIZE
. = ALIGN(4);
- .rodata : { *(.rodata) }
- . = .;
- .barebox_cmd : { BAREBOX_CMDS }
- .barebox_ratp_cmd : { BAREBOX_RATP_CMDS }
- .barebox_magicvar : { BAREBOX_MAGICVARS }
- .barebox_initcalls : { BAREBOX_INITCALLS }
- .barebox_exitcalls : { BAREBOX_EXITCALLS }
- __usymtab : { BAREBOX_SYMS }
+ .rodata : {
+ *(.rodata*)
+ RO_DATA_SECTION
+ }
_etext = .; /* End of text and rodata section */
diff --git a/arch/openrisc/cpu/barebox.lds.S b/arch/openrisc/cpu/barebox.lds.S
index 37242f9..adb0c22 100644
--- a/arch/openrisc/cpu/barebox.lds.S
+++ b/arch/openrisc/cpu/barebox.lds.S
@@ -49,18 +49,9 @@ SECTIONS
*(.rodata);
*(.rodata.*)
*(.bbenv.rodata.*)
+ RO_DATA_SECTION
} > ram
- . = ALIGN(4);
- . = .;
- .barebox_cmd : { BAREBOX_CMDS } > ram
- .barebox_ratp_cmd : { BAREBOX_RATP_CMDS } > ram
- .barebox_magicvar : { BAREBOX_MAGICVARS } > ram
- .barebox_initcalls : { BAREBOX_INITCALLS } > ram
- .barebox_exitcalls : { BAREBOX_EXITCALLS } > ram
- __usymtab : { BAREBOX_SYMS } > ram
- .dtb : { BAREBOX_DTB } > ram
-
__etext = .; /* End of text and rodata section */
. = ALIGN(4);
diff --git a/arch/ppc/boards/pcm030/barebox.lds.S b/arch/ppc/boards/pcm030/barebox.lds.S
index 73e4bde..6c91ed6 100644
--- a/arch/ppc/boards/pcm030/barebox.lds.S
+++ b/arch/ppc/boards/pcm030/barebox.lds.S
@@ -38,6 +38,7 @@ SECTIONS
*(.rodata*)
*(.rodata1*)
*(.rodata.str1.4)
+ RO_DATA_SECTION
}
/* Read-only sections, merged into text segment: */
@@ -99,14 +100,6 @@ SECTIONS
_edata = .;
PROVIDE (edata = .);
- . = .;
- .barebox_cmd : { BAREBOX_CMDS }
- .barebox_ratp_cmd : { BAREBOX_RATP_CMDS }
- .barebox_magicvar : { BAREBOX_MAGICVARS }
- .barebox_initcalls : { BAREBOX_INITCALLS }
- .barebox_exitcalls : { BAREBOX_EXITCALLS }
- __usymtab : { BAREBOX_SYMS }
-
__start___ex_table = .;
__ex_table : { *(__ex_table) }
__stop___ex_table = .;
diff --git a/arch/ppc/mach-mpc85xx/barebox.lds.S b/arch/ppc/mach-mpc85xx/barebox.lds.S
index 1874319..a09a01e 100644
--- a/arch/ppc/mach-mpc85xx/barebox.lds.S
+++ b/arch/ppc/mach-mpc85xx/barebox.lds.S
@@ -71,6 +71,7 @@ SECTIONS
.rodata :
{
*(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*)))
+ RO_DATA_SECTION
} :text
/* Read-write section, merged into data segment: */
@@ -101,13 +102,6 @@ SECTIONS
}
. = .;
- .barebox_cmd : { BAREBOX_CMDS }
- .barebox_ratp_cmd : { BAREBOX_RATP_CMDS }
- .barebox_initcalls : { BAREBOX_INITCALLS }
- .barebox_exitcalls : { BAREBOX_EXITCALLS }
- __usymtab : { BAREBOX_SYMS }
-
- . = .;
__start___ex_table = .;
__ex_table : { *(__ex_table) }
__stop___ex_table = .;
diff --git a/arch/riscv/lib/barebox.lds.S b/arch/riscv/lib/barebox.lds.S
index 23e4468..5149f8c 100644
--- a/arch/riscv/lib/barebox.lds.S
+++ b/arch/riscv/lib/barebox.lds.S
@@ -30,7 +30,10 @@ SECTIONS
}
. = ALIGN(8);
- .rodata : { *(.rodata*) }
+ .rodata : {
+ *(.rodata*)
+ RO_DATA_SECTION
+ }
_etext = .; /* End of text and rodata section */
_sdata = .;
@@ -43,13 +46,6 @@ SECTIONS
. = ALIGN(8);
.got : { *(.got*) }
- . = .;
- .barebox_cmd : { BAREBOX_CMDS }
- .barebox_magicvar : { BAREBOX_MAGICVARS }
- .barebox_initcalls : { BAREBOX_INITCALLS }
- .barebox_exitcalls : { BAREBOX_EXITCALLS }
- __usymtab : { BAREBOX_SYMS }
-
.rela.dyn : { *(.rela*) }
.oftables : { BAREBOX_CLK_TABLE }
diff --git a/arch/sandbox/board/barebox.lds.S b/arch/sandbox/board/barebox.lds.S
index 862376d..7a5a8eb 100644
--- a/arch/sandbox/board/barebox.lds.S
+++ b/arch/sandbox/board/barebox.lds.S
@@ -3,11 +3,9 @@
SECTIONS
{
. = ALIGN(64);
- .barebox_initcalls : { BAREBOX_INITCALLS }
- .barebox_exitcalls : { BAREBOX_EXITCALLS }
- .barebox_magicvar : { BAREBOX_MAGICVARS }
- __barebox_cmd : { BAREBOX_CMDS }
- __barebox_ratp_cmd : { BAREBOX_RATP_CMDS }
+ .barebox_rodata : {
+ RO_DATA_SECTION
+ }
}
INSERT BEFORE .rodata;
diff --git a/arch/x86/lib/barebox.lds.S b/arch/x86/lib/barebox.lds.S
index d26f060..7125164 100644
--- a/arch/x86/lib/barebox.lds.S
+++ b/arch/x86/lib/barebox.lds.S
@@ -133,6 +133,7 @@ SECTIONS
*(.boot.rodata*)
*(.boot.data*)
. = ALIGN(4);
+ RO_DATA_SECTION
} > barebox
#endif
@@ -164,36 +165,6 @@ SECTIONS
. = ALIGN(4);
} > barebox
- .barebox_cmd : AT ( LOADADDR(.got) + SIZEOF (.got) ) {
- BAREBOX_CMDS
- . = ALIGN(4);
- } > barebox
-
- .barebox_ratp_cmd : AT ( LOADADDR(.got) + SIZEOF (.got) ) {
- BAREBOX_RATP_CMDS
- . = ALIGN(4);
- } > barebox
-
- .barebox_magicvars : AT ( LOADADDR(.barebox_cmd) + SIZEOF (.barebox_cmd) ) {
- BAREBOX_MAGICVARS
- . = ALIGN(4);
- } > barebox
-
- .barebox_initcalls : AT ( LOADADDR(.barebox_magicvars) + SIZEOF (.barebox_magicvars) ) {
- BAREBOX_INITCALLS
- . = ALIGN(4);
- } > barebox
-
- .barebox_exitcalls : AT ( LOADADDR(.barebox_initcalls) + SIZEOF (.barebox_initcalls) ) {
- BAREBOX_EXITCALLS
- . = ALIGN(4);
- } > barebox
-
- .__usymtab : AT ( LOADADDR(.barebox_exitcalls) + SIZEOF (.barebox_exitcalls) ) {
- BAREBOX_SYMS
- . = ALIGN(4);
- } > barebox
-
_edata = .;
.bss : {
__bss_start = .;
diff --git a/arch/x86/mach-efi/elf_ia32_efi.lds.S b/arch/x86/mach-efi/elf_ia32_efi.lds.S
index 70d34f4..18ddf17 100644
--- a/arch/x86/mach-efi/elf_ia32_efi.lds.S
+++ b/arch/x86/mach-efi/elf_ia32_efi.lds.S
@@ -35,6 +35,7 @@ SECTIONS
.data : {
*(.rodata*)
+ RO_DATA_SECTION
*(.data)
*(.data1)
*(.data.*)
@@ -50,14 +51,6 @@ SECTIONS
*(COMMON)
}
- . = ALIGN(64);
-
- .barebox_initcalls : { BAREBOX_INITCALLS }
- .barebox_exitcalls : { BAREBOX_EXITCALLS }
- .barebox_magicvar : { BAREBOX_MAGICVARS }
- __barebox_cmd : { BAREBOX_CMDS }
- __barebox_ratp_cmd : { BAREBOX_RATP_CMDS }
-
. = ALIGN(4096);
.dynamic : { *(.dynamic) }
. = ALIGN(4096);
diff --git a/arch/x86/mach-efi/elf_x86_64_efi.lds.S b/arch/x86/mach-efi/elf_x86_64_efi.lds.S
index 53de22d..40a9425 100644
--- a/arch/x86/mach-efi/elf_x86_64_efi.lds.S
+++ b/arch/x86/mach-efi/elf_x86_64_efi.lds.S
@@ -38,6 +38,7 @@ SECTIONS
.data : {
*(.rodata*)
+ RO_DATA_SECTION
*(.got.plt)
*(.got)
*(.data*)
@@ -52,14 +53,6 @@ SECTIONS
*(.rel.local)
}
- . = ALIGN(64);
-
- .barebox_initcalls : { BAREBOX_INITCALLS }
- .barebox_exitcalls : { BAREBOX_EXITCALLS }
- .barebox_magicvar : { BAREBOX_MAGICVARS }
- __barebox_cmd : { BAREBOX_CMDS }
- __barebox_ratp_cmd : { BAREBOX_RATP_CMDS }
-
. = ALIGN(4096);
.dynamic : { *(.dynamic) }
. = ALIGN(4096);
diff --git a/include/asm-generic/barebox.lds.h b/include/asm-generic/barebox.lds.h
index e91fb7c..8e8ae18 100644
--- a/include/asm-generic/barebox.lds.h
+++ b/include/asm-generic/barebox.lds.h
@@ -98,6 +98,17 @@
#define BAREBOX_PCI_FIXUP
#endif
+#define RO_DATA_SECTION \
+ BAREBOX_INITCALLS \
+ BAREBOX_EXITCALLS \
+ BAREBOX_CMDS \
+ BAREBOX_RATP_CMDS \
+ BAREBOX_SYMS \
+ BAREBOX_MAGICVARS \
+ BAREBOX_CLK_TABLE \
+ BAREBOX_DTB \
+ BAREBOX_PCI_FIXUP
+
#if defined(CONFIG_ARCH_BAREBOX_MAX_BARE_INIT_SIZE) && \
CONFIG_ARCH_BAREBOX_MAX_BARE_INIT_SIZE < CONFIG_BAREBOX_MAX_BARE_INIT_SIZE
#define MAX_BARE_INIT_SIZE CONFIG_ARCH_BAREBOX_MAX_BARE_INIT_SIZE