Skip to contentSkip to conversation

toolchain: expose BR2_TOOLCHAIN_EXTRA_EXTERNAL_LIBS for all toolchain types

PATCH Superseded Matt Weber 2 participants 2 messages Oct 27, 2019

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Matt Weber

author
#0 lore raw

PATCH 1/1 toolchain: expose BR2_TOOLCHAIN_EXTRA_EXTERNAL_LIBS for all toolchain types

This patch extends the "copy extra GCC libraries to target" feature to also work for internal toolchains. The variable has been renamed to be BR2_TOOLCHAIN_EXTRA_LIBS and the configuration option moved under the generic toolchain package. For external toolchains, the step that does the copy is still in the copy_toolchain_lib_root() helper which copies from the sysroot to the target. For the internal toolchain, the host gcc-final package does a post install hook to copy the libraries from the toolchain build folders to both the sysroot and target(!static).

Examples where this can be useful is for adding debug libraries to the target like the GCC libsanitizer (libasan/liblsan/...).

---
Note: this generic extra library copy is proposed as an alternative to
http://patchwork.ozlabs.org/patch/1110787/

---
 package/gcc/gcc-final/gcc-final.mk                   |  2 ++
 toolchain/Config.in                                  | 12 ++++++++++++
 .../toolchain-external/pkg-toolchain-external.mk     |  2 +-
 .../toolchain-external-custom/Config.in.options      |  8 --------
 4 files changed, 15 insertions(+), 9 deletions(-)
package/gcc/gcc-final/gcc-final.mk +2 -0
index 30fb87856c..24d034b720 100644
@@ -187,6 +187,8 @@ ifeq ($(BR2_GCC_ENABLE_OPENMP),y)
 HOST_GCC_FINAL_USR_LIBS += libgomp
 endif
 
+HOST_GCC_FINAL_USR_LIBS += $(call qstrip,$(BR2_TOOLCHAIN_EXTRA_LIBS))
+
 ifneq ($(HOST_GCC_FINAL_USR_LIBS),)
 define HOST_GCC_FINAL_INSTALL_STATIC_LIBS
 	for i in $(HOST_GCC_FINAL_USR_LIBS) ; do \
toolchain/Config.in +12 -0
index c9aa95985f..29289d22a6 100644
@@ -221,6 +221,18 @@ config BR2_TOOLCHAIN_GLIBC_GCONV_LIBS_LIST
 
 	  Note: the full set of gconv libs are ~8MiB (on ARM).
 
+config BR2_TOOLCHAIN_EXTRA_LIBS
+	string "Extra toolchain libraries to be copied to target"
+	help
+	  If your toolchain provides extra libraries that need to be
+	  copied to the target filesystem, enter them here, separated
+	  by spaces.
+
+	  NOTE: The library name should not include a suffix or wildcard.
+
+	  Examples where this can be useful is for adding debug libraries
+	  to the target like the GCC libsanitizer (libasan/liblsan/...).
+
 # This boolean is true if the toolchain provides a built-in full
 # featured gettext implementation (glibc), and false if only a stub
 # gettext implementation is provided (uclibc, musl)
toolchain/toolchain-external/pkg-toolchain-external.mk +1 -1
index 5147da0104..e339773a96 100644
@@ -156,7 +156,7 @@ ifeq ($(BR2_TOOLCHAIN_HAS_DLANG),y)
 TOOLCHAIN_EXTERNAL_LIBS += libgdruntime.so* libgphobos.so*
 endif
 
-TOOLCHAIN_EXTERNAL_LIBS += $(call qstrip,$(BR2_TOOLCHAIN_EXTRA_EXTERNAL_LIBS))
+TOOLCHAIN_EXTERNAL_LIBS += $(call qstrip,$(BR2_TOOLCHAIN_EXTRA_LIBS))
 
 
 #
toolchain/toolchain-external/toolchain-external-custom/Config.in.options +0 -8
index a36747f490..fd95f8201b 100644
@@ -438,12 +438,4 @@ config BR2_TOOLCHAIN_EXTERNAL_OPENMP
 	  support. If you don't know, leave the default value,
 	  Buildroot will tell you if it's correct or not.
 
-config BR2_TOOLCHAIN_EXTRA_EXTERNAL_LIBS
-	string "Extra toolchain libraries to be copied to target"
-	help
-	  If your external toolchain provides extra libraries that
-	  need to be copied to the target filesystem, enter them
-	  here, separated by spaces. They will be copied to the
-	  target's /lib directory.
-
 endif
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/1 toolchain: expose BR2_TOOLCHAIN_EXTRA_EXTERNAL_LIBS for all toolchain types

Quoted 9 lines · On Sun, 27 Oct 2019 08:49:46 -0500 Matt Weber…

This patch extends the "copy extra GCC libraries to target" feature to also work for internal toolchains. The variable has been renamed to be BR2_TOOLCHAIN_EXTRA_LIBS and the configuration option moved under the generic toolchain package. For external toolchains, the step that does the copy is still in the copy_toolchain_lib_root() helper which copies from the sysroot to the target. For the internal toolchain, the host gcc-final package does a post install hook to copy the libraries from the toolchain build folders to both the sysroot and target(!static).

Quoted 5 lines

Examples where this can be useful is for adding debug libraries to the target like the GCC libsanitizer (libasan/liblsan/...).

This seems reasonable. However, Config.in.legacy handling is missing. See Config.in.legacy which explains how to do it for string options.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com