summaryrefslogtreecommitdiffstats
path: root/arch/x86
diff options
context:
space:
mode:
authorAhmad Fatoum <a.fatoum@pengutronix.de>2022-10-10 08:11:18 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2022-10-11 16:46:25 +0200
commit97e721a5d6a94422115bcce6bf2d8e822284212f (patch)
treebac95f25f5213906d63b3f18cdad52e0cdd8bd47 /arch/x86
parenta857444f4326491297163ba7e53ca98fde2988d4 (diff)
downloadbarebox-97e721a5d6a94422115bcce6bf2d8e822284212f.tar.gz
barebox-97e721a5d6a94422115bcce6bf2d8e822284212f.tar.xz
lds: move OUTPUT_FORMAT/ARCH definition into header
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> Link: https://lore.barebox.org/20221010061122.2084009-7-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/x86')
-rw-r--r--arch/x86/include/asm/barebox.lds.h8
-rw-r--r--arch/x86/mach-efi/elf_ia32_efi.lds.S4
-rw-r--r--arch/x86/mach-efi/elf_x86_64_efi.lds.S4
3 files changed, 12 insertions, 4 deletions
diff --git a/arch/x86/include/asm/barebox.lds.h b/arch/x86/include/asm/barebox.lds.h
index 540d740959..f00d36c4e7 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 14ae702e50..4b13007243 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 8c666235ce..f63c0c0c93 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
{