Skip to contentSkip to conversation

llvm: add dependency on !BR2_TOOLCHAIN_HAS_GCC_BUG_64735

PATCH New Thomas Petazzoni 2 participants 6 messages Apr 6, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 llvm: add dependency on !BR2_TOOLCHAIN_HAS_GCC_BUG_64735

LLVM uses std::shared_future, which until gcc 7.x isn't available on architectures that don't provide lock-free atomics, see
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64735.

Buildroot already has a BR2_TOOLCHAIN_HAS_GCC_BUG_64735 option to handle such a case, so simply add this new dependency to LLVM. It will make sure LLVM doesn't get built on ARMv5 platforms using a gcc older than 7.x.

Fixes:

http://autobuild.buildroot.net/results/ada497f6a8d20fa1a9adb2b17a138d7b726a6cdc/

---
 package/llvm/Config.in | 5 +++++
 1 file changed, 5 insertions(+)
package/llvm/Config.in +5 -0
index 70f73f4858..15f2507ef2 100644
@@ -18,6 +18,7 @@ config BR2_PACKAGE_LLVM
 	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_8
 	depends on BR2_TOOLCHAIN_HAS_THREADS
 	depends on BR2_INSTALL_LIBSTDCPP
+	depends on !BR2_TOOLCHAIN_HAS_GCC_BUG_64735 # std::shared_future
 	help
 	  The LLVM Project is a collection of modular and reusable
 	  compiler and toolchain technologies.
@@ -38,3 +39,7 @@ comment "llvm needs a toolchain w/ threads, C++, gcc >= 4.8, host gcc >= 4.8"
 	depends on BR2_PACKAGE_LLVM_ARCH_SUPPORTS
 	depends on !BR2_TOOLCHAIN_HAS_THREADS || !BR2_INSTALL_LIBSTDCPP || \
 		!BR2_HOST_GCC_AT_LEAST_4_8 || !BR2_TOOLCHAIN_GCC_AT_LEAST_4_8
+
+comment "llvm needs a toolchain not affected by GCC bug 64735"
+	depends on BR2_PACKAGE_LLVM_ARCH_SUPPORTS
+	depends on BR2_TOOLCHAIN_HAS_GCC_BUG_64735
Signature · 1 line
2.14.3
#1 lore raw

PATCH 1/2 llvm: add dependency on !BR2_TOOLCHAIN_HAS_GCC_BUG_64735

Hello,

Quoted 9 lines · Thomas Petazzoni

LLVM uses std::shared_future, which until gcc 7.x isn't available on architectures that don't provide lock-free atomics, see
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64735.

Buildroot already has a BR2_TOOLCHAIN_HAS_GCC_BUG_64735 option to handle such a case, so simply add this new dependency to LLVM. It will make sure LLVM doesn't get built on ARMv5 platforms using a gcc older than 7.x.

Quoted 8 lines

Fixes:

http://autobuild.buildroot.net/results/ada497f6a8d20fa1a9adb2b17a138d7b726a6cdc/

---
 package/llvm/Config.in | 5 +++++
 1 file changed, 5 insertions(+)

Both patches applied.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com
#2 lore raw

PATCH 1/2 llvm: add dependency on !BR2_TOOLCHAIN_HAS_GCC_BUG_64735

In reply to Thomas Petazzoni

Hello Thomas,

Quoted 9 lines · Thomas Petazzoni

LLVM uses std::shared_future, which until gcc 7.x isn't available on architectures that don't provide lock-free atomics, see
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64735.

Buildroot already has a BR2_TOOLCHAIN_HAS_GCC_BUG_64735 option to handle such a case, so simply add this new dependency to LLVM. It will make sure LLVM doesn't get built on ARMv5 platforms using a gcc older than 7.x.

Quoted 5 lines

Fixes:

   http://autobuild.buildroot.net/results/ada497f6a8d20fa1a9adb2b17a138d7b726a6cdc/

The three autotests crashed because of std::shared_future,

I've found the following in: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=820535

"This looks like the kind of failure you get when your host toolchain doesn't support C++11 properly (specifically lock-free atomics in this case). When I've seen it before GCC was defaulting to a CPU that's too old to do atomics properly, and that configuration is very unlikely to be supported by LLVM ever (any more)."

I was about to send a patch to blacklist ARMv4 and ARMv5 but this should be a more appropriate solution (I was not aware of BUG_64735). I'll try to build with the defconfigs from the autobuilder applying the patch and adding a dependency on !BR2_STATIC_LIBS.

Quoted 24 lines
---
  package/llvm/Config.in | 5 +++++
  1 file changed, 5 insertions(+)
package/llvm/Config.in +5 -0
index 70f73f4858..15f2507ef2 100644
@@ -18,6 +18,7 @@ config BR2_PACKAGE_LLVM
  	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_8
  	depends on BR2_TOOLCHAIN_HAS_THREADS
  	depends on BR2_INSTALL_LIBSTDCPP
+	depends on !BR2_TOOLCHAIN_HAS_GCC_BUG_64735 # std::shared_future
  	help
  	  The LLVM Project is a collection of modular and reusable
  	  compiler and toolchain technologies.
@@ -38,3 +39,7 @@ comment "llvm needs a toolchain w/ threads, C++, gcc >= 4.8, host gcc >= 4.8"
  	depends on BR2_PACKAGE_LLVM_ARCH_SUPPORTS
  	depends on !BR2_TOOLCHAIN_HAS_THREADS || !BR2_INSTALL_LIBSTDCPP || \
  		!BR2_HOST_GCC_AT_LEAST_4_8 || !BR2_TOOLCHAIN_GCC_AT_LEAST_4_8
+
+comment "llvm needs a toolchain not affected by GCC bug 64735"
+	depends on BR2_PACKAGE_LLVM_ARCH_SUPPORTS
+	depends on BR2_TOOLCHAIN_HAS_GCC_BUG_64735
#3 lore raw

PATCH 1/2 llvm: add dependency on !BR2_TOOLCHAIN_HAS_GCC_BUG_64735

Hello,

Quoted 4 lines · Valentin Korenblit

The three autotests crashed because of std::shared_future,

I've found the following in: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=820535

Quoted 8 lines

"This looks like the kind of failure you get when your host toolchain doesn't support C++11 properly (specifically lock-free atomics in this case). When I've seen it before GCC was defaulting to a CPU that's too old to do atomics properly, and that configuration is very unlikely to be supported by LLVM ever (any more)."

I was about to send a patch to blacklist ARMv4 and ARMv5 but this should be a more appropriate solution (I was not aware of BUG_64735).

Note: I didn't test building LLVM for ARMv4/ARMv5, with a gcc 7.x compiler. But the build error itself clearly points to this gcc limitation, which has been solved in gcc 7.x.

Quoted 2 lines

I'll try to build with the defconfigs from the autobuilder applying the patch and adding a dependency on !BR2_STATIC_LIBS.

So far, there hasn't been any failure to build LLVM in static only configurations, so let's see if any shows up.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com
#4 lore raw

PATCH 2/2 mesa3d: properly propagate the dependencies of BR2_PACKAGE_LLVM

In reply to Thomas Petazzoni

We cannot simply select BR2_PACKAGE_LLVM, we need to take into account all its dependencies. BR2_PACKAGE_LLVM_ARCH_SUPPORTS was already taken into account, but not the other dependencies.

---
 package/mesa3d/Config.in | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
package/mesa3d/Config.in +14 -0
index ffe0287ac5..8f347ffe0c 100644
@@ -28,8 +28,22 @@ if BR2_PACKAGE_MESA3D
 config BR2_PACKAGE_MESA3D_LLVM
 	bool "llvm support"
 	depends on BR2_PACKAGE_LLVM_ARCH_SUPPORTS
+	depends on BR2_HOST_GCC_AT_LEAST_4_8
+	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_8
+	depends on BR2_TOOLCHAIN_HAS_THREADS
+	depends on BR2_INSTALL_LIBSTDCPP
+	depends on !BR2_TOOLCHAIN_HAS_GCC_BUG_64735 # std::shared_future
 	select BR2_PACKAGE_LLVM
 
+comment "llvm support needs a toolchain w/ threads, C++, gcc >= 4.8, host gcc >= 4.8"
+	depends on BR2_PACKAGE_LLVM_ARCH_SUPPORTS
+	depends on !BR2_TOOLCHAIN_HAS_THREADS || !BR2_INSTALL_LIBSTDCPP || \
+		!BR2_HOST_GCC_AT_LEAST_4_8 || !BR2_TOOLCHAIN_GCC_AT_LEAST_4_8
+
+comment "llvm support needs a toolchain not affected by GCC bug 64735"
+	depends on BR2_PACKAGE_LLVM_ARCH_SUPPORTS
+	depends on BR2_TOOLCHAIN_HAS_GCC_BUG_64735
+
 # inform the .mk file of gallium, dri or vulkan driver selection
 config BR2_PACKAGE_MESA3D_GALLIUM_DRIVER
 	bool
Signature · 1 line
2.14.3
#5 lore raw

PATCH 2/2 mesa3d: properly propagate the dependencies of BR2_PACKAGE_LLVM

Hello Thomas,

Quoted 5 lines · Thomas Petazzoni

We cannot simply select BR2_PACKAGE_LLVM, we need to take into account all its dependencies. BR2_PACKAGE_LLVM_ARCH_SUPPORTS was already taken into account, but not the other dependencies.

I was preparing that, I did the same for Clang too. I think I'll send a new version next week.

Quoted 21 lines
---
  package/mesa3d/Config.in | 14 ++++++++++++++
  1 file changed, 14 insertions(+)
package/mesa3d/Config.in +7 -0
index ffe0287ac5..8f347ffe0c 100644
@@ -28,8 +28,22 @@ if BR2_PACKAGE_MESA3D
  config BR2_PACKAGE_MESA3D_LLVM
  	bool "llvm support"
  	depends on BR2_PACKAGE_LLVM_ARCH_SUPPORTS
+	depends on BR2_HOST_GCC_AT_LEAST_4_8
+	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_8
+	depends on BR2_TOOLCHAIN_HAS_THREADS
+	depends on BR2_INSTALL_LIBSTDCPP
+	depends on !BR2_TOOLCHAIN_HAS_GCC_BUG_64735 # std::shared_future
  	select BR2_PACKAGE_LLVM
 
+comment "llvm support needs a toolchain w/ threads, C++, gcc >= 4.8, host gcc >= 4.8"
+	depends on BR2_PACKAGE_LLVM_ARCH_SUPPORTS

package/mesa3d/Config.in if BR2_PACKAGE_MESA3D · line 49

Quoted 10 lines
package/mesa3d/Config.in +7 -0
+	depends on !BR2_TOOLCHAIN_HAS_THREADS || !BR2_INSTALL_LIBSTDCPP || \
+		!BR2_HOST_GCC_AT_LEAST_4_8 || !BR2_TOOLCHAIN_GCC_AT_LEAST_4_8
+
+comment "llvm support needs a toolchain not affected by GCC bug 64735"
+	depends on BR2_PACKAGE_LLVM_ARCH_SUPPORTS
+	depends on BR2_TOOLCHAIN_HAS_GCC_BUG_64735
+
  # inform the .mk file of gallium, dri or vulkan driver selection
  config BR2_PACKAGE_MESA3D_GALLIUM_DRIVER
  	bool

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20180406/950076bf/attachment.html>