mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH 07/10] ARM: lds: define and use BAREBOX_RELOCATION_TABLE
Date: Mon, 10 Oct 2022 08:11:19 +0200	[thread overview]
Message-ID: <20221010061122.2084009-8-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20221010061122.2084009-1-a.fatoum@pengutronix.de>

The structure of the relocation table is one of the main differences
between different architectures' linker scripts. Hoist it out for ARM
into <asm/barebox.lds.h>.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 arch/arm/include/asm/barebox.lds.h | 15 +++++++++++++++
 arch/arm/lib/pbl.lds.S             | 12 +-----------
 arch/arm/lib32/barebox.lds.S       |  8 +-------
 arch/arm/lib64/barebox.lds.S       |  8 +-------
 4 files changed, 18 insertions(+), 25 deletions(-)

diff --git a/arch/arm/include/asm/barebox.lds.h b/arch/arm/include/asm/barebox.lds.h
index e358064ec6f8..b9c824c4dbf1 100644
--- a/arch/arm/include/asm/barebox.lds.h
+++ b/arch/arm/include/asm/barebox.lds.h
@@ -12,4 +12,19 @@
 #define BAREBOX_OUTPUT_ARCH	"aarch64"
 #endif
 
+#ifdef CONFIG_CPU_32
+#define BAREBOX_RELOCATION_TYPE	rel
+#else
+#define BAREBOX_RELOCATION_TYPE	rela
+#endif
+
+#define BAREBOX_RELOCATION_TABLE					\
+	.rel_dyn_start : { *(.__rel_dyn_start) }			\
+	.BAREBOX_RELOCATION_TYPE.dyn : { *(.BAREBOX_RELOCATION_TYPE*) }	\
+	.rel_dyn_end : { *(.__rel_dyn_end) }				\
+	.__dynsym_start :  { *(.__dynsym_start) }			\
+	.dynsym : { *(.dynsym) }					\
+	.__dynsym_end : { *(.__dynsym_end) }
+
+
 #include <asm-generic/barebox.lds.h>
diff --git a/arch/arm/lib/pbl.lds.S b/arch/arm/lib/pbl.lds.S
index 42c7a4f91fb4..ae1babdcfd27 100644
--- a/arch/arm/lib/pbl.lds.S
+++ b/arch/arm/lib/pbl.lds.S
@@ -58,17 +58,7 @@ SECTIONS
 	}
 	__shasum_end = .;
 
-	.rel_dyn_start : { *(.__rel_dyn_start) }
-#ifdef CONFIG_CPU_32
-	.rel.dyn : { *(.rel*) }
-#else
-	.rela.dyn : { *(.rela*) }
-#endif
-	.rel_dyn_end : { *(.__rel_dyn_end) }
-
-	.__dynsym_start :  { *(.__dynsym_start) }
-	.dynsym : { *(.dynsym) }
-	.__dynsym_end : { *(.__dynsym_end) }
+	BAREBOX_RELOCATION_TABLE
 
 	pbl_code_size =  . - BASE;
 
diff --git a/arch/arm/lib32/barebox.lds.S b/arch/arm/lib32/barebox.lds.S
index ea66b3c3feaf..ec145569bea3 100644
--- a/arch/arm/lib32/barebox.lds.S
+++ b/arch/arm/lib32/barebox.lds.S
@@ -71,13 +71,7 @@ SECTIONS
 
 	. = .;
 
-	.rel_dyn_start : { *(.__rel_dyn_start) }
-	.rel.dyn : { *(.rel*) }
-	.rel_dyn_end : { *(.__rel_dyn_end) }
-
-	.__dynsym_start :  { *(.__dynsym_start) }
-	.dynsym : { *(.dynsym) }
-	.__dynsym_end : { *(.__dynsym_end) }
+	BAREBOX_RELOCATION_TABLE
 
 	_edata = .;
 	.image_end : { *(.__image_end) }
diff --git a/arch/arm/lib64/barebox.lds.S b/arch/arm/lib64/barebox.lds.S
index e2049753fdd5..de777ddb542b 100644
--- a/arch/arm/lib64/barebox.lds.S
+++ b/arch/arm/lib64/barebox.lds.S
@@ -49,13 +49,7 @@ SECTIONS
 
 	.barebox_imd : { BAREBOX_IMD }
 
-	.rel_dyn_start : { *(.__rel_dyn_start) }
-	.rela.dyn : { *(.rela*) }
-	.rel_dyn_end : { *(.__rel_dyn_end) }
-
-	.__dynsym_start :  { *(.__dynsym_start) }
-	.dynsym : { *(.dynsym) }
-	.__dynsym_end : { *(.__dynsym_end) }
+	BAREBOX_RELOCATION_TABLE
 
 	_edata = .;
 
-- 
2.30.2




  parent reply	other threads:[~2022-10-10  6:13 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-10  6:11 [PATCH 00/10] treewide: misc cleanup for efiloader prep Ahmad Fatoum
2022-10-10  6:11 ` [PATCH 01/10] block: have cdev_get_block_device accept const cdev Ahmad Fatoum
2022-10-10  6:11 ` [PATCH 02/10] treewide: replace errno_str() with %m printf format specifier Ahmad Fatoum
2022-10-10  6:11 ` [PATCH 03/10] common: misc: remove now unused errno_str Ahmad Fatoum
2022-10-10  6:11 ` [PATCH 04/10] driver: don't crash when dev_name/dev_id is called with NULL dev Ahmad Fatoum
2022-10-10  6:11 ` [PATCH 05/10] lds: introduce <asm/barebox.lds.h> Ahmad Fatoum
2022-10-10  6:11 ` [PATCH 06/10] lds: move OUTPUT_FORMAT/ARCH definition into header Ahmad Fatoum
2022-10-10  6:11 ` Ahmad Fatoum [this message]
2022-10-10  6:11 ` [PATCH 08/10] lib: random: add hwrng_get_crypto_bytes Ahmad Fatoum
2022-10-10  6:11 ` [PATCH 09/10] common: bootm: factor out FIT parsing code into bootm_open_bit Ahmad Fatoum
2022-10-10  6:11 ` [PATCH 10/10] common: bootm: use switch-case Ahmad Fatoum
2022-10-11 14:46 ` [PATCH 00/10] treewide: misc cleanup for efiloader prep 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=20221010061122.2084009-8-a.fatoum@pengutronix.de \
    --to=a.fatoum@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