From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH 3/7] lds: Move start/end address variables into defines
Date: Wed, 2 Oct 2019 16:44:26 +0200 [thread overview]
Message-ID: <20191002144430.14946-4-s.hauer@pengutronix.de> (raw)
In-Reply-To: <20191002144430.14946-1-s.hauer@pengutronix.de>
For the older section defines we specify the start and end addresses
outside the macro which means we have to repeat them in each linker
script. Make the start/end addresses part of the define to simplify
things. While at it, add a BAREBOX_ prefix to the INITCALLS and EXITCALLS
macros for consistency to the other defines.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
arch/arm/lib32/barebox.lds.S | 21 ++------------
arch/arm/lib64/barebox.lds.S | 21 ++------------
arch/mips/lib/barebox.lds.S | 21 ++------------
arch/nios2/cpu/barebox.lds.S | 21 ++------------
arch/openrisc/cpu/barebox.lds.S | 22 ++------------
arch/ppc/boards/pcm030/barebox.lds.S | 21 ++------------
arch/ppc/mach-mpc85xx/barebox.lds.S | 18 ++----------
arch/riscv/lib/barebox.lds.S | 18 ++----------
arch/sandbox/board/barebox.lds.S | 14 ++-------
arch/x86/lib/barebox.lds.S | 16 ++---------
arch/x86/mach-efi/elf_ia32_efi.lds.S | 15 ++--------
arch/x86/mach-efi/elf_x86_64_efi.lds.S | 15 ++--------
include/asm-generic/barebox.lds.h | 40 ++++++++++++++++++--------
13 files changed, 52 insertions(+), 211 deletions(-)
diff --git a/arch/arm/lib32/barebox.lds.S b/arch/arm/lib32/barebox.lds.S
index 05a50afaad..9ffcffd66d 100644
--- a/arch/arm/lib32/barebox.lds.S
+++ b/arch/arm/lib32/barebox.lds.S
@@ -82,29 +82,12 @@ SECTIONS
.barebox_imd : { BAREBOX_IMD }
. = .;
- __barebox_cmd_start = .;
.barebox_cmd : { BAREBOX_CMDS }
- __barebox_cmd_end = .;
-
- __barebox_ratp_cmd_start = .;
.barebox_ratp_cmd : { BAREBOX_RATP_CMDS }
- __barebox_ratp_cmd_end = .;
-
- __barebox_magicvar_start = .;
.barebox_magicvar : { BAREBOX_MAGICVARS }
- __barebox_magicvar_end = .;
-
- __barebox_initcalls_start = .;
- .barebox_initcalls : { INITCALLS }
- __barebox_initcalls_end = .;
-
- __barebox_exitcalls_start = .;
- .barebox_exitcalls : { EXITCALLS }
- __barebox_exitcalls_end = .;
-
- __usymtab_start = .;
+ .barebox_initcalls : { BAREBOX_INITCALLS }
+ .barebox_exitcalls : { BAREBOX_EXITCALLS }
__usymtab : { BAREBOX_SYMS }
- __usymtab_end = .;
#ifdef CONFIG_PCI
__start_pci_fixups_early = .;
diff --git a/arch/arm/lib64/barebox.lds.S b/arch/arm/lib64/barebox.lds.S
index 5e9d94bee9..1cc00eca11 100644
--- a/arch/arm/lib64/barebox.lds.S
+++ b/arch/arm/lib64/barebox.lds.S
@@ -64,29 +64,12 @@ SECTIONS
.barebox_imd : { BAREBOX_IMD }
. = .;
- __barebox_cmd_start = .;
.barebox_cmd : { BAREBOX_CMDS }
- __barebox_cmd_end = .;
-
- __barebox_ratp_cmd_start = .;
.barebox_ratp_cmd : { BAREBOX_RATP_CMDS }
- __barebox_ratp_cmd_end = .;
-
- __barebox_magicvar_start = .;
.barebox_magicvar : { BAREBOX_MAGICVARS }
- __barebox_magicvar_end = .;
-
- __barebox_initcalls_start = .;
- .barebox_initcalls : { INITCALLS }
- __barebox_initcalls_end = .;
-
- __barebox_exitcalls_start = .;
- .barebox_exitcalls : { EXITCALLS }
- __barebox_exitcalls_end = .;
-
- __usymtab_start = .;
+ .barebox_initcalls : { BAREBOX_INITCALLS }
+ .barebox_exitcalls : { BAREBOX_EXITCALLS }
__usymtab : { BAREBOX_SYMS }
- __usymtab_end = .;
#ifdef CONFIG_PCI
__start_pci_fixups_early = .;
diff --git a/arch/mips/lib/barebox.lds.S b/arch/mips/lib/barebox.lds.S
index 7109d73372..86a469a042 100644
--- a/arch/mips/lib/barebox.lds.S
+++ b/arch/mips/lib/barebox.lds.S
@@ -41,29 +41,12 @@ SECTIONS
.barebox_imd : { BAREBOX_IMD }
. = .;
- __barebox_cmd_start = .;
.barebox_cmd : { BAREBOX_CMDS }
- __barebox_cmd_end = .;
-
- __barebox_ratp_cmd_start = .;
.barebox_ratp_cmd : { BAREBOX_RATP_CMDS }
- __barebox_ratp_cmd_end = .;
-
- __barebox_magicvar_start = .;
.barebox_magicvar : { BAREBOX_MAGICVARS }
- __barebox_magicvar_end = .;
-
- __barebox_initcalls_start = .;
- .barebox_initcalls : { INITCALLS }
- __barebox_initcalls_end = .;
-
- __barebox_exitcalls_start = .;
- .barebox_exitcalls : { EXITCALLS }
- __barebox_exitcalls_end = .;
-
- __usymtab_start = .;
+ .barebox_initcalls : { BAREBOX_INITCALLS }
+ .barebox_exitcalls : { BAREBOX_EXITCALLS }
__usymtab : { BAREBOX_SYMS }
- __usymtab_end = .;
#ifdef CONFIG_PCI
__start_pci_fixups_early = .;
diff --git a/arch/nios2/cpu/barebox.lds.S b/arch/nios2/cpu/barebox.lds.S
index fbcd1cd3f7..efe8e106a1 100644
--- a/arch/nios2/cpu/barebox.lds.S
+++ b/arch/nios2/cpu/barebox.lds.S
@@ -51,29 +51,12 @@ SECTIONS
.rodata : { *(.rodata) }
. = .;
- __barebox_cmd_start = .;
.barebox_cmd : { BAREBOX_CMDS }
- __barebox_cmd_end = .;
-
- __barebox_ratp_cmd_start = .;
.barebox_ratp_cmd : { BAREBOX_RATP_CMDS }
- __barebox_ratp_cmd_end = .;
-
- __barebox_magicvar_start = .;
.barebox_magicvar : { BAREBOX_MAGICVARS }
- __barebox_magicvar_end = .;
-
- __barebox_initcalls_start = .;
- .barebox_initcalls : { INITCALLS }
- __barebox_initcalls_end = .;
-
- __barebox_exitcalls_start = .;
- .barebox_exitcalls : { EXITCALLS }
- __barebox_exitcalls_end = .;
-
- ___usymtab_start = .;
+ .barebox_initcalls : { BAREBOX_INITCALLS }
+ .barebox_exitcalls : { BAREBOX_EXITCALLS }
__usymtab : { BAREBOX_SYMS }
- ___usymtab_end = .;
_etext = .; /* End of text and rodata section */
diff --git a/arch/openrisc/cpu/barebox.lds.S b/arch/openrisc/cpu/barebox.lds.S
index ed9b90ed70..37242f9c5e 100644
--- a/arch/openrisc/cpu/barebox.lds.S
+++ b/arch/openrisc/cpu/barebox.lds.S
@@ -53,30 +53,12 @@ SECTIONS
. = ALIGN(4);
. = .;
- __barebox_cmd_start = .;
.barebox_cmd : { BAREBOX_CMDS } > ram
- __barebox_cmd_end = .;
-
- __barebox_ratp_cmd_start = .;
.barebox_ratp_cmd : { BAREBOX_RATP_CMDS } > ram
- __barebox_ratp_cmd_end = .;
-
- __barebox_magicvar_start = .;
.barebox_magicvar : { BAREBOX_MAGICVARS } > ram
- __barebox_magicvar_end = .;
-
- __barebox_initcalls_start = .;
- .barebox_initcalls : { INITCALLS } > ram
- __barebox_initcalls_end = .;
-
- __barebox_exitcalls_start = .;
- .barebox_exitcalls : { EXITCALLS } > ram
- __barebox_exitcalls_end = .;
-
- ___usymtab_start = .;
+ .barebox_initcalls : { BAREBOX_INITCALLS } > ram
+ .barebox_exitcalls : { BAREBOX_EXITCALLS } > ram
__usymtab : { BAREBOX_SYMS } > ram
- ___usymtab_end = .;
-
.dtb : { BAREBOX_DTB } > ram
__etext = .; /* End of text and rodata section */
diff --git a/arch/ppc/boards/pcm030/barebox.lds.S b/arch/ppc/boards/pcm030/barebox.lds.S
index 12b551e685..73e4bde434 100644
--- a/arch/ppc/boards/pcm030/barebox.lds.S
+++ b/arch/ppc/boards/pcm030/barebox.lds.S
@@ -100,29 +100,12 @@ SECTIONS
PROVIDE (edata = .);
. = .;
- __barebox_cmd_start = .;
.barebox_cmd : { BAREBOX_CMDS }
- __barebox_cmd_end = .;
-
- __barebox_ratp_cmd_start = .;
.barebox_ratp_cmd : { BAREBOX_RATP_CMDS }
- __barebox_ratp_cmd_end = .;
-
- __barebox_magicvar_start = .;
.barebox_magicvar : { BAREBOX_MAGICVARS }
- __barebox_magicvar_end = .;
-
- __barebox_initcalls_start = .;
- .barebox_initcalls : { INITCALLS }
- __barebox_initcalls_end = .;
-
- __barebox_exitcalls_start = .;
- .barebox_exitcalls : { EXITCALLS }
- __barebox_exitcalls_end = .;
-
- __usymtab_start = .;
+ .barebox_initcalls : { BAREBOX_INITCALLS }
+ .barebox_exitcalls : { BAREBOX_EXITCALLS }
__usymtab : { BAREBOX_SYMS }
- __usymtab_end = .;
__start___ex_table = .;
__ex_table : { *(__ex_table) }
diff --git a/arch/ppc/mach-mpc85xx/barebox.lds.S b/arch/ppc/mach-mpc85xx/barebox.lds.S
index 30a1c571d7..1874319e71 100644
--- a/arch/ppc/mach-mpc85xx/barebox.lds.S
+++ b/arch/ppc/mach-mpc85xx/barebox.lds.S
@@ -101,25 +101,11 @@ SECTIONS
}
. = .;
- __barebox_cmd_start = .;
.barebox_cmd : { BAREBOX_CMDS }
- __barebox_cmd_end = .;
-
- __barebox_ratp_cmd_start = .;
.barebox_ratp_cmd : { BAREBOX_RATP_CMDS }
- __barebox_ratp_cmd_end = .;
-
- __barebox_initcalls_start = .;
- .barebox_initcalls : { INITCALLS }
- __barebox_initcalls_end = .;
-
- __barebox_exitcalls_start = .;
- .barebox_exitcalls : { EXITCALLS }
- __barebox_exitcalls_end = .;
-
- __usymtab_start = .;
+ .barebox_initcalls : { BAREBOX_INITCALLS }
+ .barebox_exitcalls : { BAREBOX_EXITCALLS }
__usymtab : { BAREBOX_SYMS }
- __usymtab_end = .;
. = .;
__start___ex_table = .;
diff --git a/arch/riscv/lib/barebox.lds.S b/arch/riscv/lib/barebox.lds.S
index 10c19f15de..23e4468e2f 100644
--- a/arch/riscv/lib/barebox.lds.S
+++ b/arch/riscv/lib/barebox.lds.S
@@ -44,25 +44,11 @@ SECTIONS
.got : { *(.got*) }
. = .;
- __barebox_cmd_start = .;
.barebox_cmd : { BAREBOX_CMDS }
- __barebox_cmd_end = .;
-
- __barebox_magicvar_start = .;
.barebox_magicvar : { BAREBOX_MAGICVARS }
- __barebox_magicvar_end = .;
-
- __barebox_initcalls_start = .;
- .barebox_initcalls : { INITCALLS }
- __barebox_initcalls_end = .;
-
- __barebox_exitcalls_start = .;
- .barebox_exitcalls : { EXITCALLS }
- __barebox_exitcalls_end = .;
-
- __usymtab_start = .;
+ .barebox_initcalls : { BAREBOX_INITCALLS }
+ .barebox_exitcalls : { BAREBOX_EXITCALLS }
__usymtab : { BAREBOX_SYMS }
- __usymtab_end = .;
.rela.dyn : { *(.rela*) }
diff --git a/arch/sandbox/board/barebox.lds.S b/arch/sandbox/board/barebox.lds.S
index 80e27fe87d..bdce8ecbd6 100644
--- a/arch/sandbox/board/barebox.lds.S
+++ b/arch/sandbox/board/barebox.lds.S
@@ -3,29 +3,19 @@
SECTIONS
{
. = ALIGN(64);
- __barebox_initcalls_start = .;
- __barebox_initcalls : { INITCALLS }
- __barebox_initcalls_end = .;
+ .barebox_initcalls : { BAREBOX_INITCALLS }
. = ALIGN(64);
- __barebox_exitcalls_start = .;
- __barebox_exitcalls : { EXITCALLS }
- __barebox_exitcalls_end = .;
+ .barebox_exitcalls : { BAREBOX_EXITCALLS }
. = ALIGN(64);
- __barebox_magicvar_start = .;
.barebox_magicvar : { BAREBOX_MAGICVARS }
- __barebox_magicvar_end = .;
. = ALIGN(64);
- __barebox_cmd_start = .;
__barebox_cmd : { BAREBOX_CMDS }
- __barebox_cmd_end = .;
. = ALIGN(64);
- __barebox_ratp_cmd_start = .;
__barebox_ratp_cmd : { BAREBOX_RATP_CMDS }
- __barebox_ratp_cmd_end = .;
}
INSERT BEFORE .rodata;
diff --git a/arch/x86/lib/barebox.lds.S b/arch/x86/lib/barebox.lds.S
index 6ee9342f47..d26f060a3e 100644
--- a/arch/x86/lib/barebox.lds.S
+++ b/arch/x86/lib/barebox.lds.S
@@ -165,44 +165,32 @@ SECTIONS
} > barebox
.barebox_cmd : AT ( LOADADDR(.got) + SIZEOF (.got) ) {
- __barebox_cmd_start = .;
BAREBOX_CMDS
- __barebox_cmd_end = .;
. = ALIGN(4);
} > barebox
.barebox_ratp_cmd : AT ( LOADADDR(.got) + SIZEOF (.got) ) {
- __barebox_ratp_cmd_start = .;
BAREBOX_RATP_CMDS
- __barebox_ratp_cmd_end = .;
. = ALIGN(4);
} > barebox
.barebox_magicvars : AT ( LOADADDR(.barebox_cmd) + SIZEOF (.barebox_cmd) ) {
- __barebox_magicvar_start = .;
BAREBOX_MAGICVARS
- __barebox_magicvar_end = .;
. = ALIGN(4);
} > barebox
.barebox_initcalls : AT ( LOADADDR(.barebox_magicvars) + SIZEOF (.barebox_magicvars) ) {
- __barebox_initcalls_start = .;
- INITCALLS
- __barebox_initcalls_end = .;
+ BAREBOX_INITCALLS
. = ALIGN(4);
} > barebox
.barebox_exitcalls : AT ( LOADADDR(.barebox_initcalls) + SIZEOF (.barebox_initcalls) ) {
- __barebox_exitcalls_start = .;
- EXITCALLS
- __barebox_exitcalls_end = .;
+ BAREBOX_EXITCALLS
. = ALIGN(4);
} > barebox
.__usymtab : AT ( LOADADDR(.barebox_exitcalls) + SIZEOF (.barebox_exitcalls) ) {
- __usymtab_start = .;
BAREBOX_SYMS
- __usymtab_end = .;
. = ALIGN(4);
} > barebox
diff --git a/arch/x86/mach-efi/elf_ia32_efi.lds.S b/arch/x86/mach-efi/elf_ia32_efi.lds.S
index 9477aa7d73..a5874c448b 100644
--- a/arch/x86/mach-efi/elf_ia32_efi.lds.S
+++ b/arch/x86/mach-efi/elf_ia32_efi.lds.S
@@ -52,28 +52,17 @@ SECTIONS
. = ALIGN(64);
- __barebox_initcalls_start = .;
- __barebox_initcalls : { INITCALLS }
- __barebox_initcalls_end = .;
-
- __barebox_exitcalls_start = .;
- __barebox_exitcalls : { EXITCALLS }
- __barebox_exitcalls_end = .;
+ .barebox_initcalls : { BAREBOX_INITCALLS }
+ .barebox_exitcalls : { BAREBOX_EXITCALLS }
. = ALIGN(64);
- __barebox_magicvar_start = .;
.barebox_magicvar : { BAREBOX_MAGICVARS }
- __barebox_magicvar_end = .;
. = ALIGN(64);
- __barebox_cmd_start = .;
__barebox_cmd : { BAREBOX_CMDS }
- __barebox_cmd_end = .;
. = ALIGN(64);
- __barebox_ratp_cmd_start = .;
__barebox_ratp_cmd : { BAREBOX_RATP_CMDS }
- __barebox_ratp_cmd_end = .;
. = ALIGN(4096);
.dynamic : { *(.dynamic) }
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 90b6b9f3f1..b00cb98c97 100644
--- a/arch/x86/mach-efi/elf_x86_64_efi.lds.S
+++ b/arch/x86/mach-efi/elf_x86_64_efi.lds.S
@@ -54,28 +54,17 @@ SECTIONS
. = ALIGN(64);
- __barebox_initcalls_start = .;
- __barebox_initcalls : { INITCALLS }
- __barebox_initcalls_end = .;
-
- __barebox_exitcalls_start = .;
- __barebox_exitcalls : { EXITCALLS }
- __barebox_exitcalls_end = .;
+ .barebox_initcalls : { BAREBOX_INITCALLS }
+ .barebox_exitcalls : { BAREBOX_EXITCALLS }
. = ALIGN(64);
- __barebox_magicvar_start = .;
.barebox_magicvar : { BAREBOX_MAGICVARS }
- __barebox_magicvar_end = .;
. = ALIGN(64);
- __barebox_cmd_start = .;
__barebox_cmd : { BAREBOX_CMDS }
- __barebox_cmd_end = .;
. = ALIGN(64);
- __barebox_ratp_cmd_start = .;
__barebox_ratp_cmd : { BAREBOX_RATP_CMDS }
- __barebox_ratp_cmd_end = .;
. = ALIGN(4096);
.dynamic : { *(.dynamic) }
diff --git a/include/asm-generic/barebox.lds.h b/include/asm-generic/barebox.lds.h
index c9fb8f47ae..0784048eb6 100644
--- a/include/asm-generic/barebox.lds.h
+++ b/include/asm-generic/barebox.lds.h
@@ -16,7 +16,8 @@
#define PRE_IMAGE
#endif
-#define INITCALLS \
+#define BAREBOX_INITCALLS \
+ __barebox_initcalls_start = .; \
KEEP(*(.initcall.0)) \
KEEP(*(.initcall.1)) \
KEEP(*(.initcall.2)) \
@@ -31,24 +32,39 @@
KEEP(*(.initcall.11)) \
KEEP(*(.initcall.12)) \
KEEP(*(.initcall.13)) \
- KEEP(*(.initcall.14))
+ KEEP(*(.initcall.14)) \
+ __barebox_initcalls_end = .;
-#define EXITCALLS \
+#define BAREBOX_EXITCALLS \
+ __barebox_exitcalls_start = .; \
KEEP(*(.exitcall.0)) \
KEEP(*(.exitcall.1)) \
KEEP(*(.exitcall.2)) \
KEEP(*(.exitcall.3)) \
KEEP(*(.exitcall.4)) \
KEEP(*(.exitcall.5)) \
- KEEP(*(.exitcall.6))
-
-#define BAREBOX_CMDS KEEP(*(SORT_BY_NAME(.barebox_cmd*)))
-
-#define BAREBOX_RATP_CMDS KEEP(*(SORT_BY_NAME(.barebox_ratp_cmd*)))
-
-#define BAREBOX_SYMS KEEP(*(__usymtab))
-
-#define BAREBOX_MAGICVARS KEEP(*(SORT_BY_NAME(.barebox_magicvar*)))
+ KEEP(*(.exitcall.6)) \
+ __barebox_exitcalls_end = .;
+
+#define BAREBOX_CMDS \
+ __barebox_cmd_start = .; \
+ KEEP(*(SORT_BY_NAME(.barebox_cmd*))) \
+ __barebox_cmd_end = .;
+
+#define BAREBOX_RATP_CMDS \
+ __barebox_ratp_cmd_start = .; \
+ KEEP(*(SORT_BY_NAME(.barebox_ratp_cmd*))) \
+ __barebox_ratp_cmd_end = .;
+
+#define BAREBOX_SYMS \
+ __usymtab_start = .; \
+ KEEP(*(__usymtab)) \
+ __usymtab_end = .;
+
+#define BAREBOX_MAGICVARS \
+ __barebox_magicvar_start = .; \
+ KEEP(*(SORT_BY_NAME(.barebox_magicvar*))) \
+ __barebox_magicvar_end = .;
#define BAREBOX_CLK_TABLE \
. = ALIGN(8); \
--
2.23.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2019-10-02 14:44 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-02 14:44 [PATCH 0/7] Cleanup linker scripts Sascha Hauer
2019-10-02 14:44 ` [PATCH 1/7] barebox.lds: Remove unnecessary braces Sascha Hauer
2019-10-02 14:44 ` [PATCH 2/7] ppc: remove unused variables from linker scripts Sascha Hauer
2019-10-02 14:44 ` Sascha Hauer [this message]
2019-10-02 18:46 ` [PATCH 3/7] lds: Move start/end address variables into defines Sam Ravnborg
2019-10-02 14:44 ` [PATCH 4/7] lds: create and use BAREBOX_PCI_FIXUP macro Sascha Hauer
2019-10-02 14:44 ` [PATCH 5/7] X86: lds: remove unnecessary alignments Sascha Hauer
2019-10-02 18:53 ` Sam Ravnborg
2019-10-14 10:05 ` [PATCH] command: Use array of pointers to commands Sascha Hauer
2019-10-14 10:08 ` [PATCH 5/7] X86: lds: remove unnecessary alignments Sascha Hauer
2019-10-02 14:44 ` [PATCH 6/7] lds: remove more " Sascha Hauer
2019-10-02 18:55 ` Sam Ravnborg
2019-10-02 14:44 ` [PATCH 7/7] lds: Add and use RO_DATA_SECTION macro Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191002144430.14946-4-s.hauer@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox