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 06/10] lds: move OUTPUT_FORMAT/ARCH definition into header
Date: Mon, 10 Oct 2022 08:11:18 +0200	[thread overview]
Message-ID: <20221010061122.2084009-7-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20221010061122.2084009-1-a.fatoum@pengutronix.de>

In order to allow us having architecture-indepenent linker scripts, move
the definition for the format and the architecture into the new
<asm/barebox.lds.h> header file.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 arch/arm/include/asm/barebox.lds.h       |  8 ++++++++
 arch/arm/lib/pbl.lds.S                   | 10 +++-------
 arch/arm/lib32/barebox.lds.S             |  4 ++--
 arch/arm/lib64/barebox.lds.S             |  4 ++--
 arch/kvx/include/asm/barebox.lds.h       |  3 +++
 arch/mips/include/asm/barebox.lds.h      |  2 ++
 arch/mips/lib/barebox.lds.S              |  2 +-
 arch/mips/lib/pbl.lds.S                  |  2 +-
 arch/mips/pbl/zbarebox.lds.S             |  2 +-
 arch/openrisc/cpu/barebox.lds.S          |  2 +-
 arch/openrisc/include/asm/barebox.lds.h  |  2 ++
 arch/powerpc/boards/pcm030/barebox.lds.S |  2 +-
 arch/powerpc/include/asm/barebox.lds.h   |  2 ++
 arch/powerpc/mach-mpc85xx/barebox.lds.S  |  2 +-
 arch/riscv/include/asm/barebox.lds.h     |  7 +++++++
 arch/riscv/lib/barebox.lds.S             |  8 ++------
 arch/riscv/lib/pbl.lds.S                 |  8 ++------
 arch/x86/include/asm/barebox.lds.h       |  8 ++++++++
 arch/x86/mach-efi/elf_ia32_efi.lds.S     |  4 ++--
 arch/x86/mach-efi/elf_x86_64_efi.lds.S   |  4 ++--
 20 files changed, 53 insertions(+), 33 deletions(-)

diff --git a/arch/arm/include/asm/barebox.lds.h b/arch/arm/include/asm/barebox.lds.h
index 327beaf4bfb8..e358064ec6f8 100644
--- a/arch/arm/include/asm/barebox.lds.h
+++ b/arch/arm/include/asm/barebox.lds.h
@@ -4,4 +4,12 @@
 #include <mach/barebox.lds.h>
 #endif
 
+#ifdef CONFIG_CPU_32
+#define BAREBOX_OUTPUT_FORMAT	"elf32-littlearm", "elf32-littlearm", "elf32-littlearm"
+#define BAREBOX_OUTPUT_ARCH	"arm"
+#else
+#define BAREBOX_OUTPUT_FORMAT	"elf64-littleaarch64", "elf64-littleaarch64", "elf64-littleaarch64"
+#define BAREBOX_OUTPUT_ARCH	"aarch64"
+#endif
+
 #include <asm-generic/barebox.lds.h>
diff --git a/arch/arm/lib/pbl.lds.S b/arch/arm/lib/pbl.lds.S
index cc4b12f44893..42c7a4f91fb4 100644
--- a/arch/arm/lib/pbl.lds.S
+++ b/arch/arm/lib/pbl.lds.S
@@ -11,13 +11,9 @@
 #define BASE	(TEXT_BASE - SZ_2M)
 #endif
 
-#ifdef CONFIG_CPU_32
-OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
-OUTPUT_ARCH(arm)
-#else
-OUTPUT_FORMAT("elf64-littleaarch64", "elf64-littleaarch64", "elf64-littleaarch64")
-OUTPUT_ARCH(aarch64)
-#endif
+OUTPUT_FORMAT(BAREBOX_OUTPUT_FORMAT)
+OUTPUT_ARCH(BAREBOX_OUTPUT_ARCH)
+
 SECTIONS
 {
 	. = BASE;
diff --git a/arch/arm/lib32/barebox.lds.S b/arch/arm/lib32/barebox.lds.S
index 2bf66657a367..ea66b3c3feaf 100644
--- a/arch/arm/lib32/barebox.lds.S
+++ b/arch/arm/lib32/barebox.lds.S
@@ -4,8 +4,8 @@
 #include <asm/barebox.lds.h>
 #include <asm/secure.h>
 
-OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
-OUTPUT_ARCH(arm)
+OUTPUT_FORMAT(BAREBOX_OUTPUT_FORMAT)
+OUTPUT_ARCH(BAREBOX_OUTPUT_ARCH)
 ENTRY(start)
 SECTIONS
 {
diff --git a/arch/arm/lib64/barebox.lds.S b/arch/arm/lib64/barebox.lds.S
index c1069c896f27..e2049753fdd5 100644
--- a/arch/arm/lib64/barebox.lds.S
+++ b/arch/arm/lib64/barebox.lds.S
@@ -3,8 +3,8 @@
 
 #include <asm/barebox.lds.h>
 
-OUTPUT_FORMAT("elf64-littleaarch64", "elf64-littleaarch64", "elf64-littleaarch64")
-OUTPUT_ARCH(aarch64)
+OUTPUT_FORMAT(BAREBOX_OUTPUT_FORMAT)
+OUTPUT_ARCH(BAREBOX_OUTPUT_ARCH)
 ENTRY(start)
 SECTIONS
 {
diff --git a/arch/kvx/include/asm/barebox.lds.h b/arch/kvx/include/asm/barebox.lds.h
index 540d740959ff..4b0581c81aeb 100644
--- a/arch/kvx/include/asm/barebox.lds.h
+++ b/arch/kvx/include/asm/barebox.lds.h
@@ -1,3 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 
+#define LDS_OUTPUT_FORMAT	"elf64-kvx"
+#define LDS_OUTPUT_ARCH		"kvx:kv3-1:64"
+
 #include <asm-generic/barebox.lds.h>
diff --git a/arch/mips/include/asm/barebox.lds.h b/arch/mips/include/asm/barebox.lds.h
index 540d740959ff..124f3d5d6667 100644
--- a/arch/mips/include/asm/barebox.lds.h
+++ b/arch/mips/include/asm/barebox.lds.h
@@ -1,3 +1,5 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 
+#define BAREBOX_OUTPUT_ARCH	"mips"
+
 #include <asm-generic/barebox.lds.h>
diff --git a/arch/mips/lib/barebox.lds.S b/arch/mips/lib/barebox.lds.S
index 87668c7a7320..1259a4e94fc5 100644
--- a/arch/mips/lib/barebox.lds.S
+++ b/arch/mips/lib/barebox.lds.S
@@ -6,7 +6,7 @@
 
 #include <asm/barebox.lds.h>
 
-OUTPUT_ARCH(mips)
+OUTPUT_ARCH(BAREBOX_OUTPUT_ARCH)
 ENTRY(_start)
 SECTIONS
 {
diff --git a/arch/mips/lib/pbl.lds.S b/arch/mips/lib/pbl.lds.S
index 521333df0be0..4cf0398f33d1 100644
--- a/arch/mips/lib/pbl.lds.S
+++ b/arch/mips/lib/pbl.lds.S
@@ -10,7 +10,7 @@
 
 #define BASE    (TEXT_BASE - SZ_2M)
 
-OUTPUT_ARCH("mips")
+OUTPUT_ARCH(BAREBOX_OUTPUT_ARCH)
 SECTIONS
 {
 	. = BASE;
diff --git a/arch/mips/pbl/zbarebox.lds.S b/arch/mips/pbl/zbarebox.lds.S
index 2d82065bce08..e3114dfe2230 100644
--- a/arch/mips/pbl/zbarebox.lds.S
+++ b/arch/mips/pbl/zbarebox.lds.S
@@ -6,7 +6,7 @@
 #include <asm/barebox.lds.h>
 #include <asm-generic/memory_layout.h>
 
-OUTPUT_ARCH("mips")
+OUTPUT_ARCH(BAREBOX_OUTPUT_ARCH)
 ENTRY(pbl_start)
 SECTIONS
 {
diff --git a/arch/openrisc/cpu/barebox.lds.S b/arch/openrisc/cpu/barebox.lds.S
index f6999a113438..3fae1af37594 100644
--- a/arch/openrisc/cpu/barebox.lds.S
+++ b/arch/openrisc/cpu/barebox.lds.S
@@ -16,7 +16,7 @@
 #include <config.h>
 #include <asm/barebox.lds.h>
 
-OUTPUT_FORMAT("elf32-or1k", "elf32-or1k", "elf32-or1k")
+OUTPUT_FORMAT(BAREBOX_OUTPUT_FORMAT)
 ENTRY(__reset)
 __DYNAMIC  =  0;
 
diff --git a/arch/openrisc/include/asm/barebox.lds.h b/arch/openrisc/include/asm/barebox.lds.h
index 540d740959ff..87d868e1ad21 100644
--- a/arch/openrisc/include/asm/barebox.lds.h
+++ b/arch/openrisc/include/asm/barebox.lds.h
@@ -1,3 +1,5 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 
+#define BAREBOX_OUTPUT_FORMAT "elf32-or1k", "elf32-or1k", "elf32-or1k"
+
 #include <asm-generic/barebox.lds.h>
diff --git a/arch/powerpc/boards/pcm030/barebox.lds.S b/arch/powerpc/boards/pcm030/barebox.lds.S
index b90e88058113..146b63fe8889 100644
--- a/arch/powerpc/boards/pcm030/barebox.lds.S
+++ b/arch/powerpc/boards/pcm030/barebox.lds.S
@@ -16,7 +16,7 @@
 
 #include <asm/barebox.lds.h>
 
-OUTPUT_ARCH("powerpc")
+OUTPUT_ARCH(BAREBOX_OUTPUT_ARCH)
 ENTRY(_start)
 /* Do we need any of these for elf?
    __DYNAMIC = 0;    */
diff --git a/arch/powerpc/include/asm/barebox.lds.h b/arch/powerpc/include/asm/barebox.lds.h
index 540d740959ff..14477bd44a37 100644
--- a/arch/powerpc/include/asm/barebox.lds.h
+++ b/arch/powerpc/include/asm/barebox.lds.h
@@ -1,3 +1,5 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 
+#define BAREBOX_OUTPUT_ARCH	"powerpc"
+
 #include <asm-generic/barebox.lds.h>
diff --git a/arch/powerpc/mach-mpc85xx/barebox.lds.S b/arch/powerpc/mach-mpc85xx/barebox.lds.S
index 253fd3735e48..764854a860e7 100644
--- a/arch/powerpc/mach-mpc85xx/barebox.lds.S
+++ b/arch/powerpc/mach-mpc85xx/barebox.lds.S
@@ -21,7 +21,7 @@
 #define RESET_VECTOR_ADDRESS    0xfffffffc
 #endif
 
-OUTPUT_ARCH("powerpc")
+OUTPUT_ARCH(BAREBOX_OUTPUT_ARCH)
 ENTRY(_start_e500)
 
 PHDRS
diff --git a/arch/riscv/include/asm/barebox.lds.h b/arch/riscv/include/asm/barebox.lds.h
index 540d740959ff..0fa05df6ff2e 100644
--- a/arch/riscv/include/asm/barebox.lds.h
+++ b/arch/riscv/include/asm/barebox.lds.h
@@ -1,3 +1,10 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 
+#define BAREBOX_OUTPUT_ARCH	"riscv"
+#ifdef CONFIG_64BIT
+#define BAREBOX_OUTPUT_FORMAT	"elf64-littleriscv"
+#else
+#define BAREBOX_OUTPUT_FORMAT	"elf32-littleriscv"
+#endif
+
 #include <asm-generic/barebox.lds.h>
diff --git a/arch/riscv/lib/barebox.lds.S b/arch/riscv/lib/barebox.lds.S
index 5de32a47e7c0..101615ab052a 100644
--- a/arch/riscv/lib/barebox.lds.S
+++ b/arch/riscv/lib/barebox.lds.S
@@ -13,13 +13,9 @@
 
 #include <asm/barebox.lds.h>
 
-OUTPUT_ARCH(riscv)
+OUTPUT_ARCH(BAREBOX_OUTPUT_ARCH)
 ENTRY(start)
-#ifdef CONFIG_64BIT
-OUTPUT_FORMAT("elf64-littleriscv")
-#else
-OUTPUT_FORMAT("elf32-littleriscv")
-#endif
+OUTPUT_FORMAT(BAREBOX_OUTPUT_FORMAT)
 SECTIONS
 {
 	. = 0x0;
diff --git a/arch/riscv/lib/pbl.lds.S b/arch/riscv/lib/pbl.lds.S
index ba59024ae037..0fe7dfda8eb4 100644
--- a/arch/riscv/lib/pbl.lds.S
+++ b/arch/riscv/lib/pbl.lds.S
@@ -5,12 +5,8 @@
 #include <asm/barebox.lds.h>
 #include <asm-generic/memory_layout.h>
 
-OUTPUT_ARCH(riscv)
-#ifdef CONFIG_64BIT
-OUTPUT_FORMAT("elf64-littleriscv")
-#else
-OUTPUT_FORMAT("elf32-littleriscv")
-#endif
+OUTPUT_ARCH(BAREBOX_OUTPUT_ARCH)
+OUTPUT_FORMAT(BAREBOX_OUTPUT_FORMAT)
 SECTIONS
 {
 	. = 0x0;
diff --git a/arch/x86/include/asm/barebox.lds.h b/arch/x86/include/asm/barebox.lds.h
index 540d740959ff..f00d36c4e747 100644
--- a/arch/x86/include/asm/barebox.lds.h
+++ b/arch/x86/include/asm/barebox.lds.h
@@ -1,3 +1,11 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 
+#ifdef CONFIG_X86_32
+#define BAREBOX_OUTPUT_FORMAT	"elf32-i386", "elf32-i386", "elf32-i386"
+#define BAREBOX_OUTPUT_ARCH	"i386"
+#else
+#define BAREBOX_OUTPUT_FORMAT	"elf64-x86-64", "elf64-x86-64", "elf64-x86-64"
+#define BAREBOX_OUTPUT_ARCH	"i386:x86-64"
+#endif
+
 #include <asm-generic/barebox.lds.h>
diff --git a/arch/x86/mach-efi/elf_ia32_efi.lds.S b/arch/x86/mach-efi/elf_ia32_efi.lds.S
index 14ae702e5049..4b1300724300 100644
--- a/arch/x86/mach-efi/elf_ia32_efi.lds.S
+++ b/arch/x86/mach-efi/elf_ia32_efi.lds.S
@@ -2,8 +2,8 @@
 
 #include <asm/barebox.lds.h>
 
-OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
-OUTPUT_ARCH(i386)
+OUTPUT_FORMAT(BAREBOX_OUTPUT_FORMAT)
+OUTPUT_ARCH(BAREBOX_OUTPUT_ARCH)
 ENTRY(_start)
 SECTIONS
 {
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 8c666235ce1a..f63c0c0c939e 100644
--- a/arch/x86/mach-efi/elf_x86_64_efi.lds.S
+++ b/arch/x86/mach-efi/elf_x86_64_efi.lds.S
@@ -4,8 +4,8 @@
 
 /* Same as elf_x86_64_fbsd_efi.lds, except for OUTPUT_FORMAT below - KEEP IN SYNC */
 
-OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64", "elf64-x86-64")
-OUTPUT_ARCH(i386:x86-64)
+OUTPUT_FORMAT(BAREBOX_OUTPUT_FORMAT)
+OUTPUT_ARCH(BAREBOX_OUTPUT_ARCH)
 ENTRY(_start)
 SECTIONS
 {
-- 
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 ` Ahmad Fatoum [this message]
2022-10-10  6:11 ` [PATCH 07/10] ARM: lds: define and use BAREBOX_RELOCATION_TABLE Ahmad Fatoum
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-7-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