All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v1 1/1] toolchain/toolchain-bare-metal-buildroot: add multilib option
@ 2025-06-19 15:48 Neal Frager via buildroot
  2025-08-18 15:03 ` [Buildroot] [PATCH v1 1/1], " Jesse Taube
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Neal Frager via buildroot @ 2025-06-19 15:48 UTC (permalink / raw)
  To: buildroot
  Cc: ibai.erkiaga-elorza, luca.ceresoli, Neal Frager, brandon.maier,
	ju.o, thomas.petazzoni, romain.naour, michal.simek, romain.naour

Sometimes the default GCC and newlib libraries built for a given
architecture tuple are not based on the desired ABI. Since ABI definitions are
different between architectures, the simplest solution is to allow users to
build bare-metal toolchains with --enable-multilib. This way, the libraries
for every available ABI will be built and users will be able to select the
desired library for their user applications.

This patch adds the option BR2_TOOLCHAIN_BARE_METAL_BUILDROOT_MULTILIB to give
users the choice to enable multilib, if desired.

Please note that when using a string of architecture tuples, this option will
apply to all architectures in the string, so it can significantly increase
build time.

Signed-off-by: Neal Frager <neal.frager@amd.com>
---
 package/binutils-bare-metal/binutils-bare-metal.mk |  8 +++++++-
 package/gcc-bare-metal/gcc-bare-metal.mk           |  8 +++++++-
 package/newlib-bare-metal/newlib-bare-metal.mk     |  8 +++++++-
 toolchain/toolchain-bare-metal-buildroot/Config.in | 14 ++++++++++++++
 4 files changed, 35 insertions(+), 3 deletions(-)

diff --git a/package/binutils-bare-metal/binutils-bare-metal.mk b/package/binutils-bare-metal/binutils-bare-metal.mk
index 709d072765..bb04b79c2f 100644
--- a/package/binutils-bare-metal/binutils-bare-metal.mk
+++ b/package/binutils-bare-metal/binutils-bare-metal.mk
@@ -21,6 +21,12 @@ HOST_BINUTILS_BARE_METAL_CONF_ENV += MAKEINFO=true
 HOST_BINUTILS_BARE_METAL_MAKE_OPTS += MAKEINFO=true
 HOST_BINUTILS_BARE_METAL_INSTALL_OPTS += MAKEINFO=true install
 
+ifeq ($(BR2_TOOLCHAIN_BARE_METAL_BUILDROOT_MULTILIB),y)
+HOST_BINUTILS_BARE_METAL_MULTILIB = "--enable-multilib"
+else
+HOST_BINUTILS_BARE_METAL_MULTILIB = "--disable-multilib"
+endif
+
 HOST_BINUTILS_BARE_METAL_CONF_OPTS = \
 	--prefix=$(HOST_DIR) \
 	--sysconfdir=$(HOST_DIR)/etc \
@@ -31,7 +37,7 @@ HOST_BINUTILS_BARE_METAL_CONF_OPTS = \
 	--disable-shared \
 	--enable-lto \
 	--disable-initfini-array \
-	--disable-multilib \
+	$(HOST_BINUTILS_BARE_METAL_MULTILIB) \
 	--disable-werror
 
 define HOST_BINUTILS_BARE_METAL_CONFIGURE_CMDS
diff --git a/package/gcc-bare-metal/gcc-bare-metal.mk b/package/gcc-bare-metal/gcc-bare-metal.mk
index 17232a8ef1..03938ca81b 100644
--- a/package/gcc-bare-metal/gcc-bare-metal.mk
+++ b/package/gcc-bare-metal/gcc-bare-metal.mk
@@ -31,6 +31,12 @@ HOST_GCC_BARE_METAL_MAKE_OPTS = \
 
 HOST_GCC_BARE_METAL_INSTALL_OPTS = install-gcc install-target-libgcc
 
+ifeq ($(BR2_TOOLCHAIN_BARE_METAL_BUILDROOT_MULTILIB),y)
+HOST_GCC_BARE_METAL_MULTILIB = "--enable-multilib"
+else
+HOST_GCC_BARE_METAL_MULTILIB = "--disable-multilib"
+endif
+
 HOST_GCC_BARE_METAL_CONF_OPTS = \
 	--prefix=$(HOST_DIR) \
 	--sysconfdir=$(HOST_DIR)/etc \
@@ -49,7 +55,7 @@ HOST_GCC_BARE_METAL_CONF_OPTS = \
 	--without-long-double-128 \
 	--without-headers \
 	--enable-languages=c \
-	--disable-multilib \
+	$(HOST_GCC_BARE_METAL_MULTILIB) \
 	--with-gmp=$(HOST_DIR) \
 	--with-mpc=$(HOST_DIR) \
 	--with-mpfr=$(HOST_DIR) \
diff --git a/package/newlib-bare-metal/newlib-bare-metal.mk b/package/newlib-bare-metal/newlib-bare-metal.mk
index bd740046c9..f1e54d6f9e 100644
--- a/package/newlib-bare-metal/newlib-bare-metal.mk
+++ b/package/newlib-bare-metal/newlib-bare-metal.mk
@@ -22,6 +22,12 @@ NEWLIB_BARE_METAL_INSTALL_STAGING = YES
 NEWLIB_BARE_METAL_INSTALL_TARGET = NO
 NEWLIB_BARE_METAL_MAKE_OPTS = MAKEINFO=true
 
+ifeq ($(BR2_TOOLCHAIN_BARE_METAL_BUILDROOT_MULTILIB),y)
+NEWLIB_BARE_METAL_MULTILIB = "--enable-multilib"
+else
+NEWLIB_BARE_METAL_MULTILIB = "--disable-multilib"
+endif
+
 NEWLIB_BARE_METAL_CONF_OPTS = \
 	--build=$(GNU_HOST_NAME) \
 	--prefix=/usr \
@@ -35,7 +41,7 @@ NEWLIB_BARE_METAL_CONF_OPTS = \
 	--enable-newlib-io-long-long \
 	--enable-newlib-io-float \
 	--enable-newlib-io-long-double \
-	--disable-multilib \
+	$(NEWLIB_BARE_METAL_MULTILIB) \
 	--with-tooldir=/usr
 
 define NEWLIB_BARE_METAL_CONFIGURE_CMDS
diff --git a/toolchain/toolchain-bare-metal-buildroot/Config.in b/toolchain/toolchain-bare-metal-buildroot/Config.in
index 19c97410c6..7ba579b570 100644
--- a/toolchain/toolchain-bare-metal-buildroot/Config.in
+++ b/toolchain/toolchain-bare-metal-buildroot/Config.in
@@ -12,6 +12,20 @@ config BR2_TOOLCHAIN_BARE_METAL_BUILDROOT_ARCH
 	  metal toolchain, use the following definition:
 	  "microblazeel-buildroot-elf riscv32-buildroot-elf"
 
+config BR2_TOOLCHAIN_BARE_METAL_BUILDROOT_MULTILIB
+	bool "Enable multilib"
+	help
+	  Sometimes the default GCC and newlib libraries for a given
+	  architecture are not the desired ABI. Since ABI
+	  definitions are different for each architecture, this
+	  option will enable multilib configuration, so that all
+	  available ABI libraries are built which will guarantee
+	  that the desired version will be available for user
+	  applications.
+
+	  When enabled, this option will apply to all architecture
+	  tuples in the list.
+
 source "package/newlib-bare-metal/Config.in"
 
 endif # BR2_TOOLCHAIN_BARE_METAL_BUILDROOT
-- 
2.25.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-09-24 20:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-19 15:48 [Buildroot] [PATCH v1 1/1] toolchain/toolchain-bare-metal-buildroot: add multilib option Neal Frager via buildroot
2025-08-18 15:03 ` [Buildroot] [PATCH v1 1/1], " Jesse Taube
2025-09-01  8:46 ` [Buildroot] [PATCH v1 1/1] " Frager, Neal via buildroot
2025-09-24 20:20 ` Julien Olivain via buildroot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.