Misc gcc fixes/improvements
cover Misc gcc fixes/improvements
Hello,
The first patch fixes the build of no-thread toolchains: the libcilkrts cannot build without threads. This was not noticed until now, because we don't regularly build no-thread toolchain, except for ARM, and libcilkrts was only enabled for ARM in gcc 7.x. This patch was made as minimal as possible so that it can be backported to the LTS branch.
The second patch reworks a bit the licilkrts handling so that we know we can drop it at some point in the future (libcilkrts was removed starting from gcc 8.x).
The third patch drops an unneeded option.
Best regards,
Thomas
Thomas Petazzoni (3):
package/gcc: disable libcilkrts when there is no thread support package/gcc: introduce BR2_GCC_SUPPORTS_LIBCILKRTS package/gcc: remove BR2_GCC_SUPPORTS_FINEGRAINEDMTUNE
package/gcc/Config.in.host | 6 ++++-- package/gcc/gcc-final/gcc-final.mk | 17 +++++++++++++++-- package/gcc/gcc-initial/gcc-initial.mk | 9 ++------- package/gcc/gcc.mk | 5 +---- 4 files changed, 22 insertions(+), 15 deletions(-)
Signature · 1 line
2.14.4
PATCH 1/3 package/gcc: disable libcilkrts when there is no thread support
The libcilkrts configure script errors out with "Pthreads are required to build libcilkrts" if the C library doesn't have thread support. To fix that, we disable libcilkrts when thread support is not available.
This issue was not noticed until now, because we only regularly build a no-thread toolchain for ARM, and libcilkrts was enabled on ARM only starting in gcc 7.x.
This fixes the build of no-thread toolchains on architectures where libcilkrts is supported, i.e x86/x86-64, ARM and Sparc.
--- package/gcc/gcc-final/gcc-final.mk | 5 +++++ 1 file changed, 5 insertions(+)
package/gcc/gcc-final/gcc-final.mk +5 -0
@@ -81,6 +81,11 @@ ifeq ($(BR2_sparc),y) HOST_GCC_FINAL_CONF_OPTS += --disable-libcilkrts endif +# Pthreads are required to build libcilkrts +ifeq ($(BR2_PTHREADS_NONE),y) +HOST_GCC_FINAL_CONF_OPTS += --disable-libcilkrts +endif + # Disable shared libs like libstdc++ if we do static since it confuses linking # In that case also disable libcilkrts as there is no static version ifeq ($(BR2_STATIC_LIBS),y)
Signature · 1 line
2.14.4
PATCH 1/3 package/gcc: disable libcilkrts when there is no thread support
Hi Thomas,
Le 21/10/2018 ? 13:54, Thomas Petazzoni a ?crit?:
Quoted 4 lines
The libcilkrts configure script errors out with "Pthreads are required to build libcilkrts" if the C library doesn't have thread support. To fix that, we disable libcilkrts when thread support is not available.
Quoted 8 lines
This issue was not noticed until now, because we only regularly build a no-thread toolchain for ARM, and libcilkrts was enabled on ARM only starting in gcc 7.x.
This fixes the build of no-thread toolchains on architectures where libcilkrts is supported, i.e x86/x86-64, ARM and Sparc.
Signed-off-by Thomas Petazzoni <[email protected]>
Best regards,
Romain
Quoted 21 lines
--- package/gcc/gcc-final/gcc-final.mk | 5 +++++ 1 file changed, 5 insertions(+)package/gcc/gcc-final/gcc-final.mk +5
-0@@ -81,6 +81,11 @@ ifeq ($(BR2_sparc),y) HOST_GCC_FINAL_CONF_OPTS += --disable-libcilkrts endif +# Pthreads are required to build libcilkrts +ifeq ($(BR2_PTHREADS_NONE),y) +HOST_GCC_FINAL_CONF_OPTS += --disable-libcilkrts +endif + # Disable shared libs like libstdc++ if we do static since it confuses linking # In that case also disable libcilkrts as there is no static version ifeq ($(BR2_STATIC_LIBS),y)
PATCH 1/3 package/gcc: disable libcilkrts when there is no thread support
In reply to Thomas PetazzoniQuoted 6 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Thomas" == Thomas Petazzoni <[email protected]> writes:
The libcilkrts configure script errors out with "Pthreads are required to build libcilkrts" if the C library doesn't have thread support. To fix that, we disable libcilkrts when thread support is not available.
Quoted 8 lines
This issue was not noticed until now, because we only regularly build a no-thread toolchain for ARM, and libcilkrts was enabled on ARM only starting in gcc 7.x.
This fixes the build of no-thread toolchains on architectures where libcilkrts is supported, i.e x86/x86-64, ARM and Sparc.
Signed-off-by Thomas Petazzoni <[email protected]>
Committed to 2018.02.x and 2018.08.x, thanks.
Signature · 1 line
Bye, Peter Korsgaard
PATCH 2/3 package/gcc: introduce BR2_GCC_SUPPORTS_LIBCILKRTS
In reply to Thomas Petazzonilibcilkrts was introduced in gcc 4.9, and removed in gcc 8.x. Therefore, it does not make sense to pass --disable-libcilkrts in gcc 8.x and higher. This commit introduces BR2_GCC_SUPPORTS_LIBCILKRTS that allows the makefile code to know if the selected gcc version supports libcilkrts or not.
This new option mainly allows to annotate the fact that libcilkrts exists in gcc [4.9, 7] and that once we have dropped support for those gcc versions, the libcilkrts related logic can be removed.
--- package/gcc/Config.in.host | 6 ++++++ package/gcc/gcc-final/gcc-final.mk | 12 ++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-)
package/gcc/Config.in.host +6 -0
@@ -76,6 +76,12 @@ config BR2_GCC_SUPPORTS_FINEGRAINEDMTUNE bool default y +# libcilkrts was introduced in gcc 4.9 (oldest gcc version we +# support), and removed in gcc 8.x +config BR2_GCC_SUPPORTS_LIBCILKRTS + bool + default y if !BR2_TOOLCHAIN_GCC_AT_LEAST_8 + config BR2_GCC_VERSION string default "4.9.4" if BR2_GCC_VERSION_4_9_X
package/gcc/gcc-final/gcc-final.mk +10 -2
@@ -76,6 +76,8 @@ HOST_GCC_FINAL_CONF_OPTS += "--with-multilib-list=m4a,m4a-nofpu" HOST_GCC_FINAL_GCC_LIB_DIR = $(HOST_DIR)/$(GNU_TARGET_NAME)/lib/!m4* endif +ifeq ($(BR2_GCC_SUPPORTS_LIBCILKRTS),y) + # libcilkrts does not support v8 ifeq ($(BR2_sparc),y) HOST_GCC_FINAL_CONF_OPTS += --disable-libcilkrts
@@ -86,10 +88,16 @@ ifeq ($(BR2_PTHREADS_NONE),y) HOST_GCC_FINAL_CONF_OPTS += --disable-libcilkrts endif +ifeq ($(BR2_STATIC_LIBS),y) +# disable libcilkrts as there is no static version +HOST_GCC_FINAL_CONF_OPTS += --disable-libcilkrts +endif + +endif # BR2_GCC_SUPPORTS_LIBCILKRTS + # Disable shared libs like libstdc++ if we do static since it confuses linking -# In that case also disable libcilkrts as there is no static version ifeq ($(BR2_STATIC_LIBS),y) -HOST_GCC_FINAL_CONF_OPTS += --disable-shared --disable-libcilkrts +HOST_GCC_FINAL_CONF_OPTS += --disable-shared else HOST_GCC_FINAL_CONF_OPTS += --enable-shared endif
Signature · 1 line
2.14.4
PATCH 2/3 package/gcc: introduce BR2_GCC_SUPPORTS_LIBCILKRTS
Hi Thomas,
Le 21/10/2018 ? 13:54, Thomas Petazzoni a ?crit?:
Quoted 11 lines
libcilkrts was introduced in gcc 4.9, and removed in gcc 8.x. Therefore, it does not make sense to pass --disable-libcilkrts in gcc 8.x and higher. This commit introduces
BR2_GCC_SUPPORTS_LIBCILKRTSthat allows the makefile code to know if the selected gcc version supports libcilkrts or not.This new option mainly allows to annotate the fact that libcilkrts exists in gcc [4.9, 7] and that once we have dropped support for those gcc versions, the libcilkrts related logic can be removed.
Signed-off-by Thomas Petazzoni <[email protected]>
Best regards,
Romain
Quoted 55 lines
--- package/gcc/Config.in.host | 6 ++++++ package/gcc/gcc-final/gcc-final.mk | 12 ++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-)package/gcc/Config.in.host +6
-0@@ -76,6 +76,12 @@ config BR2_GCC_SUPPORTS_FINEGRAINEDMTUNE bool default y +# libcilkrts was introduced in gcc 4.9 (oldest gcc version we +# support), and removed in gcc 8.x +config BR2_GCC_SUPPORTS_LIBCILKRTS + bool + default y if !BR2_TOOLCHAIN_GCC_AT_LEAST_8 + config BR2_GCC_VERSION string default "4.9.4" if BR2_GCC_VERSION_4_9_Xpackage/gcc/gcc-final/gcc-final.mk +10
-2@@ -76,6 +76,8 @@ HOST_GCC_FINAL_CONF_OPTS += "--with-multilib-list=m4a,m4a-nofpu" HOST_GCC_FINAL_GCC_LIB_DIR = $(HOST_DIR)/$(GNU_TARGET_NAME)/lib/!m4* endif +ifeq ($(BR2_GCC_SUPPORTS_LIBCILKRTS),y) + # libcilkrts does not support v8 ifeq ($(BR2_sparc),y) HOST_GCC_FINAL_CONF_OPTS += --disable-libcilkrts@@ -86,10 +88,16 @@ ifeq ($(BR2_PTHREADS_NONE),y) HOST_GCC_FINAL_CONF_OPTS += --disable-libcilkrts endif +ifeq ($(BR2_STATIC_LIBS),y) +# disable libcilkrts as there is no static version +HOST_GCC_FINAL_CONF_OPTS += --disable-libcilkrts +endif + +endif # BR2_GCC_SUPPORTS_LIBCILKRTS + # Disable shared libs like libstdc++ if we do static since it confuses linking -# In that case also disable libcilkrts as there is no static version ifeq ($(BR2_STATIC_LIBS),y) -HOST_GCC_FINAL_CONF_OPTS += --disable-shared --disable-libcilkrts +HOST_GCC_FINAL_CONF_OPTS += --disable-shared else HOST_GCC_FINAL_CONF_OPTS += --enable-shared endif
PATCH 3/3 package/gcc: remove BR2_GCC_SUPPORTS_FINEGRAINEDMTUNE
In reply to Thomas PetazzoniSince commit 8f8e9162fae5fdc1788dcf33f02b20ddaa5e6846 ("package/gcc:
do not mourn avr32 for too long..."), in which we dropped AVR32 support, the BR2_GCC_SUPPORTS_FINEGRAINEDMTUNE is always 'y'. Therefore, it is totally useless to keep this option around, and this commit removes it, making the corresponding code unconditional along the way.
--- package/gcc/Config.in.host | 4 ---- package/gcc/gcc-initial/gcc-initial.mk | 9 ++------- package/gcc/gcc.mk | 5 +---- 3 files changed, 3 insertions(+), 15 deletions(-)
package/gcc/Config.in.host +0 -4
@@ -72,10 +72,6 @@ config BR2_GCC_VERSION_8_X endchoice -config BR2_GCC_SUPPORTS_FINEGRAINEDMTUNE - bool - default y - # libcilkrts was introduced in gcc 4.9 (oldest gcc version we # support), and removed in gcc 8.x config BR2_GCC_SUPPORTS_LIBCILKRTS
package/gcc/gcc-initial/gcc-initial.mk +2 -7
@@ -45,13 +45,8 @@ HOST_GCC_INITIAL_CONF_OPTS = \ HOST_GCC_INITIAL_CONF_ENV = \ $(HOST_GCC_COMMON_CONF_ENV) -HOST_GCC_INITIAL_MAKE_OPTS = $(HOST_GCC_COMMON_MAKE_OPTS) all-gcc -HOST_GCC_INITIAL_INSTALL_OPTS = install-gcc - -ifeq ($(BR2_GCC_SUPPORTS_FINEGRAINEDMTUNE),y) -HOST_GCC_INITIAL_MAKE_OPTS += all-target-libgcc -HOST_GCC_INITIAL_INSTALL_OPTS += install-target-libgcc -endif +HOST_GCC_INITIAL_MAKE_OPTS = $(HOST_GCC_COMMON_MAKE_OPTS) all-gcc all-target-libgcc +HOST_GCC_INITIAL_INSTALL_OPTS = install-gcc install-target-libgcc HOST_GCC_INITIAL_TOOLCHAIN_WRAPPER_ARGS += $(HOST_GCC_COMMON_TOOLCHAIN_WRAPPER_ARGS) HOST_GCC_INITIAL_POST_BUILD_HOOKS += TOOLCHAIN_WRAPPER_BUILD
package/gcc/gcc.mk +1 -4
@@ -98,6 +98,7 @@ HOST_GCC_COMMON_CONF_OPTS = \ --with-gnu-ld \ --disable-libssp \ --disable-multilib \ + --disable-decimal-float \ --with-gmp=$(HOST_DIR) \ --with-mpc=$(HOST_DIR) \ --with-mpfr=$(HOST_DIR) \
@@ -195,10 +196,6 @@ HOST_GCC_COMMON_CONF_OPTS += --with-float=soft endif endif -ifeq ($(BR2_GCC_SUPPORTS_FINEGRAINEDMTUNE),y) -HOST_GCC_COMMON_CONF_OPTS += --disable-decimal-float -endif - # Determine arch/tune/abi/cpu options ifneq ($(GCC_TARGET_ARCH),) HOST_GCC_COMMON_CONF_OPTS += --with-arch="$(GCC_TARGET_ARCH)"
Signature · 1 line
2.14.4
PATCH 3/3 package/gcc: remove BR2_GCC_SUPPORTS_FINEGRAINEDMTUNE
Hi Thomas,
Le 21/10/2018 ? 13:54, Thomas Petazzoni a ?crit?:
Quoted 8 lines
Since commit
8f8e9162fae5fdc1788dcf33f02b20ddaa5e6846("package/gcc:
do not mourn avr32 for too long..."), in which we dropped AVR32 support, theBR2_GCC_SUPPORTS_FINEGRAINEDMTUNEis always 'y'. Therefore, it is totally useless to keep this option around, and this commit removes it, making the corresponding code unconditional along the way.Signed-off-by Thomas Petazzoni <[email protected]>
Best regards,
Romain
Quoted 65 lines
--- package/gcc/Config.in.host | 4 ---- package/gcc/gcc-initial/gcc-initial.mk | 9 ++------- package/gcc/gcc.mk | 5 +---- 3 files changed, 3 insertions(+), 15 deletions(-)package/gcc/Config.in.host +0
-4@@ -72,10 +72,6 @@ config BR2_GCC_VERSION_8_X endchoice -config BR2_GCC_SUPPORTS_FINEGRAINEDMTUNE - bool - default y - # libcilkrts was introduced in gcc 4.9 (oldest gcc version we # support), and removed in gcc 8.x config BR2_GCC_SUPPORTS_LIBCILKRTSpackage/gcc/gcc-initial/gcc-initial.mk +2
-7@@ -45,13 +45,8 @@ HOST_GCC_INITIAL_CONF_OPTS = \ HOST_GCC_INITIAL_CONF_ENV = \ $(HOST_GCC_COMMON_CONF_ENV) -HOST_GCC_INITIAL_MAKE_OPTS = $(HOST_GCC_COMMON_MAKE_OPTS) all-gcc -HOST_GCC_INITIAL_INSTALL_OPTS = install-gcc - -ifeq ($(BR2_GCC_SUPPORTS_FINEGRAINEDMTUNE),y) -HOST_GCC_INITIAL_MAKE_OPTS += all-target-libgcc -HOST_GCC_INITIAL_INSTALL_OPTS += install-target-libgcc -endif +HOST_GCC_INITIAL_MAKE_OPTS = $(HOST_GCC_COMMON_MAKE_OPTS) all-gcc all-target-libgcc +HOST_GCC_INITIAL_INSTALL_OPTS = install-gcc install-target-libgcc HOST_GCC_INITIAL_TOOLCHAIN_WRAPPER_ARGS += $(HOST_GCC_COMMON_TOOLCHAIN_WRAPPER_ARGS) HOST_GCC_INITIAL_POST_BUILD_HOOKS += TOOLCHAIN_WRAPPER_BUILDpackage/gcc/gcc.mk +1
-4@@ -98,6 +98,7 @@ HOST_GCC_COMMON_CONF_OPTS = \ --with-gnu-ld \ --disable-libssp \ --disable-multilib \ + --disable-decimal-float \ --with-gmp=$(HOST_DIR) \ --with-mpc=$(HOST_DIR) \ --with-mpfr=$(HOST_DIR) \@@ -195,10 +196,6 @@ HOST_GCC_COMMON_CONF_OPTS += --with-float=soft endif endif -ifeq ($(BR2_GCC_SUPPORTS_FINEGRAINEDMTUNE),y) -HOST_GCC_COMMON_CONF_OPTS += --disable-decimal-float -endif - # Determine arch/tune/abi/cpu options ifneq ($(GCC_TARGET_ARCH),) HOST_GCC_COMMON_CONF_OPTS += --with-arch="$(GCC_TARGET_ARCH)"
cover Misc gcc fixes/improvements
In reply to Thomas PetazzoniHello,
Quoted 4 lines · Thomas Petazzoni
Thomas Petazzoni (3):
package/gcc: disable libcilkrts when there is no thread support package/gcc: introduceBR2_GCC_SUPPORTS_LIBCILKRTSpackage/gcc: removeBR2_GCC_SUPPORTS_FINEGRAINEDMTUNE
Series applied. Thanks Romain for the review!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com