All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v12 01/11] package/llvm: bump to version 11.1.0
@ 2022-03-22 23:22 James Hilliard
  2022-03-22 23:22 ` [Buildroot] [PATCH v12 02/11] package/clang: " James Hilliard
                   ` (10 more replies)
  0 siblings, 11 replies; 22+ messages in thread
From: James Hilliard @ 2022-03-22 23:22 UTC (permalink / raw)
  To: buildroot
  Cc: Joseph Kogut, Bernd Kuhls, Matt Weber, Samuel Martin,
	James Hilliard, Thomas Petazzoni, Romain Naour, Matt Weber,
	Valentin Korenblit

From: Matt Weber <matthew.weber@rockwellcollins.com>

Signed-off-by: Matthew Weber <matthew.weber@rockwellcollins.com>
Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
---
Changes v11 -> v12:
  - add gcc 5 dependency due to c++14 requirement
  - propagate gcc 5 reverse dependency
  - remove unsupported config options
---
 package/clang/Config.in  |  6 +++---
 package/llvm/Config.in   |  6 +++---
 package/llvm/llvm.hash   |  2 +-
 package/llvm/llvm.mk     | 20 ++++++--------------
 package/mesa3d/Config.in |  6 +++---
 5 files changed, 16 insertions(+), 24 deletions(-)

diff --git a/package/clang/Config.in b/package/clang/Config.in
index a67e7631a8..7c732c7af7 100644
--- a/package/clang/Config.in
+++ b/package/clang/Config.in
@@ -1,7 +1,7 @@
 config BR2_PACKAGE_CLANG
 	bool "clang"
 	depends on BR2_PACKAGE_LLVM_ARCH_SUPPORTS
-	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_8
+	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_5
 	depends on BR2_TOOLCHAIN_HAS_THREADS
 	depends on BR2_INSTALL_LIBSTDCPP
 	depends on !BR2_TOOLCHAIN_HAS_GCC_BUG_64735 # std::shared_future
@@ -14,10 +14,10 @@ config BR2_PACKAGE_CLANG
 
 	  http://clang.llvm.org
 
-comment "clang needs a toolchain w/ wchar, threads, C++, gcc >= 4.8, dynamic library"
+comment "clang needs a toolchain w/ wchar, threads, C++, gcc >= 5, dynamic library"
 	depends on BR2_PACKAGE_LLVM_ARCH_SUPPORTS
 	depends on !BR2_TOOLCHAIN_HAS_THREADS || !BR2_INSTALL_LIBSTDCPP || \
-		!BR2_TOOLCHAIN_GCC_AT_LEAST_4_8 \
+		!BR2_TOOLCHAIN_GCC_AT_LEAST_5 \
 		|| BR2_STATIC_LIBS || !BR2_USE_WCHAR
 
 comment "clang needs a toolchain not affected by GCC bug 64735"
diff --git a/package/llvm/Config.in b/package/llvm/Config.in
index 6ec2ffcfe6..c1887e36dd 100644
--- a/package/llvm/Config.in
+++ b/package/llvm/Config.in
@@ -14,7 +14,7 @@ config BR2_PACKAGE_LLVM_TARGET_ARCH
 config BR2_PACKAGE_LLVM
 	bool "llvm"
 	depends on BR2_PACKAGE_LLVM_ARCH_SUPPORTS
-	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_8
+	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_5
 	depends on BR2_TOOLCHAIN_HAS_THREADS
 	depends on BR2_INSTALL_LIBSTDCPP
 	depends on !BR2_TOOLCHAIN_HAS_GCC_BUG_64735 # std::shared_future
@@ -55,10 +55,10 @@ config BR2_PACKAGE_LLVM_BPF
 
 endif
 
-comment "llvm needs a toolchain w/ wchar, threads, C++, gcc >= 4.8, dynamic library"
+comment "llvm needs a toolchain w/ wchar, threads, C++, gcc >= 5, dynamic library"
 	depends on BR2_PACKAGE_LLVM_ARCH_SUPPORTS
 	depends on !BR2_TOOLCHAIN_HAS_THREADS || !BR2_INSTALL_LIBSTDCPP || \
-		!BR2_TOOLCHAIN_GCC_AT_LEAST_4_8 \
+		!BR2_TOOLCHAIN_GCC_AT_LEAST_5 \
 		|| BR2_STATIC_LIBS || !BR2_USE_WCHAR
 
 comment "llvm needs a toolchain not affected by GCC bug 64735"
diff --git a/package/llvm/llvm.hash b/package/llvm/llvm.hash
index 6bf2755777..e93a922492 100644
--- a/package/llvm/llvm.hash
+++ b/package/llvm/llvm.hash
@@ -1,3 +1,3 @@
 # locally calculated
-sha256 00a1ee1f389f81e9979f3a640a01c431b3021de0d42278f6508391a2f0b81c9a llvm-9.0.1.src.tar.xz
+sha256 ce8508e318a01a63d4e8b3090ab2ded3c598a50258cc49e2625b9120d4c03ea5 llvm-11.1.0.src.tar.xz
 sha256 8d85c1057d742e597985c7d4e6320b015a9139385cff4cbae06ffc0ebe89afee LICENSE.TXT
diff --git a/package/llvm/llvm.mk b/package/llvm/llvm.mk
index 6c721c30b9..825de96392 100644
--- a/package/llvm/llvm.mk
+++ b/package/llvm/llvm.mk
@@ -5,7 +5,7 @@
 ################################################################################
 
 # LLVM, Clang and lld should be version bumped together
-LLVM_VERSION = 9.0.1
+LLVM_VERSION = 11.1.0
 LLVM_SITE = https://github.com/llvm/llvm-project/releases/download/llvmorg-$(LLVM_VERSION)
 LLVM_SOURCE = llvm-$(LLVM_VERSION).src.tar.xz
 LLVM_LICENSE = Apache-2.0 with exceptions
@@ -157,15 +157,9 @@ LLVM_CONF_OPTS += -DLLVM_ENABLE_PIC=ON
 HOST_LLVM_CONF_OPTS += -DCMAKE_BUILD_TYPE=Release
 LLVM_CONF_OPTS += -DCMAKE_BUILD_TYPE=Release
 
-# Disable C++1y (ISO C++ 2014 standard)
-# Disable C++1z (ISO C++ 2017 standard)
-# Compile llvm with the C++11 (ISO C++ 2011 standard) which is the fallback.
-HOST_LLVM_CONF_OPTS += \
-	-DLLVM_ENABLE_CXX1Y=OFF \
-	-DLLVM_ENABLE_CXX1Z=OFF
-LLVM_CONF_OPTS += \
-	-DLLVM_ENABLE_CXX1Y=OFF \
-	-DLLVM_ENABLE_CXX1Z=OFF
+# Compile llvm with the C++14 (ISO C++ 2014 standard).
+HOST_LLVM_CONF_OPTS += -DCMAKE_CXX_STANDARD=14
+LLVM_CONF_OPTS += -DCMAKE_CXX_STANDARD=14
 
 # Disabled, requires sys/ndir.h header
 # Disable debug in module
@@ -237,13 +231,11 @@ endif
 HOST_LLVM_CONF_OPTS += \
 	-DLLVM_BUILD_EXTERNAL_COMPILER_RT=OFF \
 	-DLLVM_BUILD_RUNTIME=OFF \
-	-DLLVM_INCLUDE_RUNTIMES=OFF \
-	-DLLVM_POLLY_BUILD=OFF
+	-DLLVM_INCLUDE_RUNTIMES=OFF
 LLVM_CONF_OPTS += \
 	-DLLVM_BUILD_EXTERNAL_COMPILER_RT=OFF \
 	-DLLVM_BUILD_RUNTIME=OFF \
-	-DLLVM_INCLUDE_RUNTIMES=OFF \
-	-DLLVM_POLLY_BUILD=OFF
+	-DLLVM_INCLUDE_RUNTIMES=OFF
 
 HOST_LLVM_CONF_OPTS += \
 	-DLLVM_ENABLE_WARNINGS=ON \
diff --git a/package/mesa3d/Config.in b/package/mesa3d/Config.in
index e41da562dc..b0ebc09212 100644
--- a/package/mesa3d/Config.in
+++ b/package/mesa3d/Config.in
@@ -24,7 +24,7 @@ config BR2_PACKAGE_MESA3D_NEEDS_ELFUTILS
 config BR2_PACKAGE_MESA3D_LLVM
 	bool "llvm support"
 	depends on BR2_PACKAGE_LLVM_ARCH_SUPPORTS
-	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_8
+	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_5
 	depends on BR2_TOOLCHAIN_HAS_THREADS
 	depends on BR2_INSTALL_LIBSTDCPP
 	depends on !BR2_TOOLCHAIN_HAS_GCC_BUG_64735 # std::shared_future
@@ -32,10 +32,10 @@ config BR2_PACKAGE_MESA3D_LLVM
 	depends on BR2_USE_WCHAR # std::wstring
 	select BR2_PACKAGE_LLVM
 
-comment "llvm support needs a toolchain w/ wchar, threads, C++, gcc >= 4.8, dynamic library"
+comment "llvm support needs a toolchain w/ wchar, threads, C++, gcc >= 5, dynamic library"
 	depends on BR2_PACKAGE_LLVM_ARCH_SUPPORTS
 	depends on !BR2_TOOLCHAIN_HAS_THREADS || !BR2_INSTALL_LIBSTDCPP || \
-		!BR2_TOOLCHAIN_GCC_AT_LEAST_4_8 \
+		!BR2_TOOLCHAIN_GCC_AT_LEAST_5 \
 		|| BR2_STATIC_LIBS || !BR2_USE_WCHAR
 
 comment "llvm support needs a toolchain not affected by GCC bug 64735"
-- 
2.25.1

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

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

* [Buildroot] [PATCH v12 02/11] package/clang: bump to version 11.1.0
  2022-03-22 23:22 [Buildroot] [PATCH v12 01/11] package/llvm: bump to version 11.1.0 James Hilliard
@ 2022-03-22 23:22 ` James Hilliard
  2022-03-22 23:22 ` [Buildroot] [PATCH v12 03/11] package/lld: " James Hilliard
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 22+ messages in thread
From: James Hilliard @ 2022-03-22 23:22 UTC (permalink / raw)
  To: buildroot
  Cc: Joseph Kogut, Bernd Kuhls, Matt Weber, Samuel Martin,
	Thomas Petazzoni, Romain Naour, Matt Weber, Valentin Korenblit

From: Matt Weber <matthew.weber@rockwellcollins.com>

Signed-off-by: Matthew Weber <matthew.weber@rockwellcollins.com>
---
 package/clang/clang.hash | 2 +-
 package/clang/clang.mk   | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/package/clang/clang.hash b/package/clang/clang.hash
index 067a2c0470..32a19c1659 100644
--- a/package/clang/clang.hash
+++ b/package/clang/clang.hash
@@ -1,3 +1,3 @@
 # locally calculated
-sha256 5778512b2e065c204010f88777d44b95250671103e434f9dc7363ab2e3804253 clang-9.0.1.src.tar.xz
+sha256 0a8288f065d1f57cb6d96da4d2965cbea32edc572aa972e466e954d17148558b clang-11.1.0.src.tar.xz
 sha256 ebcd9bbf783a73d05c53ba4d586b8d5813dcdf3bbec50265860ccc885e606f47 LICENSE.TXT
diff --git a/package/clang/clang.mk b/package/clang/clang.mk
index 939f000cbd..d1667d79b6 100644
--- a/package/clang/clang.mk
+++ b/package/clang/clang.mk
@@ -5,7 +5,8 @@
 ################################################################################
 
 # LLVM, Clang and lld should be version bumped together
-CLANG_VERSION = 9.0.1
+CLANG_VERSION_MAJOR = 11
+CLANG_VERSION = $(CLANG_VERSION_MAJOR).1.0
 CLANG_SITE = https://github.com/llvm/llvm-project/releases/download/llvmorg-$(CLANG_VERSION)
 CLANG_SOURCE = clang-$(CLANG_VERSION).src.tar.xz
 CLANG_LICENSE = Apache-2.0 with exceptions
-- 
2.25.1

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

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

* [Buildroot] [PATCH v12 03/11] package/lld: bump to version 11.1.0
  2022-03-22 23:22 [Buildroot] [PATCH v12 01/11] package/llvm: bump to version 11.1.0 James Hilliard
  2022-03-22 23:22 ` [Buildroot] [PATCH v12 02/11] package/clang: " James Hilliard
@ 2022-03-22 23:22 ` James Hilliard
  2022-03-22 23:22 ` [Buildroot] [PATCH v12 04/11] package/spirv-llvm-translator: new package James Hilliard
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 22+ messages in thread
From: James Hilliard @ 2022-03-22 23:22 UTC (permalink / raw)
  To: buildroot
  Cc: Joseph Kogut, Bernd Kuhls, Matt Weber, Samuel Martin,
	Thomas Petazzoni, Romain Naour, Matt Weber, Valentin Korenblit

From: Matt Weber <matthew.weber@rockwellcollins.com>

---
 package/lld/lld.hash | 2 +-
 package/lld/lld.mk   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/package/lld/lld.hash b/package/lld/lld.hash
index 2144cc5666..17b8d18997 100644
--- a/package/lld/lld.hash
+++ b/package/lld/lld.hash
@@ -1,3 +1,3 @@
 # locally calculated
-sha256 86262bad3e2fd784ba8c5e2158d7aa36f12b85f2515e95bc81d65d75bb9b0c82  lld-9.0.1.src.tar.xz
+sha256 017a788cbe1ecc4a949abf10755870519086d058a2e99f438829aef24f0c66ce  lld-11.1.0.src.tar.xz
 sha256 f7891568956e34643eb6a0db1462db30820d40d7266e2a78063f2fe233ece5a0  LICENSE.TXT
diff --git a/package/lld/lld.mk b/package/lld/lld.mk
index cd1a03c1d3..4bf903cda0 100644
--- a/package/lld/lld.mk
+++ b/package/lld/lld.mk
@@ -5,7 +5,7 @@
 ################################################################################
 
 # LLVM, Clang and lld should be version bumped together
-LLD_VERSION = 9.0.1
+LLD_VERSION = 11.1.0
 LLD_SITE = https://github.com/llvm/llvm-project/releases/download/llvmorg-$(LLD_VERSION)
 LLD_SOURCE = lld-$(LLD_VERSION).src.tar.xz
 LLD_LICENSE = Apache-2.0 with exceptions
-- 
2.25.1

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

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

* [Buildroot] [PATCH v12 04/11] package/spirv-llvm-translator: new package
  2022-03-22 23:22 [Buildroot] [PATCH v12 01/11] package/llvm: bump to version 11.1.0 James Hilliard
  2022-03-22 23:22 ` [Buildroot] [PATCH v12 02/11] package/clang: " James Hilliard
  2022-03-22 23:22 ` [Buildroot] [PATCH v12 03/11] package/lld: " James Hilliard
@ 2022-03-22 23:22 ` James Hilliard
  2022-06-20 19:01   ` Arnout Vandecappelle
  2022-03-22 23:22 ` [Buildroot] [PATCH v12 05/11] support/misc/toolchainfile.cmake.in: allow variables to be overridden James Hilliard
                   ` (7 subsequent siblings)
  10 siblings, 1 reply; 22+ messages in thread
From: James Hilliard @ 2022-03-22 23:22 UTC (permalink / raw)
  To: buildroot
  Cc: Joseph Kogut, Bernd Kuhls, Samuel Martin, James Hilliard,
	Thomas Petazzoni, Romain Naour, Matt Weber, Valentin Korenblit

Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
---
 .../spirv-llvm-translator.hash                 |  3 +++
 .../spirv-llvm-translator.mk                   | 18 ++++++++++++++++++
 2 files changed, 21 insertions(+)
 create mode 100644 package/spirv-llvm-translator/spirv-llvm-translator.hash
 create mode 100644 package/spirv-llvm-translator/spirv-llvm-translator.mk

diff --git a/package/spirv-llvm-translator/spirv-llvm-translator.hash b/package/spirv-llvm-translator/spirv-llvm-translator.hash
new file mode 100644
index 0000000000..e6f9de3cad
--- /dev/null
+++ b/package/spirv-llvm-translator/spirv-llvm-translator.hash
@@ -0,0 +1,3 @@
+# locally calculated
+sha256  a121579379ac3c7b63294b5274e0c4787b76003c89f7702a651384c3915464e9  spirv-llvm-translator-llvm_release_110.tar.gz
+sha256  e3bc36440fc927c62d5cc24efeefe225a14d4e34ffeb0c92e430625cce9ee444  LICENSE.TXT
diff --git a/package/spirv-llvm-translator/spirv-llvm-translator.mk b/package/spirv-llvm-translator/spirv-llvm-translator.mk
new file mode 100644
index 0000000000..fcc482027c
--- /dev/null
+++ b/package/spirv-llvm-translator/spirv-llvm-translator.mk
@@ -0,0 +1,18 @@
+################################################################################
+#
+# spirv-llvm-translator
+#
+################################################################################
+
+SPIRV_LLVM_TRANSLATOR_VERSION = llvm_release_110
+SPIRV_LLVM_TRANSLATOR_SITE = $(call github,KhronosGroup,SPIRV-LLVM-Translator,$(SPIRV_LLVM_TRANSLATOR_VERSION))
+SPIRV_LLVM_TRANSLATOR_LICENSE = Apache-2.0 with exceptions
+SPIRV_LLVM_TRANSLATOR_LICENSE_FILES = LICENSE.TXT
+HOST_SPIRV_LLVM_TRANSLATOR_DEPENDENCIES = host-clang host-llvm
+HOST_SPIRV_LLVM_TRANSLATOR_CONF_OPTS = \
+	-DLLVM_BUILD_TOOLS=ON \
+	-DLLVM_DIR=$(HOST_DIR)/lib/cmake/llvm \
+	-DLLVM_SPIRV_BUILD_EXTERNAL=YES \
+	-DLLVM_SPIRV_INCLUDE_TESTS=OFF
+
+$(eval $(host-cmake-package))
-- 
2.25.1

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

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

* [Buildroot] [PATCH v12 05/11] support/misc/toolchainfile.cmake.in: allow variables to be overridden
  2022-03-22 23:22 [Buildroot] [PATCH v12 01/11] package/llvm: bump to version 11.1.0 James Hilliard
                   ` (2 preceding siblings ...)
  2022-03-22 23:22 ` [Buildroot] [PATCH v12 04/11] package/spirv-llvm-translator: new package James Hilliard
@ 2022-03-22 23:22 ` James Hilliard
  2022-03-31 20:38   ` Romain Naour
  2022-03-22 23:22 ` [Buildroot] [PATCH v12 06/11] package/libclc: bump version to 13.0.1 James Hilliard
                   ` (6 subsequent siblings)
  10 siblings, 1 reply; 22+ messages in thread
From: James Hilliard @ 2022-03-22 23:22 UTC (permalink / raw)
  To: buildroot
  Cc: Joseph Kogut, Bernd Kuhls, Samuel Martin, James Hilliard,
	Thomas Petazzoni, Romain Naour, Matt Weber, Valentin Korenblit

Some packages such as libclc need to override cmake toolchain
variables, to avoid errors caused by trying to set overriden
variables ensure that they are not defined before being set.

This prevents difficult to debug silent dropping of overriden
variables.

Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
---
 support/misc/toolchainfile.cmake.in | 108 +++++++++++++++++++++-------
 1 file changed, 81 insertions(+), 27 deletions(-)

diff --git a/support/misc/toolchainfile.cmake.in b/support/misc/toolchainfile.cmake.in
index be575566a4..30c0e63bf2 100644
--- a/support/misc/toolchainfile.cmake.in
+++ b/support/misc/toolchainfile.cmake.in
@@ -14,9 +14,15 @@ string(REPLACE "/share/buildroot" "" RELOCATED_HOST_DIR ${CMAKE_CURRENT_LIST_DIR
 # so that it can find our custom platform description.
 list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR})
 
-set(CMAKE_SYSTEM_NAME Buildroot)
-set(CMAKE_SYSTEM_VERSION 1)
-set(CMAKE_SYSTEM_PROCESSOR @@CMAKE_SYSTEM_PROCESSOR@@)
+if(NOT DEFINED CMAKE_SYSTEM_NAME)
+  set(CMAKE_SYSTEM_NAME Buildroot)
+endif()
+if(NOT DEFINED CMAKE_SYSTEM_VERSION)
+  set(CMAKE_SYSTEM_VERSION 1)
+endif()
+if(NOT DEFINED CMAKE_SYSTEM_PROCESSOR)
+  set(CMAKE_SYSTEM_PROCESSOR @@CMAKE_SYSTEM_PROCESSOR@@)
+endif()
 
 # Set the {C,CXX}FLAGS appended by CMake depending on the build type
 # defined by Buildroot. CMake defaults these variables with -g and/or
@@ -28,11 +34,17 @@ set(CMAKE_SYSTEM_PROCESSOR @@CMAKE_SYSTEM_PROCESSOR@@)
 # Note:
 #   if the project forces some of these flag variables, Buildroot is
 #   screwed up and there is nothing Buildroot can do about that :(
-set(CMAKE_C_FLAGS_DEBUG "" CACHE STRING "Debug CFLAGS")
-set(CMAKE_C_FLAGS_RELEASE " -DNDEBUG" CACHE STRING "Release CFLAGS")
+if(NOT DEFINED CMAKE_C_FLAGS_DEBUG)
+  set(CMAKE_C_FLAGS_DEBUG "" CACHE STRING "Debug CFLAGS")
+endif()
+if(NOT DEFINED CMAKE_C_FLAGS_RELEASE)
+  set(CMAKE_C_FLAGS_RELEASE " -DNDEBUG" CACHE STRING "Release CFLAGS")
+endif()
 
 # Build type from the Buildroot configuration
-set(CMAKE_BUILD_TYPE @@CMAKE_BUILD_TYPE@@ CACHE STRING "Buildroot build configuration")
+if(NOT DEFINED CMAKE_BUILD_TYPE)
+  set(CMAKE_BUILD_TYPE @@CMAKE_BUILD_TYPE@@ CACHE STRING "Buildroot build configuration")
+endif()
 
 # Buildroot defaults flags.
 # If you are using this toolchainfile.cmake file outside of Buildroot and
@@ -41,33 +53,75 @@ set(CMAKE_BUILD_TYPE @@CMAKE_BUILD_TYPE@@ CACHE STRING "Buildroot build configur
 #     cmake -DCMAKE_C_FLAGS="@@TARGET_CFLAGS@@ -Dsome_custom_flag" ...
 # * and make sure the project's CMake code extends them like this if needed:
 #     set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Dsome_definitions")
-set(CMAKE_C_FLAGS "@@TARGET_CFLAGS@@" CACHE STRING "Buildroot CFLAGS")
-set(CMAKE_EXE_LINKER_FLAGS "@@TARGET_LDFLAGS@@" CACHE STRING "Buildroot LDFLAGS for executables")
-set(CMAKE_SHARED_LINKER_FLAGS "@@TARGET_LDFLAGS@@" CACHE STRING "Buildroot LDFLAGS for shared libraries")
-set(CMAKE_MODULE_LINKER_FLAGS "@@TARGET_LDFLAGS@@" CACHE STRING "Buildroot LDFLAGS for module libraries")
+if(NOT DEFINED CMAKE_C_FLAGS)
+  set(CMAKE_C_FLAGS "@@TARGET_CFLAGS@@" CACHE STRING "Buildroot CFLAGS")
+endif()
+if(NOT DEFINED CMAKE_EXE_LINKER_FLAGS)
+  set(CMAKE_EXE_LINKER_FLAGS "@@TARGET_LDFLAGS@@" CACHE STRING "Buildroot LDFLAGS for executables")
+endif()
+if(NOT DEFINED CMAKE_SHARED_LINKER_FLAGS)
+  set(CMAKE_SHARED_LINKER_FLAGS "@@TARGET_LDFLAGS@@" CACHE STRING "Buildroot LDFLAGS for shared libraries")
+endif()
+if(NOT DEFINED CMAKE_MODULE_LINKER_FLAGS)
+  set(CMAKE_MODULE_LINKER_FLAGS "@@TARGET_LDFLAGS@@" CACHE STRING "Buildroot LDFLAGS for module libraries")
+endif()
 
-set(CMAKE_INSTALL_SO_NO_EXE 0)
+if(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE)
+  set(CMAKE_INSTALL_SO_NO_EXE 0)
+endif()
 
-set(CMAKE_PROGRAM_PATH "${RELOCATED_HOST_DIR}/bin")
-set(CMAKE_SYSROOT "${RELOCATED_HOST_DIR}/@@STAGING_SUBDIR@@")
-set(CMAKE_FIND_ROOT_PATH "${RELOCATED_HOST_DIR}/@@STAGING_SUBDIR@@")
-set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
-set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
-set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
-set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
+if(NOT DEFINED CMAKE_PROGRAM_PATH)
+  set(CMAKE_PROGRAM_PATH "${RELOCATED_HOST_DIR}/bin")
+endif()
+if(NOT DEFINED CMAKE_SYSROOT)
+  set(CMAKE_SYSROOT "${RELOCATED_HOST_DIR}/@@STAGING_SUBDIR@@")
+endif()
+if(NOT DEFINED CMAKE_FIND_ROOT_PATH)
+  set(CMAKE_FIND_ROOT_PATH "${RELOCATED_HOST_DIR}/@@STAGING_SUBDIR@@")
+endif()
+if(NOT DEFINED CMAKE_FIND_ROOT_PATH_MODE_PROGRAM)
+  set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
+endif()
+if(NOT DEFINED CMAKE_FIND_ROOT_PATH_MODE_PACKAGE)
+  set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
+endif()
+if(NOT DEFINED CMAKE_FIND_ROOT_PATH_MODE_LIBRARY)
+  set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
+endif()
+if(NOT DEFINED CMAKE_FIND_ROOT_PATH_MODE_INCLUDE)
+  set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
+endif()
 set(ENV{PKG_CONFIG_SYSROOT_DIR} "${RELOCATED_HOST_DIR}/@@STAGING_SUBDIR@@")
 
 # This toolchain file can be used both inside and outside Buildroot.
-set(CMAKE_C_COMPILER "${RELOCATED_HOST_DIR}/@@TARGET_CC@@")
+if(NOT DEFINED CMAKE_C_COMPILER)
+  set(CMAKE_C_COMPILER "${RELOCATED_HOST_DIR}/@@TARGET_CC@@")
+endif()
 if(@@TOOLCHAIN_HAS_CXX@@)
-  set(CMAKE_CXX_FLAGS_DEBUG "" CACHE STRING "Debug CXXFLAGS")
-  set(CMAKE_CXX_FLAGS_RELEASE " -DNDEBUG" CACHE STRING "Release CXXFLAGS")
-  set(CMAKE_CXX_FLAGS "@@TARGET_CXXFLAGS@@" CACHE STRING "Buildroot CXXFLAGS")
-  set(CMAKE_CXX_COMPILER "${RELOCATED_HOST_DIR}/@@TARGET_CXX@@")
+  if(NOT DEFINED CMAKE_CXX_FLAGS_DEBUG)
+    set(CMAKE_CXX_FLAGS_DEBUG "" CACHE STRING "Debug CXXFLAGS")
+  endif()
+  if(NOT DEFINED CMAKE_CXX_FLAGS_RELEASE)
+    set(CMAKE_CXX_FLAGS_RELEASE " -DNDEBUG" CACHE STRING "Release CXXFLAGS")
+  endif()
+  if(NOT DEFINED CMAKE_CXX_FLAGS)
+    set(CMAKE_CXX_FLAGS "@@TARGET_CXXFLAGS@@" CACHE STRING "Buildroot CXXFLAGS")
+  endif()
+  if(NOT DEFINED CMAKE_CXX_COMPILER)
+    set(CMAKE_CXX_COMPILER "${RELOCATED_HOST_DIR}/@@TARGET_CXX@@")
+  endif()
 endif()
 if(@@TOOLCHAIN_HAS_FORTRAN@@)
-  set(CMAKE_Fortran_FLAGS_DEBUG "" CACHE STRING "Debug Fortran FLAGS")
-  set(CMAKE_Fortran_FLAGS_RELEASE " -DNDEBUG" CACHE STRING "Release Fortran FLAGS")
-  set(CMAKE_Fortran_FLAGS "@@TARGET_FCFLAGS@@" CACHE STRING "Buildroot FCFLAGS")
-  set(CMAKE_Fortran_COMPILER "${RELOCATED_HOST_DIR}/@@TARGET_FC@@")
+  if(NOT DEFINED CMAKE_Fortran_FLAGS_DEBUG)
+    set(CMAKE_Fortran_FLAGS_DEBUG "" CACHE STRING "Debug Fortran FLAGS")
+  endif()
+  if(NOT DEFINED CMAKE_Fortran_FLAGS_RELEASE)
+    set(CMAKE_Fortran_FLAGS_RELEASE " -DNDEBUG" CACHE STRING "Release Fortran FLAGS")
+  endif()
+  if(NOT DEFINED CMAKE_Fortran_FLAGS)
+    set(CMAKE_Fortran_FLAGS "@@TARGET_FCFLAGS@@" CACHE STRING "Buildroot FCFLAGS")
+  endif()
+  if(NOT DEFINED CMAKE_Fortran_COMPILER)
+    set(CMAKE_Fortran_COMPILER "${RELOCATED_HOST_DIR}/@@TARGET_FC@@")
+  endif()
 endif()
-- 
2.25.1

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

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

* [Buildroot] [PATCH v12 06/11] package/libclc: bump version to 13.0.1
  2022-03-22 23:22 [Buildroot] [PATCH v12 01/11] package/llvm: bump to version 11.1.0 James Hilliard
                   ` (3 preceding siblings ...)
  2022-03-22 23:22 ` [Buildroot] [PATCH v12 05/11] support/misc/toolchainfile.cmake.in: allow variables to be overridden James Hilliard
@ 2022-03-22 23:22 ` James Hilliard
  2022-03-31 20:50   ` Romain Naour
  2022-03-22 23:22 ` [Buildroot] [PATCH v12 07/11] package/compiler-rt: new package James Hilliard
                   ` (5 subsequent siblings)
  10 siblings, 1 reply; 22+ messages in thread
From: James Hilliard @ 2022-03-22 23:22 UTC (permalink / raw)
  To: buildroot
  Cc: Joseph Kogut, Bernd Kuhls, Matt Weber, Samuel Martin,
	James Hilliard, Thomas Petazzoni, Romain Naour, Matt Weber,
	Valentin Korenblit

From: Matt Weber <matthew.weber@rockwellcollins.com>

* Converts to the cmake pkg type
 * Updates download site
 * Adds a crosscompile fixups patch
   * Allow prepare_builtins utility to be directly called
     (it isn't installed into the path when cross compiling)
   * Fix file_find() for root search limitation

Signed-off-by: Matthew Weber <matthew.weber@rockwellcollins.com>
Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
---
Changes v11 -> v12:
  - update to 13.0.1 instead of 11.1.0
  - pass required host cmake options for C/CXX compilers
---
 .../0001-support-out-of-tree-build.patch      | 71 +++++++++++++++++++
 package/libclc/libclc.hash                    |  2 +-
 package/libclc/libclc.mk                      | 56 +++++++--------
 3 files changed, 98 insertions(+), 31 deletions(-)
 create mode 100644 package/libclc/0001-support-out-of-tree-build.patch

diff --git a/package/libclc/0001-support-out-of-tree-build.patch b/package/libclc/0001-support-out-of-tree-build.patch
new file mode 100644
index 0000000000..de7207bedb
--- /dev/null
+++ b/package/libclc/0001-support-out-of-tree-build.patch
@@ -0,0 +1,71 @@
+From 495491e9d53bfb184c15753b5187e4bb55b19511 Mon Sep 17 00:00:00 2001
+From: Matt Weber <matthew.weber@rockwellcollins.com>
+Date: Tue, 9 Mar 2021 15:55:17 -0600
+Subject: [PATCH] support out of tree build
+
+(1) The package has a prepare_builtins tool which is built
+but not placed in the path for later use in the build. This
+fix allows the later build steps to use the binary in-place.
+
+(2) With cmake, find_file() when used for non-host builds is
+limited by CMAKE_FIND_ROOT_PATH* scope.
+
+In $(HOST_DIR)/share/buildroot/toolchainfile.cmake we set the
+following target settings for CMAKE_FIND_ROOT_PATH* which
+limit the scope.
+set(CMAKE_FIND_ROOT_PATH "${RELOCATED_HOST_DIR}/aarch64-buildroot-linux-gnu/sysroot")
+set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
+set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
+set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
+set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
+
+
+Signed-off-by: Matthew Weber <matthew.weber@rockwellcollins.com>
+---
+ CMakeLists.txt                          | 2 +-
+ cmake/CMakeDetermineCLCCompiler.cmake   | 4 ++++
+ cmake/CMakeDetermineLLAsmCompiler.cmake | 4 ++++
+ 3 files changed, 9 insertions(+), 1 deletion(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 9472f19..a784519 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -279,7 +279,7 @@ foreach( t ${LIBCLC_TARGETS_TO_BUILD} )
+ 
+			# Add prepare target
+			add_custom_command( OUTPUT "${obj_suffix}"
+-				            COMMAND prepare_builtins -o
++				            COMMAND ./prepare_builtins -o
+					    "${obj_suffix}"
+					    "builtins.opt.${obj_suffix}"
+					    DEPENDS "opt.${obj_suffix}"
+diff --git a/cmake/CMakeDetermineCLCCompiler.cmake b/cmake/CMakeDetermineCLCCompiler.cmake
+index 94d85d9..5de6a48 100644
+--- a/cmake/CMakeDetermineCLCCompiler.cmake
++++ b/cmake/CMakeDetermineCLCCompiler.cmake
+@@ -12,7 +12,7 @@ mark_as_advanced(CMAKE_CLC_ARCHIVE)
+ 
+ set(CMAKE_CLC_COMPILER_ENV_VAR "CLC_COMPILER")
+ set(CMAKE_CLC_ARCHIVE_ENV_VAR "CLC_LINKER")
+-find_file(clc_comp_in CMakeCLCCompiler.cmake.in PATHS ${CMAKE_ROOT}/Modules ${CMAKE_MODULE_PATH})
++set(clc_comp_in "${CMAKE_MODULE_PATH}/CMakeCLCCompiler.cmake.in" )
+ # configure all variables set in this file
+ configure_file(${clc_comp_in} ${CMAKE_PLATFORM_INFO_DIR}/CMakeCLCCompiler.cmake @ONLY)
+ mark_as_advanced(clc_comp_in)
+diff --git a/cmake/CMakeDetermineLLAsmCompiler.cmake b/cmake/CMakeDetermineLLAsmCompiler.cmake
+index 1c424c7..dd3bfb6 100644
+--- a/cmake/CMakeDetermineLLAsmCompiler.cmake
++++ b/cmake/CMakeDetermineLLAsmCompiler.cmake
+@@ -18,7 +18,7 @@ mark_as_advanced(CMAKE_LLAsm_ARCHIVE)
+ set(CMAKE_LLAsm_PREPROCESSOR_ENV_VAR "LL_PREPROCESSOR")
+ set(CMAKE_LLAsm_COMPILER_ENV_VAR "LL_ASSEMBLER")
+ set(CMAKE_LLAsm_ARCHIVE_ENV_VAR "LL_LINKER")
+-find_file(ll_comp_in CMakeLLAsmCompiler.cmake.in PATHS ${CMAKE_ROOT}/Modules ${CMAKE_MODULE_PATH})
++set(ll_comp_in "${CMAKE_MODULE_PATH}/CMakeLLAsmCompiler.cmake.in" )
+ # configure all variables set in this file
+ configure_file(${ll_comp_in} ${CMAKE_PLATFORM_INFO_DIR}/CMakeLLAsmCompiler.cmake @ONLY)
+ mark_as_advanced(ll_comp_in)
+-- 
+2.17.1
+
diff --git a/package/libclc/libclc.hash b/package/libclc/libclc.hash
index 2af64bc8e8..c496291d81 100644
--- a/package/libclc/libclc.hash
+++ b/package/libclc/libclc.hash
@@ -1,3 +1,3 @@
 # locally calculated
-sha256  54d7ae523aabf68d533011739d6c01546cae0c294442d0f44fd657c046cb707d  libclc-d1cbc92e2ceee59963f5c3a576382e5bba31f060-br1.tar.gz
+sha256  8f0213e52e2fcaca3dfcc438f05d0e15e9b3c96fd6b0994a802b267dc1047a1d  libclc-13.0.1.src.tar.xz
 sha256  3c536c052db9afd997809e38785c9f2a9e54e2892330fa7c5b438e18a7413479  LICENSE.TXT
diff --git a/package/libclc/libclc.mk b/package/libclc/libclc.mk
index 6fe8e10a77..5d246cf4f8 100644
--- a/package/libclc/libclc.mk
+++ b/package/libclc/libclc.mk
@@ -4,43 +4,39 @@
 #
 ################################################################################
 
-# Use the latest commit from release_90 branch.
-LIBCLC_VERSION = d1cbc92e2ceee59963f5c3a576382e5bba31f060
-LIBCLC_SITE = https://github.com/llvm-mirror/libclc
-LIBCLC_SITE_METHOD = git
+LIBCLC_VERSION = 13.0.1
+LIBCLC_SITE = https://github.com/llvm/llvm-project/releases/download/llvmorg-$(LIBCLC_VERSION)
+LIBCLC_SOURCE = libclc-$(LIBCLC_VERSION).src.tar.xz
 LIBCLC_LICENSE = Apache-2.0 with exceptions or MIT
 LIBCLC_LICENSE_FILES = LICENSE.TXT
 
-LIBCLC_DEPENDENCIES = host-clang host-llvm
+LIBCLC_DEPENDENCIES = host-clang host-llvm host-spirv-llvm-translator
 LIBCLC_INSTALL_STAGING = YES
 
-# C++ compiler is used to build a small tool (prepare-builtins) for the host.
-# It must be built with the C++ compiler from the host.
+# CMAKE_*_COMPILER_FORCED=ON skips testing the tools and assumes
+# llvm-config provided values
+#
+# CMAKE_*_COMPILER has to be set to the host compiler to build a host
+# 'prepare_builtins' tool used during the build process
 #
 # The headers are installed in /usr/share and not /usr/include,
 # because they are needed at runtime on the target to build the OpenCL
 # kernels.
 LIBCLC_CONF_OPTS = \
-	--with-llvm-config=$(HOST_DIR)/usr/bin/llvm-config \
-	--prefix=/usr \
-	--includedir=/usr/share \
-	--pkgconfigdir=/usr/lib/pkgconfig \
-	--with-cxx-compiler=$(HOSTCXX_NOCCACHE)
-
-define LIBCLC_CONFIGURE_CMDS
-	(cd $(@D); $(TARGET_CONFIGURE_OPTS) ./configure.py $(LIBCLC_CONF_OPTS))
-endef
-
-define LIBCLC_BUILD_CMDS
-	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D)
-endef
-
-define LIBCLC_INSTALL_TARGET_CMDS
-	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) DESTDIR=$(TARGET_DIR) install
-endef
-
-define LIBCLC_INSTALL_STAGING_CMDS
-	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) DESTDIR=$(STAGING_DIR) install
-endef
-
-$(eval $(generic-package))
+	-DCMAKE_SYSROOT="" \
+	-DCMAKE_C_COMPILER_FORCED=ON \
+	-DCMAKE_CXX_COMPILER_FORCED=ON \
+	-DCMAKE_CLC_COMPILER_FORCED=ON \
+	-DCMAKE_LLAsm_COMPILER_FORCED=ON \
+	-DCMAKE_INSTALL_DATADIR="share" \
+	-DCMAKE_FIND_ROOT_PATH="$(HOST_DIR)" \
+	-DCMAKE_C_FLAGS="$(HOST_CFLAGS)" \
+	-DCMAKE_CXX_FLAGS="$(HOST_CXXFLAGS)" \
+	-DCMAKE_EXE_LINKER_FLAGS="$(HOST_LDFLAGS)" \
+	-DCMAKE_SHARED_LINKER_FLAGS="$(HOST_LDFLAGS)" \
+	-DCMAKE_MODULE_LINKER_FLAGS="$(HOST_LDFLAGS)" \
+	-DCMAKE_C_COMPILER="$(CMAKE_HOST_C_COMPILER)" \
+	-DCMAKE_CXX_COMPILER="$(CMAKE_HOST_CXX_COMPILER)" \
+	-DLLVM_CONFIG="$(HOST_DIR)/bin/llvm-config"
+
+$(eval $(cmake-package))
-- 
2.25.1

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

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

* [Buildroot] [PATCH v12 07/11] package/compiler-rt: new package
  2022-03-22 23:22 [Buildroot] [PATCH v12 01/11] package/llvm: bump to version 11.1.0 James Hilliard
                   ` (4 preceding siblings ...)
  2022-03-22 23:22 ` [Buildroot] [PATCH v12 06/11] package/libclc: bump version to 13.0.1 James Hilliard
@ 2022-03-22 23:22 ` James Hilliard
  2022-03-22 23:22 ` [Buildroot] [PATCH v12 08/11] testing/tests: CLANG compiler-rt runtime test James Hilliard
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 22+ messages in thread
From: James Hilliard @ 2022-03-22 23:22 UTC (permalink / raw)
  To: buildroot
  Cc: Joseph Kogut, Bernd Kuhls, Michael Drake, Romain Naour,
	Matt Weber, Samuel Martin, James Hilliard, Thomas Petazzoni,
	Romain Naour, Matt Weber, Ricardo Martincoski,
	Valentin Korenblit

From: Matt Weber <matthew.weber@rockwellcollins.com>

This patch adds support for the compiler-rt (CLANG runtime) library.
It builds a set of static libraries and installs them into the
CLANG/LLVM toolchain resource folder. These libraries can then be
used by developers in the SDK for building target applications for
analysis.

What is fuzzing and why libfuzzer?
https://www.moritz.systems/blog/an-introduction-to-llvm-libfuzzer/

The compiler-rt fuzzer and address sanitizer tools require additional
LLVM binary tools installed to allow stack trace decoding actively during
executable analysis.  This patch conditionally enables these tools.
https://github.com/google/sanitizers/wiki/AddressSanitizerCallStack

Signed-off-by: Matthew Weber <matthew.weber@rockwellcollins.com>
Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
Cc: Romain Naour <romain.naour@smile.fr>
Cc: Ricardo Martincoski <ricardo.martincoski@gmail.com>
Cc: Valentin Korenblit <valentinkorenblit@gmail.com>
Cc: Michael Drake <michael.drake@codethink.co.uk>

---
Changes
v1 -> v2
[Romain
 - Removed unnecessary host-cmake dependency

v2 -> v3
[Romain
 - Update to use COMPILER_RT_INSTALL_PATH for library install
[Ricardo
 - Fixed check-package extra line
 - Spelling in commit message

v3 -> v4
[Valentin
 - Pointed out that non-glibc libraries won't build. Further
   investigation shows that the lib asan support in compiler-rt
   doesn't have the libc checks yet to support multiple libraries.
   (https://patchwork.ozlabs.org/patch/339938/ was the best example
    I could find and it doesn't look like anything has changed in the
    recent codebase)

v4 -> v5
[Thomas P
 - Revisited staging install step and found a cleaner way to use the
   default and then a hook to setup the runtime library path

v6
 - Bumped to 7.0.1 to match current LLVM/Clang version

v7
 - Rebased on master for 8.0 LLVM/Clang version
 - Added comment about bumping verions of LLVM/Clang and Compiler-rt
   together
[Romain
 - Disabled test cases (-DCOMPILER_RT_INCLUDE_TESTS=OFF)

v8
 - Rebased and updated version to 9.x to match llvm/clang

[Romain
 - Squashed "[v7,1/5]package/llvm: install target binary/debug tools" to
   be included in this patch

[Michael D
 - compiler-rt symlink creation to include shared folder such
   that control flow lists work

v9
 - Rebased post 2020.05

v10
 - Switched compiler-rt site to point towards new github project
 - Updated compiler-rt version to 11.0.0
 - Tested against master[8640e8ffde3f61c5838] using
   support/testing/run-tests -o runtest -k \
      tests.package.test_clang.TestClangCompilerRT

v11
 - Updated compiler-rt version to 11.1.0

v12
 - overwrite target llvm-config in staging with host llvm-config
---
 DEVELOPERS                           |  1 +
 package/Config.in                    |  1 +
 package/compiler-rt/Config.in        | 14 +++++++++++
 package/compiler-rt/compiler-rt.hash |  3 +++
 package/compiler-rt/compiler-rt.mk   | 37 ++++++++++++++++++++++++++++
 package/llvm/llvm.mk                 | 20 ++++++++++++---
 6 files changed, 72 insertions(+), 4 deletions(-)
 create mode 100644 package/compiler-rt/Config.in
 create mode 100644 package/compiler-rt/compiler-rt.hash
 create mode 100644 package/compiler-rt/compiler-rt.mk

diff --git a/DEVELOPERS b/DEVELOPERS
index 942bb8fe9c..5219626e45 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -1886,6 +1886,7 @@ F:	package/bridge-utils/
 F:	package/checkpolicy/
 F:	package/checksec/
 F:	package/cgroupfs-mount/
+F:	package/compiler-rt/
 F:	package/crda/
 F:	package/cunit/
 F:	package/dacapo/
diff --git a/package/Config.in b/package/Config.in
index 0d5d763180..e3ef75b0da 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -1928,6 +1928,7 @@ menu "Other"
 	source "package/cereal/Config.in"
 	source "package/clang/Config.in"
 	source "package/cmocka/Config.in"
+	source "package/compiler-rt/Config.in"
 	source "package/cppcms/Config.in"
 	source "package/cracklib/Config.in"
 	source "package/dawgdic/Config.in"
diff --git a/package/compiler-rt/Config.in b/package/compiler-rt/Config.in
new file mode 100644
index 0000000000..9afc0d9d60
--- /dev/null
+++ b/package/compiler-rt/Config.in
@@ -0,0 +1,14 @@
+config BR2_PACKAGE_COMPILER_RT
+	bool "compiler-rt"
+	depends on BR2_PACKAGE_LLVM
+	depends on BR2_TOOLCHAIN_USES_GLIBC # asan lib requires
+	help
+	  A collection of runtime libraries primarily used by clang and
+	  llvm to provide builtins, sanitizer runtimes, and profiling
+	  at runtime.
+
+	  https://compiler-rt.llvm.org/
+
+comment "compiler-rt requires llvm to be enabled and a glibc toolchain"
+	depends on !BR2_PACKAGE_LLVM
+	depends on !BR2_TOOLCHAIN_USES_GLIBC
diff --git a/package/compiler-rt/compiler-rt.hash b/package/compiler-rt/compiler-rt.hash
new file mode 100644
index 0000000000..0689ec3d2a
--- /dev/null
+++ b/package/compiler-rt/compiler-rt.hash
@@ -0,0 +1,3 @@
+# Locally computed:
+sha256 def1fc00c764cd3abbba925c712ac38860a756a43b696b291f46fee09e453274  compiler-rt-11.1.0.src.tar.xz
+sha256 1a8f1058753f1ba890de984e48f0242a3a5c29a6a8f2ed9fd813f36985387e8d  LICENSE.TXT
diff --git a/package/compiler-rt/compiler-rt.mk b/package/compiler-rt/compiler-rt.mk
new file mode 100644
index 0000000000..57f9c26854
--- /dev/null
+++ b/package/compiler-rt/compiler-rt.mk
@@ -0,0 +1,37 @@
+################################################################################
+#
+# compiler-rt
+#
+################################################################################
+
+# Compiler-RT should be bumped together with LLVM and Clang as the run-time is
+# tied to the version of those tools
+COMPILER_RT_VERSION = 11.1.0
+COMPILER_RT_SOURCE = compiler-rt-$(COMPILER_RT_VERSION).src.tar.xz
+COMPILER_RT_SITE = https://github.com/llvm/llvm-project/releases/download/llvmorg-$(COMPILER_RT_VERSION)
+COMPILER_RT_LICENSE = NCSA MIT
+COMPILER_RT_LICENSE_FILES = LICENSE.TXT
+COMPILER_RT_DEPENDENCIES = host-clang llvm
+
+COMPILER_RT_INSTALL_STAGING = YES
+COMPILER_RT_INSTALL_TARGET = NO
+
+COMPILER_RT_CONF_OPTS=-DCOMPILER_RT_STANDALONE_BUILD=OFF \
+	-DCOMPILER_RT_STANDALONE_BUILD=ON \
+	-DCOMPILER_RT_DEFAULT_TARGET_TRIPLE=$(GNU_TARGET_NAME) \
+	-DLLVM_CONFIG_PATH=$(HOST_DIR)/usr/bin/llvm-config
+
+# The installation of the target runtime libraries defaults to DESTDIR, however
+# host-clang resources directory needs a link so Clang can find the runtime
+# libraries in the same location they would be if built as part of the Clang
+# build. The "resources" directory is loosely documented and seems to be
+# assumed, as compiler-rt is usually build at the same time as Clang and not
+# standalone.
+define COMPILER_RT_SETUP_RUNTIME_LIBS
+	mkdir -p $(HOST_DIR)/lib/clang/$(HOST_CLANG_VERSION)/lib
+	ln -sf ../../../../$(GNU_TARGET_NAME)/sysroot/usr/lib/linux $(HOST_DIR)/lib/clang/$(HOST_CLANG_VERSION)/lib/linux
+	ln -sf ../../../../$(GNU_TARGET_NAME)/sysroot/usr/share $(HOST_DIR)/lib/clang/$(HOST_CLANG_VERSION)/share
+endef
+COMPILER_RT_POST_INSTALL_STAGING_HOOKS += COMPILER_RT_SETUP_RUNTIME_LIBS
+
+$(eval $(cmake-package))
diff --git a/package/llvm/llvm.mk b/package/llvm/llvm.mk
index 825de96392..7c73d5b564 100644
--- a/package/llvm/llvm.mk
+++ b/package/llvm/llvm.mk
@@ -214,8 +214,7 @@ HOST_LLVM_CONF_OPTS += \
 # We need to activate LLVM_INCLUDE_TOOLS, otherwise it does not generate
 # libLLVM.so
 LLVM_CONF_OPTS += \
-	-DLLVM_INCLUDE_TOOLS=ON \
-	-DLLVM_BUILD_TOOLS=OFF
+	-DLLVM_INCLUDE_TOOLS=ON
 
 ifeq ($(BR2_PACKAGE_LLVM_RTTI),y)
 HOST_LLVM_CONF_OPTS += -DLLVM_ENABLE_RTTI=ON
@@ -278,11 +277,24 @@ LLVM_CONF_OPTS += \
 # directories from STAGING_DIR.
 # output/staging/usr/bin/llvm-config --includedir
 # output/staging/usr/include
-define HOST_LLVM_COPY_LLVM_CONFIG_TO_STAGING_DIR
+define LLVM_COPY_LLVM_CONFIG_TO_STAGING_DIR
 	$(INSTALL) -D -m 0755 $(HOST_DIR)/bin/llvm-config \
 		$(STAGING_DIR)/usr/bin/llvm-config
 endef
-HOST_LLVM_POST_INSTALL_HOOKS = HOST_LLVM_COPY_LLVM_CONFIG_TO_STAGING_DIR
+HOST_LLVM_POST_INSTALL_HOOKS = LLVM_COPY_LLVM_CONFIG_TO_STAGING_DIR
+
+# The llvm-symbolizer binary is used by the Compiler-RT Fuzzer
+# and AddressSanitizer tools for stack traces.
+# If we set -DLLVM_BUILD_TOOLS=ON we need to re-copy host llvm-config to
+# replace the target llvm-config variant in staging that gets installed.
+ifeq ($(BR2_PACKAGE_COMPILER_RT),y)
+LLVM_CONF_OPTS += \
+	-DLLVM_BUILD_TOOLS=ON
+LLVM_POST_INSTALL_STAGING_HOOKS = LLVM_COPY_LLVM_CONFIG_TO_STAGING_DIR
+else
+LLVM_CONF_OPTS += \
+	-DLLVM_BUILD_TOOLS=OFF
+endif
 
 # By default llvm-tblgen is built and installed on the target but it is
 # not necessary. Also erase LLVMHello.so from /usr/lib
-- 
2.25.1

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

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

* [Buildroot] [PATCH v12 08/11] testing/tests: CLANG compiler-rt runtime test
  2022-03-22 23:22 [Buildroot] [PATCH v12 01/11] package/llvm: bump to version 11.1.0 James Hilliard
                   ` (5 preceding siblings ...)
  2022-03-22 23:22 ` [Buildroot] [PATCH v12 07/11] package/compiler-rt: new package James Hilliard
@ 2022-03-22 23:22 ` James Hilliard
  2022-03-22 23:22 ` [Buildroot] [PATCH v12 09/11] package/clang: help host-clang to find our external toolchain James Hilliard
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 22+ messages in thread
From: James Hilliard @ 2022-03-22 23:22 UTC (permalink / raw)
  To: buildroot
  Cc: Joseph Kogut, Bernd Kuhls, Romain Naour, Matt Weber,
	Samuel Martin, Thomas Petazzoni, Romain Naour, Matt Weber,
	Ricardo Martincoski, Valentin Korenblit

From: Matt Weber <matthew.weber@rockwellcollins.com>

This patch adds a test case that
 1) Builds the complete LLVM and CLANG set of host tools
 2) Cross-compiles the compiler-rt runtime using CLANG
 3) Builds a cross-compiled application using CLANG and the libfuzzer
    compiler-rt library.
 4) Executes the fuzz application (part of the libfuzzer package) on
    target and checks expected output for a heap-buffer-overflow.

Note: The libfuzzer package is just a tutorial example of how to use
      the toolkit provided by llvm (Thus not adding it as a full
      Buildroot package).

Signed-off-by: Matthew Weber <matthew.weber@rockwellcollins.com>
Cc: Ricardo Martincoski <ricardo.martincoski@gmail.com>
Cc: Romain Naour <romain.naour@smile.fr>
---
Changes
v1 -> v2
[Ricardo
 - updated yml with test case
 - moved emulator launch cmd to test case from infra
 - defconfig in the order provided by savedefconfig
 - indent defconfig
 - add full package for test code to the test br2-external
 - consolidated to one class only

v2 -> v3
 - Added Review/tested by Ricardo's
   [with the entire series applied on next branch:
    https://gitlab.com/RicardoMartincoski/buildroot/-/jobs/121908178
    NOTE: this test case takes longer than test_rust, ~2 hours in my host
    machine with all tarballs previously downloaded]

v4
 - None

v5
 - Rebased post 2018.11 on master

v6
 - Testing of LLVM/Clang bump

v7
 - Rebase on master and testing of LLVM/Clang bump to 8.0
 - Updated hashes for archive and legal info (legal info changed
   because of spelling cleanup)

v8
 - Cleaned up wording the 4th item of the message above.

[Romain
 - Removes a hardcoded toolchain/sysroot path "b option" for libfuzzer
   pkg build, however requires this series applied.
   http://patchwork.ozlabs.org/project/buildroot/list/?series=129565
 - updated test case to check for heap overflow string to keep arch
   generic
 - Removed the fixed mcpu arg from clang++ build and dropped --sysroot
   as cross compiler wrapper now provides this for libfuzzer build

v9
 - Rebased post 2020.05

v10
 - Updated site for libfuzzer test case and bumped version
 - Switched back to have no dependency on clang as cross compiler series
   - Fixed a libfuzzer link time gcc ld error by adding sysroot and -B
     to the BUILD_CMDS since we don't depend on the cross wrapper.
 - Tested against master[8640e8ffde3f61c583] using
   support/testing/run-tests -o runtest -k \
        tests.package.test_clang.TestClangCompilerRT

v11
 - Updated compiler-rt version to 11.1.0
---
 .../br2-external/clang-compiler-rt/Config.in  |  1 +
 .../clang-compiler-rt/external.desc           |  1 +
 .../clang-compiler-rt/external.mk             |  1 +
 .../package/libfuzzer/Config.in               |  8 ++++
 .../package/libfuzzer/libfuzzer.hash          |  2 +
 .../package/libfuzzer/libfuzzer.mk            | 24 ++++++++++
 support/testing/tests/package/test_clang.py   | 46 +++++++++++++++++++
 7 files changed, 83 insertions(+)
 create mode 100644 support/testing/tests/package/br2-external/clang-compiler-rt/Config.in
 create mode 100644 support/testing/tests/package/br2-external/clang-compiler-rt/external.desc
 create mode 100644 support/testing/tests/package/br2-external/clang-compiler-rt/external.mk
 create mode 100644 support/testing/tests/package/br2-external/clang-compiler-rt/package/libfuzzer/Config.in
 create mode 100644 support/testing/tests/package/br2-external/clang-compiler-rt/package/libfuzzer/libfuzzer.hash
 create mode 100644 support/testing/tests/package/br2-external/clang-compiler-rt/package/libfuzzer/libfuzzer.mk
 create mode 100644 support/testing/tests/package/test_clang.py

diff --git a/support/testing/tests/package/br2-external/clang-compiler-rt/Config.in b/support/testing/tests/package/br2-external/clang-compiler-rt/Config.in
new file mode 100644
index 0000000000..e1f9f8c598
--- /dev/null
+++ b/support/testing/tests/package/br2-external/clang-compiler-rt/Config.in
@@ -0,0 +1 @@
+source "$BR2_EXTERNAL_CLANG_COMPILER_RT_PATH/package/libfuzzer/Config.in"
diff --git a/support/testing/tests/package/br2-external/clang-compiler-rt/external.desc b/support/testing/tests/package/br2-external/clang-compiler-rt/external.desc
new file mode 100644
index 0000000000..92df85911d
--- /dev/null
+++ b/support/testing/tests/package/br2-external/clang-compiler-rt/external.desc
@@ -0,0 +1 @@
+name: CLANG_COMPILER_RT
diff --git a/support/testing/tests/package/br2-external/clang-compiler-rt/external.mk b/support/testing/tests/package/br2-external/clang-compiler-rt/external.mk
new file mode 100644
index 0000000000..6fa55c1211
--- /dev/null
+++ b/support/testing/tests/package/br2-external/clang-compiler-rt/external.mk
@@ -0,0 +1 @@
+include $(sort $(wildcard $(BR2_EXTERNAL_CLANG_COMPILER_RT_PATH)/package/*/*.mk))
diff --git a/support/testing/tests/package/br2-external/clang-compiler-rt/package/libfuzzer/Config.in b/support/testing/tests/package/br2-external/clang-compiler-rt/package/libfuzzer/Config.in
new file mode 100644
index 0000000000..2d335fd3c7
--- /dev/null
+++ b/support/testing/tests/package/br2-external/clang-compiler-rt/package/libfuzzer/Config.in
@@ -0,0 +1,8 @@
+config BR2_PACKAGE_LIBFUZZER
+	bool "libfuzzer"
+	help
+	  This project aims at hosting tutorials,
+	  examples, discussions, research proposals,
+	  and other resources related to fuzzing.
+
+	  https://github.com/google/fuzzing
diff --git a/support/testing/tests/package/br2-external/clang-compiler-rt/package/libfuzzer/libfuzzer.hash b/support/testing/tests/package/br2-external/clang-compiler-rt/package/libfuzzer/libfuzzer.hash
new file mode 100644
index 0000000000..9287005ed9
--- /dev/null
+++ b/support/testing/tests/package/br2-external/clang-compiler-rt/package/libfuzzer/libfuzzer.hash
@@ -0,0 +1,2 @@
+sha256 c71360c3b1ba1d88b28b0b3cb3a1744d251b87a12f2881224cc53ec26eb7a2db  libfuzzer-cec02db916d21baa4db5b8d262d78848b3a35f4b.tar.gz
+sha256 cfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30  LICENSE
diff --git a/support/testing/tests/package/br2-external/clang-compiler-rt/package/libfuzzer/libfuzzer.mk b/support/testing/tests/package/br2-external/clang-compiler-rt/package/libfuzzer/libfuzzer.mk
new file mode 100644
index 0000000000..6c6371bea7
--- /dev/null
+++ b/support/testing/tests/package/br2-external/clang-compiler-rt/package/libfuzzer/libfuzzer.mk
@@ -0,0 +1,24 @@
+################################################################################
+#
+# libfuzzer
+#
+################################################################################
+
+LIBFUZZER_VERSION = cec02db916d21baa4db5b8d262d78848b3a35f4b
+LIBFUZZER_SITE = $(call github,google,fuzzing,$(LIBFUZZER_VERSION))
+LIBFUZZER_LICENSE = Apache-2.0
+LIBFUZZER_LICENSE_FILES = LICENSE
+LIBFUZZER_DEPENDENCIES = compiler-rt
+
+define LIBFUZZER_BUILD_CMDS
+	$(HOST_DIR)/bin/clang++ --sysroot=$(STAGING_DIR) \
+		-B $(HOST_DIR)/opt/ext-toolchain -fsanitize=address,fuzzer \
+		$(@D)/tutorial/libFuzzer/fuzz_me.cc \
+		-o $(@D)/fuzz_me
+endef
+
+define LIBFUZZER_INSTALL_TARGET_CMDS
+	$(INSTALL) -D -m 755 $(@D)/fuzz_me $(TARGET_DIR)/usr/bin/fuzz_me
+endef
+
+$(eval $(generic-package))
diff --git a/support/testing/tests/package/test_clang.py b/support/testing/tests/package/test_clang.py
new file mode 100644
index 0000000000..df3990c6be
--- /dev/null
+++ b/support/testing/tests/package/test_clang.py
@@ -0,0 +1,46 @@
+import os
+
+import infra.basetest
+
+FUZZ_TIMEOUT = 120
+
+
+class TestClangCompilerRT(infra.basetest.BRTest):
+    br2_external = [infra.filepath("tests/package/br2-external/clang-compiler-rt")]
+    config = \
+        """
+        BR2_aarch64=y
+        BR2_TOOLCHAIN_EXTERNAL=y
+        BR2_TARGET_GENERIC_GETTY_PORT="ttyAMA0"
+        BR2_LINUX_KERNEL=y
+        BR2_LINUX_KERNEL_CUSTOM_VERSION=y
+        BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="4.16.7"
+        BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
+        BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="board/qemu/aarch64-virt/linux.config"
+        BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y
+        BR2_PACKAGE_COMPILER_RT=y
+        BR2_PACKAGE_LLVM=y
+        BR2_TARGET_ROOTFS_CPIO=y
+        BR2_TARGET_ROOTFS_CPIO_GZIP=y
+        # BR2_TARGET_ROOTFS_TAR is not set
+        BR2_PACKAGE_LIBFUZZER=y
+        """
+
+    def login(self):
+        img = os.path.join(self.builddir, "images", "rootfs.cpio.gz")
+        kern = os.path.join(self.builddir, "images", "Image")
+        # Sanitizers overallocate memory and the minimum that seemed to work was 512MB
+        self.emulator.boot(arch="aarch64",
+                           kernel=kern,
+                           kernel_cmdline=["console=ttyAMA0"],
+                           options=["-M", "virt", "-cpu", "cortex-a53", "-m", "512", "-initrd", img])
+        self.emulator.login()
+
+    def test_run(self):
+        self.login()
+
+        # The test case verifies the application executes and that
+        # the symbolizer is working to decode the stack trace.
+        cmd = "fuzz_me 2>&1 | grep heap-buffer-overflow"
+        _, exit_code = self.emulator.run(cmd, FUZZ_TIMEOUT)
+        self.assertEqual(exit_code, 0)
-- 
2.25.1

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

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

* [Buildroot] [PATCH v12 09/11] package/clang: help host-clang to find our external toolchain
  2022-03-22 23:22 [Buildroot] [PATCH v12 01/11] package/llvm: bump to version 11.1.0 James Hilliard
                   ` (6 preceding siblings ...)
  2022-03-22 23:22 ` [Buildroot] [PATCH v12 08/11] testing/tests: CLANG compiler-rt runtime test James Hilliard
@ 2022-03-22 23:22 ` James Hilliard
  2022-03-31 21:04   ` Romain Naour
  2022-03-22 23:22 ` [Buildroot] [PATCH v12 10/11] package/clang: install a toolchain-wrapper for the host clang cross-compiler James Hilliard
                   ` (2 subsequent siblings)
  10 siblings, 1 reply; 22+ messages in thread
From: James Hilliard @ 2022-03-22 23:22 UTC (permalink / raw)
  To: buildroot
  Cc: Joseph Kogut, Bernd Kuhls, Romain Naour, Matthew Weber,
	Samuel Martin, Thomas Petazzoni, Romain Naour, Matt Weber,
	Valentin Korenblit

From: Romain Naour <romain.naour@smile.fr>

To build libfuzzer package Matthew Weber noticed that (host) clang
doesn't run on the host without "-B $(HOST_DIR)/opt/ext-toolchain"
option. This option add a new search path for binaries and object
files used implicitly.

Without -B clang fail to link due to missing crtbeging.o file and libgcc:
output/host/bin/aarch64-linux-gnu-ld: cannot find crtbegin.o: No such file or directory
output/host/bin/aarch64-linux-gnu-ld: cannot find -lgcc

Indeed, clang search path doesn't include the dafault cross-gcc's search paths:

$ output/host/bin/clang -print-search-dirs
programs: = output/host/bin:output/host/bin:/..//bin
libraries: = output/host/lib/clang/8.0.0:
             output/host/bin/../lib64:
             /lib/../lib64:
             /usr/lib/../lib64:
             output/host/bin/../lib:
             /lib:/usr/lib

Here is the same command for cross-gcc:

$ output/host/bin/aarch64-linux-gnu-gcc -print-search-dirs
install: output/host/opt/ext-toolchain/bin/../lib/gcc/aarch64-linux-gnu/8.3.0/
programs: = output/host/opt/ext-toolchain/bin/../libexec/gcc/aarch64-linux-gnu/8.3.0/:
            output/host/opt/ext-toolchain/bin/../libexec/gcc/:
            output/host/opt/ext-toolchain/bin/../lib/gcc/aarch64-linux-gnu/8.3.0/../../../../aarch64-linux-gnu/bin/aarch64-linux-gnu/8.3.0/:
            output/host/opt/ext-toolchain/bin/../lib/gcc/aarch64-linux-gnu/8.3.0/../../../../aarch64-linux-gnu/bin/
libraries: = output/opt/ext-toolchain/bin/../lib/gcc/aarch64-linux-gnu/8.3.0/:
             output/host/opt/ext-toolchain/bin/../lib/gcc/:
             output/host/opt/ext-toolchain/bin/../lib/gcc/aarch64-linux-gnu/8.3.0/../../../../aarch64-linux-gnu/lib/aarch64-linux-gnu/8.3.0/:
             output/host/opt/ext-toolchain/bin/../lib/gcc/aarch64-linux-gnu/8.3.0/../../../../aarch64-linux-gnu/lib/../lib64/:
             output/host/aarch64-buildroot-linux-gnu/sysroot/lib/aarch64-linux-gnu/8.3.0/:
             output/host/aarch64-buildroot-linux-gnu/sysroot/lib/../lib64/:
             output/host/aarch64-buildroot-linux-gnu/sysroot/usr/lib/aarch64-linux-gnu/8.3.0/:
             output/host/aarch64-buildroot-linux-gnu/sysroot/usr/lib/../lib64/:
             output/host/opt/ext-toolchain/bin/../lib/gcc/aarch64-linux-gnu/8.3.0/../../../../aarch64-linux-gnu/lib/:
             output/host/aarch64-buildroot-linux-gnu/sysroot/lib/:
             output/host/aarch64-buildroot-linux-gnu/sysroot/usr/lib/

We can see that gcc default search path contains
"output/host/opt/ext-toolchain" directory where the external toolchain
has been extracted.

Since we want to use clang without additional option like -B,
patch clang in order to use GCC_INSTALL_PREFIX instead of
using automatic detection (which doesn't work for Buildroot).

We eventually want to relocate the Buildroot SDK containing the clang
cross-compiler, so we provide a relative path to GCC_INSTALL_PREFIX
in order to avoid to hardcode the path to the GCC toolchain.

Also the path between clang and the GCC external toolchain is not always
the same, we have the following case:

* Toolchain to be downloaded and installed
  The toolchain is extracted into $(HOST_DIR)/opt/ext-toolchain, so the
  path is "../opt/ext-toolchain".

* Pre-installed toolchain
  The toolchain is localed somewhere in the host filesystem and
  defined by the user using BR2_TOOLCHAIN_EXTERNAL_PATH.

So, set GCC_INSTALL_PREFIX using realpath:

-DGCC_INSTALL_PREFIX:PATH=`realpath --relative-to=$(HOST_DIR)/bin/ $(TOOLCHAIN_EXTERNAL_INSTALL_DIR)`

When we use a Buildroot's internal toolchain, clang will find theses
crt*.o files and libgcc.

http://lists.busybox.net/pipermail/buildroot/2019-August/256204.html

Signed-off-by: Romain Naour <romain.naour@smile.fr>
Cc: Matthew Weber <matthew.weber@rockwellcollins.com>
Cc: Valentin Korenblit <valentinkorenblit@gmail.com>
Tested-by: Matt Weber <matthew.weber@rockwellcollins.com>
---
Changes v1 -> v2
[Arnout
 - Can't dropped ":PATH" from "-DGCC_INSTALL_PREFIX:PATH=" as suggested,
   The string isn't set correctly and results in "cannot find crtbegin.o"
 - Attempting to post patch upstream
 - I did not address the relative vs absolute path comment. The
   current approach seemed correct per my understanding for handling
   the two toolchain install location cases
---
 ...hains-Gnu-Use-GCC_INSTALL_PREFIX-in-.patch | 78 +++++++++++++++++++
 package/clang/clang.mk                        |  7 ++
 2 files changed, 85 insertions(+)
 create mode 100644 package/clang/0001-lib-Driver-ToolChains-Gnu-Use-GCC_INSTALL_PREFIX-in-.patch

diff --git a/package/clang/0001-lib-Driver-ToolChains-Gnu-Use-GCC_INSTALL_PREFIX-in-.patch b/package/clang/0001-lib-Driver-ToolChains-Gnu-Use-GCC_INSTALL_PREFIX-in-.patch
new file mode 100644
index 0000000000..08371154d5
--- /dev/null
+++ b/package/clang/0001-lib-Driver-ToolChains-Gnu-Use-GCC_INSTALL_PREFIX-in-.patch
@@ -0,0 +1,78 @@
+From fe21cede3939a435d62efbd5799547fab6af1b0a Mon Sep 17 00:00:00 2001
+From: Romain Naour <romain.naour@smile.fr>
+Date: Mon, 5 Aug 2019 16:06:48 +0200
+Subject: [PATCH] lib/Driver/ToolChains/Gnu: Use GCC_INSTALL_PREFIX in the set
+ of prefixes for searching the gcc toolchain
+
+By default, the Gnu Toolchains driver is looking at the parent
+directory while looking for the gcc toolchain when clang is installed
+at "D.InstalledDir"
+
+But this doesn't work with Buildroot since the external
+toolchain is installed in host/opt/ext-toolchain and the sysroot is
+moved to host/<arch>-buildroot-linux-gnu/sysroot/ directory.
+
+We tried by setting GCC_INSTALL_PREFIX in clang.mk for host-clang
+but it doesn't work since we already provide a sysroot [1].
+
+Help the Gnu Toolchains driver by using GCC_INSTALL_PREFIX path.
+
+Since we want to be able to relocate the clang toolchain,
+allow to use a relative path with GCC_INSTALL_PREFIX.
+
+Buildroot will provide such relative path by using:
+HOST_CLANG_CONF_OPTS += -DGCC_INSTALL_PREFIX:PATH=`realpath --relative-to=$(HOST_DIR)/bin/ $(TOOLCHAIN_EXTERNAL_INSTALL_DIR)`
+
+Doing so allow to use clang without providing additional search
+paths with -B option on the clang's command line.
+
+[1] https://reviews.llvm.org/D49244
+[2] http://lists.busybox.net/pipermail/buildroot/2019-August/256204.html
+
+Signed-off-by: Romain Naour <romain.naour@smile.fr>
+Signed-off-by: Matthew Weber <matthew.weber@rockwellcollins.com>
+---
+Pending, access to llvm mailing lists to submit it is pending. They
+seem to be having issues with their listserv.
+---
+ lib/Driver/ToolChains/Gnu.cpp | 17 +++++++++++++++++
+ 1 file changed, 17 insertions(+)
+
+diff --git a/lib/Driver/ToolChains/Gnu.cpp b/lib/Driver/ToolChains/Gnu.cpp
+index 2ad45097dc..90d6b5b748 100644
+--- a/lib/Driver/ToolChains/Gnu.cpp
++++ b/lib/Driver/ToolChains/Gnu.cpp
+@@ -1725,6 +1725,8 @@ void Generic_GCC::GCCInstallationDetector::init(
+ 
+     Prefixes.push_back(GCCToolchainDir);
+   } else {
++    StringRef GccIinstallPrefix = GCC_INSTALL_PREFIX;
++
+     // If we have a SysRoot, try that first.
+     if (!D.SysRoot.empty()) {
+       Prefixes.push_back(D.SysRoot);
+@@ -1734,6 +1736,21 @@ void Generic_GCC::GCCInstallationDetector::init(
+     // Then look for gcc installed alongside clang.
+     Prefixes.push_back(D.InstalledDir + "/..");
+ 
++    // Use GCC_INSTALL_PREFIX if provided by the buildsystem.
++    if (!GccIinstallPrefix.empty())
++    {
++        if (llvm::sys::path::is_relative(GccIinstallPrefix))
++        {
++            // Use a relative path to gcc from clang install path.
++            Prefixes.push_back(D.InstalledDir + "/" + GccIinstallPrefix.str());
++        }
++        else
++        {
++            // Hardcode the absolute path provided by GCC_INSTALL_PREFIX.
++            Prefixes.push_back(GCC_INSTALL_PREFIX);
++        }
++    }
++
+     // Next, look for prefix(es) that correspond to distribution-supplied gcc
+     // installations.
+     if (D.SysRoot.empty()) {
+-- 
+2.20.1
+
diff --git a/package/clang/clang.mk b/package/clang/clang.mk
index d1667d79b6..95b4964be3 100644
--- a/package/clang/clang.mk
+++ b/package/clang/clang.mk
@@ -105,5 +105,12 @@ CLANG_CONF_OPTS += -DLLVM_LINK_LLVM_DYLIB=ON
 HOST_CLANG_CONF_OPTS += -DLLVM_DYLIB_COMPONENTS=all
 CLANG_CONF_OPTS += -DLLVM_DYLIB_COMPONENTS=all
 
+# Help host-clang to find our external toolchain, use a relative path from the clang
+# installation directory to the external toolchain installation directory in order to
+# not hardcode the toolchain absolute path.
+ifeq ($(BR2_TOOLCHAIN_EXTERNAL),y)
+HOST_CLANG_CONF_OPTS += -DGCC_INSTALL_PREFIX:PATH=`realpath --relative-to=$(HOST_DIR)/bin/ $(TOOLCHAIN_EXTERNAL_INSTALL_DIR)`
+endif
+
 $(eval $(cmake-package))
 $(eval $(host-cmake-package))
-- 
2.25.1

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

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

* [Buildroot] [PATCH v12 10/11] package/clang: install a toolchain-wrapper for the host clang cross-compiler
  2022-03-22 23:22 [Buildroot] [PATCH v12 01/11] package/llvm: bump to version 11.1.0 James Hilliard
                   ` (7 preceding siblings ...)
  2022-03-22 23:22 ` [Buildroot] [PATCH v12 09/11] package/clang: help host-clang to find our external toolchain James Hilliard
@ 2022-03-22 23:22 ` James Hilliard
  2022-03-22 23:22 ` [Buildroot] [PATCH v12 11/11] package/compiler-rt: runtime test use toolchain-wrapper James Hilliard
  2022-06-20 19:34 ` [Buildroot] [PATCH v12 01/11] package/llvm: bump to version 11.1.0 Arnout Vandecappelle
  10 siblings, 0 replies; 22+ messages in thread
From: James Hilliard @ 2022-03-22 23:22 UTC (permalink / raw)
  To: buildroot
  Cc: Joseph Kogut, Bernd Kuhls, Romain Naour, Matthew Weber,
	Samuel Martin, Thomas Petazzoni, Romain Naour, Matt Weber,
	Valentin Korenblit

From: Romain Naour <romain.naour@smile.fr>

In order to use Clang as a host cross-compiler for Buildroot, we
need to provide at least the path to the sysroot (using
--sysroot) and some other compiler flags.

This series looks to reuse the toolchain wrapper for GCC since
Clang support most of the gcc flags used in the Buildroot's
toolchain wrapper. The only flag -mfused-madd (deprecated
since gcc 4.6) for mips is not supported by clang. Since
Clang require gcc >= 5.x this flag can never be used.

host-clang refers to an existing GCC-based toolchain (internal or
external) for libstdc++. However, a Buildroot external toolchain
gets a different BR_CROSS_PATH_SUFFIX. Therefore, we can't reuse the
toolchain-wrapper that gets built for the GCC-based toolchain, but
instead have to compile an additional clang-specific wrapper, called
toolchain-wrapper-clang.

After building the clang toolchain wrapper, create the symlinks needed
to force package infrastructure to use clang througt the wrapper.

Initially clang install the clang-8 binary and create all other symlinks:

 # clang -> clang-8
 # clang++ -> clang
 # clang-8
 # clang-cl -> clang
 # clang-cpp -> clang

Use a post install hook to rename the clang-8 binary to clang-8.br_real
and recreate all symlinks:

 # clang -> toolchain-wrapper-clang
 # clang++ -> toolchain-wrapper-clang
 # clang-8 -> toolchain-wrapper-clang
 # clang-8.br_real
 # clang++.br_real -> clang-8.br_real
 # clang.br_real -> clang-8.br_real
 # clang-cl -> toolchain-wrapper-clang
 # clang-cl.br_real -> clang-8.br_real
 # clang-cpp -> toolchain-wrapper-clang
 # clang-cpp.br_real -> clang-8.br_real

NOTE: *.br_real symlinks are needed as the wrapper references them

Use the previously introduced CLANG_VERSION_MAJOR variable to create
theses symlinks.

Set BR_CROSS_PATH_SUFFIX to ".br_real" as for the Buildroot's internal
GCC toolchain backend to find the "real" clang binary installed in
$(HOST_DIR)/bin.

Borrow TOOLCHAIN_WRAPPER_BUILD and TOOLCHAIN_WRAPPER_INSTALL to
build and install the specific clang toolchain wrapper.

Signed-off-by: Romain Naour <romain.naour@smile.fr>
Cc: Valentin Korenblit <valentinkorenblit@gmail.com>
Signed-off-by: Matthew Weber <matthew.weber@rockwellcollins.com>
---
Changes
v1 -> v2
[Arnout
 - Fixup commit description and clarified *.br_real
 - Simplified loop
---
 package/clang/clang.mk | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/package/clang/clang.mk b/package/clang/clang.mk
index 95b4964be3..3c75f8d6b1 100644
--- a/package/clang/clang.mk
+++ b/package/clang/clang.mk
@@ -112,5 +112,33 @@ ifeq ($(BR2_TOOLCHAIN_EXTERNAL),y)
 HOST_CLANG_CONF_OPTS += -DGCC_INSTALL_PREFIX:PATH=`realpath --relative-to=$(HOST_DIR)/bin/ $(TOOLCHAIN_EXTERNAL_INSTALL_DIR)`
 endif
 
+define HOST_CLANG_INSTALL_WRAPPER_AND_SIMPLE_SYMLINKS
+	$(Q)cd $(HOST_DIR)/bin; \
+	rm -f clang-$(CLANG_VERSION_MAJOR).br_real; \
+	mv clang-$(CLANG_VERSION_MAJOR) clang-$(CLANG_VERSION_MAJOR).br_real; \
+	ln -sf toolchain-wrapper-clang clang-$(CLANG_VERSION_MAJOR); \
+	for i in clang clang++ clang-cl clang-cpp; do \
+		ln -snf toolchain-wrapper-clang $$i; \
+		ln -snf clang-$(CLANG_VERSION_MAJOR).br_real $$i.br_real; \
+	done
+endef
+
+define HOST_CLANG_TOOLCHAIN_WRAPPER_BUILD
+	$(HOSTCC) $(HOST_CFLAGS) $(TOOLCHAIN_WRAPPER_ARGS) \
+		-s -Wl,--hash-style=$(TOOLCHAIN_WRAPPER_HASH_STYLE) \
+		toolchain/toolchain-wrapper.c \
+		-o $(@D)/toolchain-wrapper-clang
+endef
+
+define HOST_CLANG_TOOLCHAIN_WRAPPER_INSTALL
+	$(INSTALL) -D -m 0755 $(@D)/toolchain-wrapper-clang \
+		$(HOST_DIR)/bin/toolchain-wrapper-clang
+endef
+
+HOST_CLANG_TOOLCHAIN_WRAPPER_ARGS += -DBR_CROSS_PATH_SUFFIX='".br_real"'
+HOST_CLANG_POST_BUILD_HOOKS += HOST_CLANG_TOOLCHAIN_WRAPPER_BUILD
+HOST_CLANG_POST_INSTALL_HOOKS += HOST_CLANG_TOOLCHAIN_WRAPPER_INSTALL
+HOST_CLANG_POST_INSTALL_HOOKS += HOST_CLANG_INSTALL_WRAPPER_AND_SIMPLE_SYMLINKS
+
 $(eval $(cmake-package))
 $(eval $(host-cmake-package))
-- 
2.25.1

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

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

* [Buildroot] [PATCH v12 11/11] package/compiler-rt: runtime test use toolchain-wrapper
  2022-03-22 23:22 [Buildroot] [PATCH v12 01/11] package/llvm: bump to version 11.1.0 James Hilliard
                   ` (8 preceding siblings ...)
  2022-03-22 23:22 ` [Buildroot] [PATCH v12 10/11] package/clang: install a toolchain-wrapper for the host clang cross-compiler James Hilliard
@ 2022-03-22 23:22 ` James Hilliard
  2022-06-20 19:34   ` Arnout Vandecappelle
  2022-06-20 19:34 ` [Buildroot] [PATCH v12 01/11] package/llvm: bump to version 11.1.0 Arnout Vandecappelle
  10 siblings, 1 reply; 22+ messages in thread
From: James Hilliard @ 2022-03-22 23:22 UTC (permalink / raw)
  To: buildroot
  Cc: Joseph Kogut, Bernd Kuhls, Matt Weber, Samuel Martin,
	Thomas Petazzoni, Romain Naour, Matt Weber, Valentin Korenblit

From: Matt Weber <matthew.weber@rockwellcollins.com>

The toolchain wrapper for clang allows the build of the
libfuzzer package to not point at "-B $(HOST_DIR)/opt/ext-toolchain"
which prevents a build failure to link due to missing crtbeging.o
and libgcc.

Signed-off-by: Matthew Weber <matthew.weber@rockwellcollins.com>
---
 .../clang-compiler-rt/package/libfuzzer/libfuzzer.mk            | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/support/testing/tests/package/br2-external/clang-compiler-rt/package/libfuzzer/libfuzzer.mk b/support/testing/tests/package/br2-external/clang-compiler-rt/package/libfuzzer/libfuzzer.mk
index 6c6371bea7..0515b9da35 100644
--- a/support/testing/tests/package/br2-external/clang-compiler-rt/package/libfuzzer/libfuzzer.mk
+++ b/support/testing/tests/package/br2-external/clang-compiler-rt/package/libfuzzer/libfuzzer.mk
@@ -12,7 +12,7 @@ LIBFUZZER_DEPENDENCIES = compiler-rt
 
 define LIBFUZZER_BUILD_CMDS
 	$(HOST_DIR)/bin/clang++ --sysroot=$(STAGING_DIR) \
-		-B $(HOST_DIR)/opt/ext-toolchain -fsanitize=address,fuzzer \
+		-fsanitize=address,fuzzer \
 		$(@D)/tutorial/libFuzzer/fuzz_me.cc \
 		-o $(@D)/fuzz_me
 endef
-- 
2.25.1

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

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

* Re: [Buildroot] [PATCH v12 05/11] support/misc/toolchainfile.cmake.in: allow variables to be overridden
  2022-03-22 23:22 ` [Buildroot] [PATCH v12 05/11] support/misc/toolchainfile.cmake.in: allow variables to be overridden James Hilliard
@ 2022-03-31 20:38   ` Romain Naour
  2022-03-31 21:29     ` James Hilliard
  0 siblings, 1 reply; 22+ messages in thread
From: Romain Naour @ 2022-03-31 20:38 UTC (permalink / raw)
  To: James Hilliard, buildroot
  Cc: Joseph Kogut, Bernd Kuhls, Samuel Martin, Thomas Petazzoni,
	Matt Weber, Valentin Korenblit

Hello James,

Le 23/03/2022 à 00:22, James Hilliard a écrit :
> Some packages such as libclc need to override cmake toolchain
> variables, to avoid errors caused by trying to set overriden
> variables ensure that they are not defined before being set.
> 
> This prevents difficult to debug silent dropping of overriden
> variables.

Actually, it seems using the toolchainfile.cmake itself should be avoided for
such case.
For now only libclc package seems requires to override cmake toolchain variable,
I'm not sure about potential side effect of this change.

Best regards,
Romain

> 
> Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
> ---
>  support/misc/toolchainfile.cmake.in | 108 +++++++++++++++++++++-------
>  1 file changed, 81 insertions(+), 27 deletions(-)
> 
> diff --git a/support/misc/toolchainfile.cmake.in b/support/misc/toolchainfile.cmake.in
> index be575566a4..30c0e63bf2 100644
> --- a/support/misc/toolchainfile.cmake.in
> +++ b/support/misc/toolchainfile.cmake.in
> @@ -14,9 +14,15 @@ string(REPLACE "/share/buildroot" "" RELOCATED_HOST_DIR ${CMAKE_CURRENT_LIST_DIR
>  # so that it can find our custom platform description.
>  list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR})
>  
> -set(CMAKE_SYSTEM_NAME Buildroot)
> -set(CMAKE_SYSTEM_VERSION 1)
> -set(CMAKE_SYSTEM_PROCESSOR @@CMAKE_SYSTEM_PROCESSOR@@)
> +if(NOT DEFINED CMAKE_SYSTEM_NAME)
> +  set(CMAKE_SYSTEM_NAME Buildroot)
> +endif()
> +if(NOT DEFINED CMAKE_SYSTEM_VERSION)
> +  set(CMAKE_SYSTEM_VERSION 1)
> +endif()
> +if(NOT DEFINED CMAKE_SYSTEM_PROCESSOR)
> +  set(CMAKE_SYSTEM_PROCESSOR @@CMAKE_SYSTEM_PROCESSOR@@)
> +endif()
>  
>  # Set the {C,CXX}FLAGS appended by CMake depending on the build type
>  # defined by Buildroot. CMake defaults these variables with -g and/or
> @@ -28,11 +34,17 @@ set(CMAKE_SYSTEM_PROCESSOR @@CMAKE_SYSTEM_PROCESSOR@@)
>  # Note:
>  #   if the project forces some of these flag variables, Buildroot is
>  #   screwed up and there is nothing Buildroot can do about that :(
> -set(CMAKE_C_FLAGS_DEBUG "" CACHE STRING "Debug CFLAGS")
> -set(CMAKE_C_FLAGS_RELEASE " -DNDEBUG" CACHE STRING "Release CFLAGS")
> +if(NOT DEFINED CMAKE_C_FLAGS_DEBUG)
> +  set(CMAKE_C_FLAGS_DEBUG "" CACHE STRING "Debug CFLAGS")
> +endif()
> +if(NOT DEFINED CMAKE_C_FLAGS_RELEASE)
> +  set(CMAKE_C_FLAGS_RELEASE " -DNDEBUG" CACHE STRING "Release CFLAGS")
> +endif()
>  
>  # Build type from the Buildroot configuration
> -set(CMAKE_BUILD_TYPE @@CMAKE_BUILD_TYPE@@ CACHE STRING "Buildroot build configuration")
> +if(NOT DEFINED CMAKE_BUILD_TYPE)
> +  set(CMAKE_BUILD_TYPE @@CMAKE_BUILD_TYPE@@ CACHE STRING "Buildroot build configuration")
> +endif()
>  
>  # Buildroot defaults flags.
>  # If you are using this toolchainfile.cmake file outside of Buildroot and
> @@ -41,33 +53,75 @@ set(CMAKE_BUILD_TYPE @@CMAKE_BUILD_TYPE@@ CACHE STRING "Buildroot build configur
>  #     cmake -DCMAKE_C_FLAGS="@@TARGET_CFLAGS@@ -Dsome_custom_flag" ...
>  # * and make sure the project's CMake code extends them like this if needed:
>  #     set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Dsome_definitions")
> -set(CMAKE_C_FLAGS "@@TARGET_CFLAGS@@" CACHE STRING "Buildroot CFLAGS")
> -set(CMAKE_EXE_LINKER_FLAGS "@@TARGET_LDFLAGS@@" CACHE STRING "Buildroot LDFLAGS for executables")
> -set(CMAKE_SHARED_LINKER_FLAGS "@@TARGET_LDFLAGS@@" CACHE STRING "Buildroot LDFLAGS for shared libraries")
> -set(CMAKE_MODULE_LINKER_FLAGS "@@TARGET_LDFLAGS@@" CACHE STRING "Buildroot LDFLAGS for module libraries")
> +if(NOT DEFINED CMAKE_C_FLAGS)
> +  set(CMAKE_C_FLAGS "@@TARGET_CFLAGS@@" CACHE STRING "Buildroot CFLAGS")
> +endif()
> +if(NOT DEFINED CMAKE_EXE_LINKER_FLAGS)
> +  set(CMAKE_EXE_LINKER_FLAGS "@@TARGET_LDFLAGS@@" CACHE STRING "Buildroot LDFLAGS for executables")
> +endif()
> +if(NOT DEFINED CMAKE_SHARED_LINKER_FLAGS)
> +  set(CMAKE_SHARED_LINKER_FLAGS "@@TARGET_LDFLAGS@@" CACHE STRING "Buildroot LDFLAGS for shared libraries")
> +endif()
> +if(NOT DEFINED CMAKE_MODULE_LINKER_FLAGS)
> +  set(CMAKE_MODULE_LINKER_FLAGS "@@TARGET_LDFLAGS@@" CACHE STRING "Buildroot LDFLAGS for module libraries")
> +endif()
>  
> -set(CMAKE_INSTALL_SO_NO_EXE 0)
> +if(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE)
> +  set(CMAKE_INSTALL_SO_NO_EXE 0)
> +endif()
>  
> -set(CMAKE_PROGRAM_PATH "${RELOCATED_HOST_DIR}/bin")
> -set(CMAKE_SYSROOT "${RELOCATED_HOST_DIR}/@@STAGING_SUBDIR@@")
> -set(CMAKE_FIND_ROOT_PATH "${RELOCATED_HOST_DIR}/@@STAGING_SUBDIR@@")
> -set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
> -set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
> -set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
> -set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
> +if(NOT DEFINED CMAKE_PROGRAM_PATH)
> +  set(CMAKE_PROGRAM_PATH "${RELOCATED_HOST_DIR}/bin")
> +endif()
> +if(NOT DEFINED CMAKE_SYSROOT)
> +  set(CMAKE_SYSROOT "${RELOCATED_HOST_DIR}/@@STAGING_SUBDIR@@")
> +endif()
> +if(NOT DEFINED CMAKE_FIND_ROOT_PATH)
> +  set(CMAKE_FIND_ROOT_PATH "${RELOCATED_HOST_DIR}/@@STAGING_SUBDIR@@")
> +endif()
> +if(NOT DEFINED CMAKE_FIND_ROOT_PATH_MODE_PROGRAM)
> +  set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
> +endif()
> +if(NOT DEFINED CMAKE_FIND_ROOT_PATH_MODE_PACKAGE)
> +  set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
> +endif()
> +if(NOT DEFINED CMAKE_FIND_ROOT_PATH_MODE_LIBRARY)
> +  set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
> +endif()
> +if(NOT DEFINED CMAKE_FIND_ROOT_PATH_MODE_INCLUDE)
> +  set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
> +endif()
>  set(ENV{PKG_CONFIG_SYSROOT_DIR} "${RELOCATED_HOST_DIR}/@@STAGING_SUBDIR@@")
>  
>  # This toolchain file can be used both inside and outside Buildroot.
> -set(CMAKE_C_COMPILER "${RELOCATED_HOST_DIR}/@@TARGET_CC@@")
> +if(NOT DEFINED CMAKE_C_COMPILER)
> +  set(CMAKE_C_COMPILER "${RELOCATED_HOST_DIR}/@@TARGET_CC@@")
> +endif()
>  if(@@TOOLCHAIN_HAS_CXX@@)
> -  set(CMAKE_CXX_FLAGS_DEBUG "" CACHE STRING "Debug CXXFLAGS")
> -  set(CMAKE_CXX_FLAGS_RELEASE " -DNDEBUG" CACHE STRING "Release CXXFLAGS")
> -  set(CMAKE_CXX_FLAGS "@@TARGET_CXXFLAGS@@" CACHE STRING "Buildroot CXXFLAGS")
> -  set(CMAKE_CXX_COMPILER "${RELOCATED_HOST_DIR}/@@TARGET_CXX@@")
> +  if(NOT DEFINED CMAKE_CXX_FLAGS_DEBUG)
> +    set(CMAKE_CXX_FLAGS_DEBUG "" CACHE STRING "Debug CXXFLAGS")
> +  endif()
> +  if(NOT DEFINED CMAKE_CXX_FLAGS_RELEASE)
> +    set(CMAKE_CXX_FLAGS_RELEASE " -DNDEBUG" CACHE STRING "Release CXXFLAGS")
> +  endif()
> +  if(NOT DEFINED CMAKE_CXX_FLAGS)
> +    set(CMAKE_CXX_FLAGS "@@TARGET_CXXFLAGS@@" CACHE STRING "Buildroot CXXFLAGS")
> +  endif()
> +  if(NOT DEFINED CMAKE_CXX_COMPILER)
> +    set(CMAKE_CXX_COMPILER "${RELOCATED_HOST_DIR}/@@TARGET_CXX@@")
> +  endif()
>  endif()
>  if(@@TOOLCHAIN_HAS_FORTRAN@@)
> -  set(CMAKE_Fortran_FLAGS_DEBUG "" CACHE STRING "Debug Fortran FLAGS")
> -  set(CMAKE_Fortran_FLAGS_RELEASE " -DNDEBUG" CACHE STRING "Release Fortran FLAGS")
> -  set(CMAKE_Fortran_FLAGS "@@TARGET_FCFLAGS@@" CACHE STRING "Buildroot FCFLAGS")
> -  set(CMAKE_Fortran_COMPILER "${RELOCATED_HOST_DIR}/@@TARGET_FC@@")
> +  if(NOT DEFINED CMAKE_Fortran_FLAGS_DEBUG)
> +    set(CMAKE_Fortran_FLAGS_DEBUG "" CACHE STRING "Debug Fortran FLAGS")
> +  endif()
> +  if(NOT DEFINED CMAKE_Fortran_FLAGS_RELEASE)
> +    set(CMAKE_Fortran_FLAGS_RELEASE " -DNDEBUG" CACHE STRING "Release Fortran FLAGS")
> +  endif()
> +  if(NOT DEFINED CMAKE_Fortran_FLAGS)
> +    set(CMAKE_Fortran_FLAGS "@@TARGET_FCFLAGS@@" CACHE STRING "Buildroot FCFLAGS")
> +  endif()
> +  if(NOT DEFINED CMAKE_Fortran_COMPILER)
> +    set(CMAKE_Fortran_COMPILER "${RELOCATED_HOST_DIR}/@@TARGET_FC@@")
> +  endif()
>  endif()

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

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

* Re: [Buildroot] [PATCH v12 06/11] package/libclc: bump version to 13.0.1
  2022-03-22 23:22 ` [Buildroot] [PATCH v12 06/11] package/libclc: bump version to 13.0.1 James Hilliard
@ 2022-03-31 20:50   ` Romain Naour
  2022-03-31 21:38     ` James Hilliard
  0 siblings, 1 reply; 22+ messages in thread
From: Romain Naour @ 2022-03-31 20:50 UTC (permalink / raw)
  To: James Hilliard, buildroot
  Cc: Joseph Kogut, Bernd Kuhls, Matt Weber, Samuel Martin,
	Thomas Petazzoni, Matt Weber, Valentin Korenblit

Hi James,

Le 23/03/2022 à 00:22, James Hilliard a écrit :
> From: Matt Weber <matthew.weber@rockwellcollins.com>
> 
> * Converts to the cmake pkg type
>  * Updates download site
>  * Adds a crosscompile fixups patch
>    * Allow prepare_builtins utility to be directly called
>      (it isn't installed into the path when cross compiling)
>    * Fix file_find() for root search limitation
> 
> Signed-off-by: Matthew Weber <matthew.weber@rockwellcollins.com>
> Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
> ---
> Changes v11 -> v12:
>   - update to 13.0.1 instead of 11.1.0

libclc is part of llvm project, the same version than llvm/clang should be used
here.

Ideally, llvm/clang should be updated to 13.0.1 first (or to the latest version
if possible).

>   - pass required host cmake options for C/CXX compilers
> ---
>  .../0001-support-out-of-tree-build.patch      | 71 +++++++++++++++++++
>  package/libclc/libclc.hash                    |  2 +-
>  package/libclc/libclc.mk                      | 56 +++++++--------
>  3 files changed, 98 insertions(+), 31 deletions(-)
>  create mode 100644 package/libclc/0001-support-out-of-tree-build.patch
> 
> diff --git a/package/libclc/0001-support-out-of-tree-build.patch b/package/libclc/0001-support-out-of-tree-build.patch
> new file mode 100644
> index 0000000000..de7207bedb
> --- /dev/null
> +++ b/package/libclc/0001-support-out-of-tree-build.patch
> @@ -0,0 +1,71 @@
> +From 495491e9d53bfb184c15753b5187e4bb55b19511 Mon Sep 17 00:00:00 2001
> +From: Matt Weber <matthew.weber@rockwellcollins.com>
> +Date: Tue, 9 Mar 2021 15:55:17 -0600
> +Subject: [PATCH] support out of tree build
> +
> +(1) The package has a prepare_builtins tool which is built
> +but not placed in the path for later use in the build. This
> +fix allows the later build steps to use the binary in-place.
> +
> +(2) With cmake, find_file() when used for non-host builds is
> +limited by CMAKE_FIND_ROOT_PATH* scope.
> +
> +In $(HOST_DIR)/share/buildroot/toolchainfile.cmake we set the
> +following target settings for CMAKE_FIND_ROOT_PATH* which
> +limit the scope.
> +set(CMAKE_FIND_ROOT_PATH "${RELOCATED_HOST_DIR}/aarch64-buildroot-linux-gnu/sysroot")
> +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
> +set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
> +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
> +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
> +
> +
> +Signed-off-by: Matthew Weber <matthew.weber@rockwellcollins.com>
> +---
> + CMakeLists.txt                          | 2 +-
> + cmake/CMakeDetermineCLCCompiler.cmake   | 4 ++++
> + cmake/CMakeDetermineLLAsmCompiler.cmake | 4 ++++
> + 3 files changed, 9 insertions(+), 1 deletion(-)
> +
> +diff --git a/CMakeLists.txt b/CMakeLists.txt
> +index 9472f19..a784519 100644
> +--- a/CMakeLists.txt
> ++++ b/CMakeLists.txt
> +@@ -279,7 +279,7 @@ foreach( t ${LIBCLC_TARGETS_TO_BUILD} )
> + 
> +			# Add prepare target
> +			add_custom_command( OUTPUT "${obj_suffix}"
> +-				            COMMAND prepare_builtins -o
> ++				            COMMAND ./prepare_builtins -o
> +					    "${obj_suffix}"
> +					    "builtins.opt.${obj_suffix}"
> +					    DEPENDS "opt.${obj_suffix}"
> +diff --git a/cmake/CMakeDetermineCLCCompiler.cmake b/cmake/CMakeDetermineCLCCompiler.cmake
> +index 94d85d9..5de6a48 100644
> +--- a/cmake/CMakeDetermineCLCCompiler.cmake
> ++++ b/cmake/CMakeDetermineCLCCompiler.cmake
> +@@ -12,7 +12,7 @@ mark_as_advanced(CMAKE_CLC_ARCHIVE)
> + 
> + set(CMAKE_CLC_COMPILER_ENV_VAR "CLC_COMPILER")
> + set(CMAKE_CLC_ARCHIVE_ENV_VAR "CLC_LINKER")
> +-find_file(clc_comp_in CMakeCLCCompiler.cmake.in PATHS ${CMAKE_ROOT}/Modules ${CMAKE_MODULE_PATH})
> ++set(clc_comp_in "${CMAKE_MODULE_PATH}/CMakeCLCCompiler.cmake.in" )
> + # configure all variables set in this file
> + configure_file(${clc_comp_in} ${CMAKE_PLATFORM_INFO_DIR}/CMakeCLCCompiler.cmake @ONLY)
> + mark_as_advanced(clc_comp_in)
> +diff --git a/cmake/CMakeDetermineLLAsmCompiler.cmake b/cmake/CMakeDetermineLLAsmCompiler.cmake
> +index 1c424c7..dd3bfb6 100644
> +--- a/cmake/CMakeDetermineLLAsmCompiler.cmake
> ++++ b/cmake/CMakeDetermineLLAsmCompiler.cmake
> +@@ -18,7 +18,7 @@ mark_as_advanced(CMAKE_LLAsm_ARCHIVE)
> + set(CMAKE_LLAsm_PREPROCESSOR_ENV_VAR "LL_PREPROCESSOR")
> + set(CMAKE_LLAsm_COMPILER_ENV_VAR "LL_ASSEMBLER")
> + set(CMAKE_LLAsm_ARCHIVE_ENV_VAR "LL_LINKER")
> +-find_file(ll_comp_in CMakeLLAsmCompiler.cmake.in PATHS ${CMAKE_ROOT}/Modules ${CMAKE_MODULE_PATH})
> ++set(ll_comp_in "${CMAKE_MODULE_PATH}/CMakeLLAsmCompiler.cmake.in" )
> + # configure all variables set in this file
> + configure_file(${ll_comp_in} ${CMAKE_PLATFORM_INFO_DIR}/CMakeLLAsmCompiler.cmake @ONLY)
> + mark_as_advanced(ll_comp_in)
> +-- 
> +2.17.1
> +
> diff --git a/package/libclc/libclc.hash b/package/libclc/libclc.hash
> index 2af64bc8e8..c496291d81 100644
> --- a/package/libclc/libclc.hash
> +++ b/package/libclc/libclc.hash
> @@ -1,3 +1,3 @@
>  # locally calculated
> -sha256  54d7ae523aabf68d533011739d6c01546cae0c294442d0f44fd657c046cb707d  libclc-d1cbc92e2ceee59963f5c3a576382e5bba31f060-br1.tar.gz
> +sha256  8f0213e52e2fcaca3dfcc438f05d0e15e9b3c96fd6b0994a802b267dc1047a1d  libclc-13.0.1.src.tar.xz
>  sha256  3c536c052db9afd997809e38785c9f2a9e54e2892330fa7c5b438e18a7413479  LICENSE.TXT
> diff --git a/package/libclc/libclc.mk b/package/libclc/libclc.mk
> index 6fe8e10a77..5d246cf4f8 100644
> --- a/package/libclc/libclc.mk
> +++ b/package/libclc/libclc.mk
> @@ -4,43 +4,39 @@
>  #
>  ################################################################################
>  
> -# Use the latest commit from release_90 branch.
> -LIBCLC_VERSION = d1cbc92e2ceee59963f5c3a576382e5bba31f060
> -LIBCLC_SITE = https://github.com/llvm-mirror/libclc
> -LIBCLC_SITE_METHOD = git
> +LIBCLC_VERSION = 13.0.1
> +LIBCLC_SITE = https://github.com/llvm/llvm-project/releases/download/llvmorg-$(LIBCLC_VERSION)
> +LIBCLC_SOURCE = libclc-$(LIBCLC_VERSION).src.tar.xz
>  LIBCLC_LICENSE = Apache-2.0 with exceptions or MIT
>  LIBCLC_LICENSE_FILES = LICENSE.TXT
>  
> -LIBCLC_DEPENDENCIES = host-clang host-llvm
> +LIBCLC_DEPENDENCIES = host-clang host-llvm host-spirv-llvm-translator
>  LIBCLC_INSTALL_STAGING = YES
>  
> -# C++ compiler is used to build a small tool (prepare-builtins) for the host.
> -# It must be built with the C++ compiler from the host.
> +# CMAKE_*_COMPILER_FORCED=ON skips testing the tools and assumes
> +# llvm-config provided values
> +#
> +# CMAKE_*_COMPILER has to be set to the host compiler to build a host
> +# 'prepare_builtins' tool used during the build process
>  #
>  # The headers are installed in /usr/share and not /usr/include,
>  # because they are needed at runtime on the target to build the OpenCL
>  # kernels.
>  LIBCLC_CONF_OPTS = \
> -	--with-llvm-config=$(HOST_DIR)/usr/bin/llvm-config \
> -	--prefix=/usr \
> -	--includedir=/usr/share \
> -	--pkgconfigdir=/usr/lib/pkgconfig \
> -	--with-cxx-compiler=$(HOSTCXX_NOCCACHE)
> -
> -define LIBCLC_CONFIGURE_CMDS
> -	(cd $(@D); $(TARGET_CONFIGURE_OPTS) ./configure.py $(LIBCLC_CONF_OPTS))
> -endef
> -
> -define LIBCLC_BUILD_CMDS
> -	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D)
> -endef
> -
> -define LIBCLC_INSTALL_TARGET_CMDS
> -	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) DESTDIR=$(TARGET_DIR) install
> -endef
> -
> -define LIBCLC_INSTALL_STAGING_CMDS
> -	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) DESTDIR=$(STAGING_DIR) install
> -endef
> -
> -$(eval $(generic-package))
> +	-DCMAKE_SYSROOT="" \
> +	-DCMAKE_C_COMPILER_FORCED=ON \
> +	-DCMAKE_CXX_COMPILER_FORCED=ON \
> +	-DCMAKE_CLC_COMPILER_FORCED=ON \
> +	-DCMAKE_LLAsm_COMPILER_FORCED=ON \
> +	-DCMAKE_INSTALL_DATADIR="share" \
> +	-DCMAKE_FIND_ROOT_PATH="$(HOST_DIR)" \
> +	-DCMAKE_C_FLAGS="$(HOST_CFLAGS)" \
> +	-DCMAKE_CXX_FLAGS="$(HOST_CXXFLAGS)" \
> +	-DCMAKE_EXE_LINKER_FLAGS="$(HOST_LDFLAGS)" \
> +	-DCMAKE_SHARED_LINKER_FLAGS="$(HOST_LDFLAGS)" \
> +	-DCMAKE_MODULE_LINKER_FLAGS="$(HOST_LDFLAGS)" \
> +	-DCMAKE_C_COMPILER="$(CMAKE_HOST_C_COMPILER)" \
> +	-DCMAKE_CXX_COMPILER="$(CMAKE_HOST_CXX_COMPILER)" \
> +	-DLLVM_CONFIG="$(HOST_DIR)/bin/llvm-config"

At least a comment about the issue with the cmake toolchain file is needed.
I don't understand the libclc cmake and why this workaround is needed.

Best regards,
Romain


> +
> +$(eval $(cmake-package))

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

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

* Re: [Buildroot] [PATCH v12 09/11] package/clang: help host-clang to find our external toolchain
  2022-03-22 23:22 ` [Buildroot] [PATCH v12 09/11] package/clang: help host-clang to find our external toolchain James Hilliard
@ 2022-03-31 21:04   ` Romain Naour
  2022-03-31 21:40     ` James Hilliard
  0 siblings, 1 reply; 22+ messages in thread
From: Romain Naour @ 2022-03-31 21:04 UTC (permalink / raw)
  To: James Hilliard, buildroot
  Cc: Joseph Kogut, Bernd Kuhls, Matthew Weber, Samuel Martin,
	Thomas Petazzoni, Romain Naour, Matt Weber, Valentin Korenblit

Hi James,

Le 23/03/2022 à 00:22, James Hilliard a écrit :
> From: Romain Naour <romain.naour@smile.fr>
> 
> To build libfuzzer package Matthew Weber noticed that (host) clang
> doesn't run on the host without "-B $(HOST_DIR)/opt/ext-toolchain"
> option. This option add a new search path for binaries and object
> files used implicitly.
> 
> Without -B clang fail to link due to missing crtbeging.o file and libgcc:
> output/host/bin/aarch64-linux-gnu-ld: cannot find crtbegin.o: No such file or directory
> output/host/bin/aarch64-linux-gnu-ld: cannot find -lgcc
> 
> Indeed, clang search path doesn't include the dafault cross-gcc's search paths:
> 
> $ output/host/bin/clang -print-search-dirs
> programs: = output/host/bin:output/host/bin:/..//bin
> libraries: = output/host/lib/clang/8.0.0:
>              output/host/bin/../lib64:
>              /lib/../lib64:
>              /usr/lib/../lib64:
>              output/host/bin/../lib:
>              /lib:/usr/lib
> 
> Here is the same command for cross-gcc:
> 
> $ output/host/bin/aarch64-linux-gnu-gcc -print-search-dirs
> install: output/host/opt/ext-toolchain/bin/../lib/gcc/aarch64-linux-gnu/8.3.0/
> programs: = output/host/opt/ext-toolchain/bin/../libexec/gcc/aarch64-linux-gnu/8.3.0/:
>             output/host/opt/ext-toolchain/bin/../libexec/gcc/:
>             output/host/opt/ext-toolchain/bin/../lib/gcc/aarch64-linux-gnu/8.3.0/../../../../aarch64-linux-gnu/bin/aarch64-linux-gnu/8.3.0/:
>             output/host/opt/ext-toolchain/bin/../lib/gcc/aarch64-linux-gnu/8.3.0/../../../../aarch64-linux-gnu/bin/
> libraries: = output/opt/ext-toolchain/bin/../lib/gcc/aarch64-linux-gnu/8.3.0/:
>              output/host/opt/ext-toolchain/bin/../lib/gcc/:
>              output/host/opt/ext-toolchain/bin/../lib/gcc/aarch64-linux-gnu/8.3.0/../../../../aarch64-linux-gnu/lib/aarch64-linux-gnu/8.3.0/:
>              output/host/opt/ext-toolchain/bin/../lib/gcc/aarch64-linux-gnu/8.3.0/../../../../aarch64-linux-gnu/lib/../lib64/:
>              output/host/aarch64-buildroot-linux-gnu/sysroot/lib/aarch64-linux-gnu/8.3.0/:
>              output/host/aarch64-buildroot-linux-gnu/sysroot/lib/../lib64/:
>              output/host/aarch64-buildroot-linux-gnu/sysroot/usr/lib/aarch64-linux-gnu/8.3.0/:
>              output/host/aarch64-buildroot-linux-gnu/sysroot/usr/lib/../lib64/:
>              output/host/opt/ext-toolchain/bin/../lib/gcc/aarch64-linux-gnu/8.3.0/../../../../aarch64-linux-gnu/lib/:
>              output/host/aarch64-buildroot-linux-gnu/sysroot/lib/:
>              output/host/aarch64-buildroot-linux-gnu/sysroot/usr/lib/
> 
> We can see that gcc default search path contains
> "output/host/opt/ext-toolchain" directory where the external toolchain
> has been extracted.
> 
> Since we want to use clang without additional option like -B,
> patch clang in order to use GCC_INSTALL_PREFIX instead of
> using automatic detection (which doesn't work for Buildroot).
> 
> We eventually want to relocate the Buildroot SDK containing the clang
> cross-compiler, so we provide a relative path to GCC_INSTALL_PREFIX
> in order to avoid to hardcode the path to the GCC toolchain.
> 
> Also the path between clang and the GCC external toolchain is not always
> the same, we have the following case:
> 
> * Toolchain to be downloaded and installed
>   The toolchain is extracted into $(HOST_DIR)/opt/ext-toolchain, so the
>   path is "../opt/ext-toolchain".
> 
> * Pre-installed toolchain
>   The toolchain is localed somewhere in the host filesystem and
>   defined by the user using BR2_TOOLCHAIN_EXTERNAL_PATH.
> 
> So, set GCC_INSTALL_PREFIX using realpath:
> 
> -DGCC_INSTALL_PREFIX:PATH=`realpath --relative-to=$(HOST_DIR)/bin/ $(TOOLCHAIN_EXTERNAL_INSTALL_DIR)`
> 
> When we use a Buildroot's internal toolchain, clang will find theses
> crt*.o files and libgcc.
> 
> http://lists.busybox.net/pipermail/buildroot/2019-August/256204.html
> 
> Signed-off-by: Romain Naour <romain.naour@smile.fr>
> Cc: Matthew Weber <matthew.weber@rockwellcollins.com>
> Cc: Valentin Korenblit <valentinkorenblit@gmail.com>
> Tested-by: Matt Weber <matthew.weber@rockwellcollins.com>
> ---
> Changes v1 -> v2
> [Arnout
>  - Can't dropped ":PATH" from "-DGCC_INSTALL_PREFIX:PATH=" as suggested,
>    The string isn't set correctly and results in "cannot find crtbegin.o"
>  - Attempting to post patch upstream
>  - I did not address the relative vs absolute path comment. The
>    current approach seemed correct per my understanding for handling
>    the two toolchain install location cases
> ---
>  ...hains-Gnu-Use-GCC_INSTALL_PREFIX-in-.patch | 78 +++++++++++++++++++
>  package/clang/clang.mk                        |  7 ++
>  2 files changed, 85 insertions(+)
>  create mode 100644 package/clang/0001-lib-Driver-ToolChains-Gnu-Use-GCC_INSTALL_PREFIX-in-.patch
> 
> diff --git a/package/clang/0001-lib-Driver-ToolChains-Gnu-Use-GCC_INSTALL_PREFIX-in-.patch b/package/clang/0001-lib-Driver-ToolChains-Gnu-Use-GCC_INSTALL_PREFIX-in-.patch
> new file mode 100644
> index 0000000000..08371154d5
> --- /dev/null
> +++ b/package/clang/0001-lib-Driver-ToolChains-Gnu-Use-GCC_INSTALL_PREFIX-in-.patch
> @@ -0,0 +1,78 @@
> +From fe21cede3939a435d62efbd5799547fab6af1b0a Mon Sep 17 00:00:00 2001
> +From: Romain Naour <romain.naour@smile.fr>
> +Date: Mon, 5 Aug 2019 16:06:48 +0200
> +Subject: [PATCH] lib/Driver/ToolChains/Gnu: Use GCC_INSTALL_PREFIX in the set
> + of prefixes for searching the gcc toolchain
> +
> +By default, the Gnu Toolchains driver is looking at the parent
> +directory while looking for the gcc toolchain when clang is installed
> +at "D.InstalledDir"
> +
> +But this doesn't work with Buildroot since the external
> +toolchain is installed in host/opt/ext-toolchain and the sysroot is
> +moved to host/<arch>-buildroot-linux-gnu/sysroot/ directory.
> +
> +We tried by setting GCC_INSTALL_PREFIX in clang.mk for host-clang
> +but it doesn't work since we already provide a sysroot [1].
> +
> +Help the Gnu Toolchains driver by using GCC_INSTALL_PREFIX path.
> +
> +Since we want to be able to relocate the clang toolchain,
> +allow to use a relative path with GCC_INSTALL_PREFIX.
> +
> +Buildroot will provide such relative path by using:
> +HOST_CLANG_CONF_OPTS += -DGCC_INSTALL_PREFIX:PATH=`realpath --relative-to=$(HOST_DIR)/bin/ $(TOOLCHAIN_EXTERNAL_INSTALL_DIR)`
> +
> +Doing so allow to use clang without providing additional search
> +paths with -B option on the clang's command line.
> +
> +[1] https://reviews.llvm.org/D49244
> +[2] http://lists.busybox.net/pipermail/buildroot/2019-August/256204.html
> +
> +Signed-off-by: Romain Naour <romain.naour@smile.fr>
> +Signed-off-by: Matthew Weber <matthew.weber@rockwellcollins.com>
> +---
> +Pending, access to llvm mailing lists to submit it is pending. They
> +seem to be having issues with their listserv.

Sadly, this patch (hack) never reach the upstream project and need to be rebased
over llvm/clang releases...

Best regards,
Romain

> +---
> + lib/Driver/ToolChains/Gnu.cpp | 17 +++++++++++++++++
> + 1 file changed, 17 insertions(+)
> +
> +diff --git a/lib/Driver/ToolChains/Gnu.cpp b/lib/Driver/ToolChains/Gnu.cpp
> +index 2ad45097dc..90d6b5b748 100644
> +--- a/lib/Driver/ToolChains/Gnu.cpp
> ++++ b/lib/Driver/ToolChains/Gnu.cpp
> +@@ -1725,6 +1725,8 @@ void Generic_GCC::GCCInstallationDetector::init(
> + 
> +     Prefixes.push_back(GCCToolchainDir);
> +   } else {
> ++    StringRef GccIinstallPrefix = GCC_INSTALL_PREFIX;
> ++
> +     // If we have a SysRoot, try that first.
> +     if (!D.SysRoot.empty()) {
> +       Prefixes.push_back(D.SysRoot);
> +@@ -1734,6 +1736,21 @@ void Generic_GCC::GCCInstallationDetector::init(
> +     // Then look for gcc installed alongside clang.
> +     Prefixes.push_back(D.InstalledDir + "/..");
> + 
> ++    // Use GCC_INSTALL_PREFIX if provided by the buildsystem.
> ++    if (!GccIinstallPrefix.empty())
> ++    {
> ++        if (llvm::sys::path::is_relative(GccIinstallPrefix))
> ++        {
> ++            // Use a relative path to gcc from clang install path.
> ++            Prefixes.push_back(D.InstalledDir + "/" + GccIinstallPrefix.str());
> ++        }
> ++        else
> ++        {
> ++            // Hardcode the absolute path provided by GCC_INSTALL_PREFIX.
> ++            Prefixes.push_back(GCC_INSTALL_PREFIX);
> ++        }
> ++    }
> ++
> +     // Next, look for prefix(es) that correspond to distribution-supplied gcc
> +     // installations.
> +     if (D.SysRoot.empty()) {
> +-- 
> +2.20.1
> +
> diff --git a/package/clang/clang.mk b/package/clang/clang.mk
> index d1667d79b6..95b4964be3 100644
> --- a/package/clang/clang.mk
> +++ b/package/clang/clang.mk
> @@ -105,5 +105,12 @@ CLANG_CONF_OPTS += -DLLVM_LINK_LLVM_DYLIB=ON
>  HOST_CLANG_CONF_OPTS += -DLLVM_DYLIB_COMPONENTS=all
>  CLANG_CONF_OPTS += -DLLVM_DYLIB_COMPONENTS=all
>  
> +# Help host-clang to find our external toolchain, use a relative path from the clang
> +# installation directory to the external toolchain installation directory in order to
> +# not hardcode the toolchain absolute path.
> +ifeq ($(BR2_TOOLCHAIN_EXTERNAL),y)
> +HOST_CLANG_CONF_OPTS += -DGCC_INSTALL_PREFIX:PATH=`realpath --relative-to=$(HOST_DIR)/bin/ $(TOOLCHAIN_EXTERNAL_INSTALL_DIR)`
> +endif
> +
>  $(eval $(cmake-package))
>  $(eval $(host-cmake-package))

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

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

* Re: [Buildroot] [PATCH v12 05/11] support/misc/toolchainfile.cmake.in: allow variables to be overridden
  2022-03-31 20:38   ` Romain Naour
@ 2022-03-31 21:29     ` James Hilliard
  0 siblings, 0 replies; 22+ messages in thread
From: James Hilliard @ 2022-03-31 21:29 UTC (permalink / raw)
  To: Romain Naour
  Cc: Joseph Kogut, Bernd Kuhls, Samuel Martin, Thomas Petazzoni,
	buildroot, Matt Weber, Valentin Korenblit

On Thu, Mar 31, 2022 at 2:38 PM Romain Naour <romain.naour@gmail.com> wrote:
>
> Hello James,
>
> Le 23/03/2022 à 00:22, James Hilliard a écrit :
> > Some packages such as libclc need to override cmake toolchain
> > variables, to avoid errors caused by trying to set overriden
> > variables ensure that they are not defined before being set.
> >
> > This prevents difficult to debug silent dropping of overriden
> > variables.
>
> Actually, it seems using the toolchainfile.cmake itself should be avoided for
> such case.

Not really IMO, we only want to override some toolchain variables in most
cases, rather than all of them, this makes that easy to do.

It also prevents difficult to debug errors since accidentally
overriding a toolchain
variable seems to cause other toolchain variables to fail to apply
properly otherwise.

> For now only libclc package seems requires to override cmake toolchain variable,
> I'm not sure about potential side effect of this change.

There's another pending series that this helps, see discussion:
https://lore.kernel.org/buildroot/057A8C3C-8DAC-46A3-86AB-2DAA92A9368B@gmail.com/

Since overriding a toolchain variable without this change causes basically
everything to break I don't think there should be any side effects.

>
> Best regards,
> Romain
>
> >
> > Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
> > ---
> >  support/misc/toolchainfile.cmake.in | 108 +++++++++++++++++++++-------
> >  1 file changed, 81 insertions(+), 27 deletions(-)
> >
> > diff --git a/support/misc/toolchainfile.cmake.in b/support/misc/toolchainfile.cmake.in
> > index be575566a4..30c0e63bf2 100644
> > --- a/support/misc/toolchainfile.cmake.in
> > +++ b/support/misc/toolchainfile.cmake.in
> > @@ -14,9 +14,15 @@ string(REPLACE "/share/buildroot" "" RELOCATED_HOST_DIR ${CMAKE_CURRENT_LIST_DIR
> >  # so that it can find our custom platform description.
> >  list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR})
> >
> > -set(CMAKE_SYSTEM_NAME Buildroot)
> > -set(CMAKE_SYSTEM_VERSION 1)
> > -set(CMAKE_SYSTEM_PROCESSOR @@CMAKE_SYSTEM_PROCESSOR@@)
> > +if(NOT DEFINED CMAKE_SYSTEM_NAME)
> > +  set(CMAKE_SYSTEM_NAME Buildroot)
> > +endif()
> > +if(NOT DEFINED CMAKE_SYSTEM_VERSION)
> > +  set(CMAKE_SYSTEM_VERSION 1)
> > +endif()
> > +if(NOT DEFINED CMAKE_SYSTEM_PROCESSOR)
> > +  set(CMAKE_SYSTEM_PROCESSOR @@CMAKE_SYSTEM_PROCESSOR@@)
> > +endif()
> >
> >  # Set the {C,CXX}FLAGS appended by CMake depending on the build type
> >  # defined by Buildroot. CMake defaults these variables with -g and/or
> > @@ -28,11 +34,17 @@ set(CMAKE_SYSTEM_PROCESSOR @@CMAKE_SYSTEM_PROCESSOR@@)
> >  # Note:
> >  #   if the project forces some of these flag variables, Buildroot is
> >  #   screwed up and there is nothing Buildroot can do about that :(
> > -set(CMAKE_C_FLAGS_DEBUG "" CACHE STRING "Debug CFLAGS")
> > -set(CMAKE_C_FLAGS_RELEASE " -DNDEBUG" CACHE STRING "Release CFLAGS")
> > +if(NOT DEFINED CMAKE_C_FLAGS_DEBUG)
> > +  set(CMAKE_C_FLAGS_DEBUG "" CACHE STRING "Debug CFLAGS")
> > +endif()
> > +if(NOT DEFINED CMAKE_C_FLAGS_RELEASE)
> > +  set(CMAKE_C_FLAGS_RELEASE " -DNDEBUG" CACHE STRING "Release CFLAGS")
> > +endif()
> >
> >  # Build type from the Buildroot configuration
> > -set(CMAKE_BUILD_TYPE @@CMAKE_BUILD_TYPE@@ CACHE STRING "Buildroot build configuration")
> > +if(NOT DEFINED CMAKE_BUILD_TYPE)
> > +  set(CMAKE_BUILD_TYPE @@CMAKE_BUILD_TYPE@@ CACHE STRING "Buildroot build configuration")
> > +endif()
> >
> >  # Buildroot defaults flags.
> >  # If you are using this toolchainfile.cmake file outside of Buildroot and
> > @@ -41,33 +53,75 @@ set(CMAKE_BUILD_TYPE @@CMAKE_BUILD_TYPE@@ CACHE STRING "Buildroot build configur
> >  #     cmake -DCMAKE_C_FLAGS="@@TARGET_CFLAGS@@ -Dsome_custom_flag" ...
> >  # * and make sure the project's CMake code extends them like this if needed:
> >  #     set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Dsome_definitions")
> > -set(CMAKE_C_FLAGS "@@TARGET_CFLAGS@@" CACHE STRING "Buildroot CFLAGS")
> > -set(CMAKE_EXE_LINKER_FLAGS "@@TARGET_LDFLAGS@@" CACHE STRING "Buildroot LDFLAGS for executables")
> > -set(CMAKE_SHARED_LINKER_FLAGS "@@TARGET_LDFLAGS@@" CACHE STRING "Buildroot LDFLAGS for shared libraries")
> > -set(CMAKE_MODULE_LINKER_FLAGS "@@TARGET_LDFLAGS@@" CACHE STRING "Buildroot LDFLAGS for module libraries")
> > +if(NOT DEFINED CMAKE_C_FLAGS)
> > +  set(CMAKE_C_FLAGS "@@TARGET_CFLAGS@@" CACHE STRING "Buildroot CFLAGS")
> > +endif()
> > +if(NOT DEFINED CMAKE_EXE_LINKER_FLAGS)
> > +  set(CMAKE_EXE_LINKER_FLAGS "@@TARGET_LDFLAGS@@" CACHE STRING "Buildroot LDFLAGS for executables")
> > +endif()
> > +if(NOT DEFINED CMAKE_SHARED_LINKER_FLAGS)
> > +  set(CMAKE_SHARED_LINKER_FLAGS "@@TARGET_LDFLAGS@@" CACHE STRING "Buildroot LDFLAGS for shared libraries")
> > +endif()
> > +if(NOT DEFINED CMAKE_MODULE_LINKER_FLAGS)
> > +  set(CMAKE_MODULE_LINKER_FLAGS "@@TARGET_LDFLAGS@@" CACHE STRING "Buildroot LDFLAGS for module libraries")
> > +endif()
> >
> > -set(CMAKE_INSTALL_SO_NO_EXE 0)
> > +if(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE)
> > +  set(CMAKE_INSTALL_SO_NO_EXE 0)
> > +endif()
> >
> > -set(CMAKE_PROGRAM_PATH "${RELOCATED_HOST_DIR}/bin")
> > -set(CMAKE_SYSROOT "${RELOCATED_HOST_DIR}/@@STAGING_SUBDIR@@")
> > -set(CMAKE_FIND_ROOT_PATH "${RELOCATED_HOST_DIR}/@@STAGING_SUBDIR@@")
> > -set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
> > -set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
> > -set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
> > -set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
> > +if(NOT DEFINED CMAKE_PROGRAM_PATH)
> > +  set(CMAKE_PROGRAM_PATH "${RELOCATED_HOST_DIR}/bin")
> > +endif()
> > +if(NOT DEFINED CMAKE_SYSROOT)
> > +  set(CMAKE_SYSROOT "${RELOCATED_HOST_DIR}/@@STAGING_SUBDIR@@")
> > +endif()
> > +if(NOT DEFINED CMAKE_FIND_ROOT_PATH)
> > +  set(CMAKE_FIND_ROOT_PATH "${RELOCATED_HOST_DIR}/@@STAGING_SUBDIR@@")
> > +endif()
> > +if(NOT DEFINED CMAKE_FIND_ROOT_PATH_MODE_PROGRAM)
> > +  set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
> > +endif()
> > +if(NOT DEFINED CMAKE_FIND_ROOT_PATH_MODE_PACKAGE)
> > +  set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
> > +endif()
> > +if(NOT DEFINED CMAKE_FIND_ROOT_PATH_MODE_LIBRARY)
> > +  set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
> > +endif()
> > +if(NOT DEFINED CMAKE_FIND_ROOT_PATH_MODE_INCLUDE)
> > +  set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
> > +endif()
> >  set(ENV{PKG_CONFIG_SYSROOT_DIR} "${RELOCATED_HOST_DIR}/@@STAGING_SUBDIR@@")
> >
> >  # This toolchain file can be used both inside and outside Buildroot.
> > -set(CMAKE_C_COMPILER "${RELOCATED_HOST_DIR}/@@TARGET_CC@@")
> > +if(NOT DEFINED CMAKE_C_COMPILER)
> > +  set(CMAKE_C_COMPILER "${RELOCATED_HOST_DIR}/@@TARGET_CC@@")
> > +endif()
> >  if(@@TOOLCHAIN_HAS_CXX@@)
> > -  set(CMAKE_CXX_FLAGS_DEBUG "" CACHE STRING "Debug CXXFLAGS")
> > -  set(CMAKE_CXX_FLAGS_RELEASE " -DNDEBUG" CACHE STRING "Release CXXFLAGS")
> > -  set(CMAKE_CXX_FLAGS "@@TARGET_CXXFLAGS@@" CACHE STRING "Buildroot CXXFLAGS")
> > -  set(CMAKE_CXX_COMPILER "${RELOCATED_HOST_DIR}/@@TARGET_CXX@@")
> > +  if(NOT DEFINED CMAKE_CXX_FLAGS_DEBUG)
> > +    set(CMAKE_CXX_FLAGS_DEBUG "" CACHE STRING "Debug CXXFLAGS")
> > +  endif()
> > +  if(NOT DEFINED CMAKE_CXX_FLAGS_RELEASE)
> > +    set(CMAKE_CXX_FLAGS_RELEASE " -DNDEBUG" CACHE STRING "Release CXXFLAGS")
> > +  endif()
> > +  if(NOT DEFINED CMAKE_CXX_FLAGS)
> > +    set(CMAKE_CXX_FLAGS "@@TARGET_CXXFLAGS@@" CACHE STRING "Buildroot CXXFLAGS")
> > +  endif()
> > +  if(NOT DEFINED CMAKE_CXX_COMPILER)
> > +    set(CMAKE_CXX_COMPILER "${RELOCATED_HOST_DIR}/@@TARGET_CXX@@")
> > +  endif()
> >  endif()
> >  if(@@TOOLCHAIN_HAS_FORTRAN@@)
> > -  set(CMAKE_Fortran_FLAGS_DEBUG "" CACHE STRING "Debug Fortran FLAGS")
> > -  set(CMAKE_Fortran_FLAGS_RELEASE " -DNDEBUG" CACHE STRING "Release Fortran FLAGS")
> > -  set(CMAKE_Fortran_FLAGS "@@TARGET_FCFLAGS@@" CACHE STRING "Buildroot FCFLAGS")
> > -  set(CMAKE_Fortran_COMPILER "${RELOCATED_HOST_DIR}/@@TARGET_FC@@")
> > +  if(NOT DEFINED CMAKE_Fortran_FLAGS_DEBUG)
> > +    set(CMAKE_Fortran_FLAGS_DEBUG "" CACHE STRING "Debug Fortran FLAGS")
> > +  endif()
> > +  if(NOT DEFINED CMAKE_Fortran_FLAGS_RELEASE)
> > +    set(CMAKE_Fortran_FLAGS_RELEASE " -DNDEBUG" CACHE STRING "Release Fortran FLAGS")
> > +  endif()
> > +  if(NOT DEFINED CMAKE_Fortran_FLAGS)
> > +    set(CMAKE_Fortran_FLAGS "@@TARGET_FCFLAGS@@" CACHE STRING "Buildroot FCFLAGS")
> > +  endif()
> > +  if(NOT DEFINED CMAKE_Fortran_COMPILER)
> > +    set(CMAKE_Fortran_COMPILER "${RELOCATED_HOST_DIR}/@@TARGET_FC@@")
> > +  endif()
> >  endif()
>
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH v12 06/11] package/libclc: bump version to 13.0.1
  2022-03-31 20:50   ` Romain Naour
@ 2022-03-31 21:38     ` James Hilliard
  2022-04-02 17:11       ` Arnout Vandecappelle
  0 siblings, 1 reply; 22+ messages in thread
From: James Hilliard @ 2022-03-31 21:38 UTC (permalink / raw)
  To: Romain Naour
  Cc: Joseph Kogut, Bernd Kuhls, Matt Weber, Samuel Martin,
	Thomas Petazzoni, buildroot, Matt Weber, Valentin Korenblit

On Thu, Mar 31, 2022 at 2:50 PM Romain Naour <romain.naour@gmail.com> wrote:
>
> Hi James,
>
> Le 23/03/2022 à 00:22, James Hilliard a écrit :
> > From: Matt Weber <matthew.weber@rockwellcollins.com>
> >
> > * Converts to the cmake pkg type
> >  * Updates download site
> >  * Adds a crosscompile fixups patch
> >    * Allow prepare_builtins utility to be directly called
> >      (it isn't installed into the path when cross compiling)
> >    * Fix file_find() for root search limitation
> >
> > Signed-off-by: Matthew Weber <matthew.weber@rockwellcollins.com>
> > Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
> > ---
> > Changes v11 -> v12:
> >   - update to 13.0.1 instead of 11.1.0
>
> libclc is part of llvm project, the same version than llvm/clang should be used
> here.

Doesn't seem to be required, just needs minimum 3.9.0:
https://github.com/llvm/llvm-project/blob/llvmorg-13.0.1/libclc/CMakeLists.txt#L33

>
> Ideally, llvm/clang should be updated to 13.0.1 first (or to the latest version
> if possible).

There were some issues with lld in anything newer than 11.1.0, see:
https://lore.kernel.org/buildroot/20220131015937.4113728-1-james.hilliard1@gmail.com/
https://bugs.llvm.org/show_bug.cgi?id=49228

So I held off on going beyond 11.1.0 for now due to that.

>
> >   - pass required host cmake options for C/CXX compilers
> > ---
> >  .../0001-support-out-of-tree-build.patch      | 71 +++++++++++++++++++
> >  package/libclc/libclc.hash                    |  2 +-
> >  package/libclc/libclc.mk                      | 56 +++++++--------
> >  3 files changed, 98 insertions(+), 31 deletions(-)
> >  create mode 100644 package/libclc/0001-support-out-of-tree-build.patch
> >
> > diff --git a/package/libclc/0001-support-out-of-tree-build.patch b/package/libclc/0001-support-out-of-tree-build.patch
> > new file mode 100644
> > index 0000000000..de7207bedb
> > --- /dev/null
> > +++ b/package/libclc/0001-support-out-of-tree-build.patch
> > @@ -0,0 +1,71 @@
> > +From 495491e9d53bfb184c15753b5187e4bb55b19511 Mon Sep 17 00:00:00 2001
> > +From: Matt Weber <matthew.weber@rockwellcollins.com>
> > +Date: Tue, 9 Mar 2021 15:55:17 -0600
> > +Subject: [PATCH] support out of tree build
> > +
> > +(1) The package has a prepare_builtins tool which is built
> > +but not placed in the path for later use in the build. This
> > +fix allows the later build steps to use the binary in-place.
> > +
> > +(2) With cmake, find_file() when used for non-host builds is
> > +limited by CMAKE_FIND_ROOT_PATH* scope.
> > +
> > +In $(HOST_DIR)/share/buildroot/toolchainfile.cmake we set the
> > +following target settings for CMAKE_FIND_ROOT_PATH* which
> > +limit the scope.
> > +set(CMAKE_FIND_ROOT_PATH "${RELOCATED_HOST_DIR}/aarch64-buildroot-linux-gnu/sysroot")
> > +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
> > +set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
> > +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
> > +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
> > +
> > +
> > +Signed-off-by: Matthew Weber <matthew.weber@rockwellcollins.com>
> > +---
> > + CMakeLists.txt                          | 2 +-
> > + cmake/CMakeDetermineCLCCompiler.cmake   | 4 ++++
> > + cmake/CMakeDetermineLLAsmCompiler.cmake | 4 ++++
> > + 3 files changed, 9 insertions(+), 1 deletion(-)
> > +
> > +diff --git a/CMakeLists.txt b/CMakeLists.txt
> > +index 9472f19..a784519 100644
> > +--- a/CMakeLists.txt
> > ++++ b/CMakeLists.txt
> > +@@ -279,7 +279,7 @@ foreach( t ${LIBCLC_TARGETS_TO_BUILD} )
> > +
> > +                     # Add prepare target
> > +                     add_custom_command( OUTPUT "${obj_suffix}"
> > +-                                        COMMAND prepare_builtins -o
> > ++                                        COMMAND ./prepare_builtins -o
> > +                                         "${obj_suffix}"
> > +                                         "builtins.opt.${obj_suffix}"
> > +                                         DEPENDS "opt.${obj_suffix}"
> > +diff --git a/cmake/CMakeDetermineCLCCompiler.cmake b/cmake/CMakeDetermineCLCCompiler.cmake
> > +index 94d85d9..5de6a48 100644
> > +--- a/cmake/CMakeDetermineCLCCompiler.cmake
> > ++++ b/cmake/CMakeDetermineCLCCompiler.cmake
> > +@@ -12,7 +12,7 @@ mark_as_advanced(CMAKE_CLC_ARCHIVE)
> > +
> > + set(CMAKE_CLC_COMPILER_ENV_VAR "CLC_COMPILER")
> > + set(CMAKE_CLC_ARCHIVE_ENV_VAR "CLC_LINKER")
> > +-find_file(clc_comp_in CMakeCLCCompiler.cmake.in PATHS ${CMAKE_ROOT}/Modules ${CMAKE_MODULE_PATH})
> > ++set(clc_comp_in "${CMAKE_MODULE_PATH}/CMakeCLCCompiler.cmake.in" )
> > + # configure all variables set in this file
> > + configure_file(${clc_comp_in} ${CMAKE_PLATFORM_INFO_DIR}/CMakeCLCCompiler.cmake @ONLY)
> > + mark_as_advanced(clc_comp_in)
> > +diff --git a/cmake/CMakeDetermineLLAsmCompiler.cmake b/cmake/CMakeDetermineLLAsmCompiler.cmake
> > +index 1c424c7..dd3bfb6 100644
> > +--- a/cmake/CMakeDetermineLLAsmCompiler.cmake
> > ++++ b/cmake/CMakeDetermineLLAsmCompiler.cmake
> > +@@ -18,7 +18,7 @@ mark_as_advanced(CMAKE_LLAsm_ARCHIVE)
> > + set(CMAKE_LLAsm_PREPROCESSOR_ENV_VAR "LL_PREPROCESSOR")
> > + set(CMAKE_LLAsm_COMPILER_ENV_VAR "LL_ASSEMBLER")
> > + set(CMAKE_LLAsm_ARCHIVE_ENV_VAR "LL_LINKER")
> > +-find_file(ll_comp_in CMakeLLAsmCompiler.cmake.in PATHS ${CMAKE_ROOT}/Modules ${CMAKE_MODULE_PATH})
> > ++set(ll_comp_in "${CMAKE_MODULE_PATH}/CMakeLLAsmCompiler.cmake.in" )
> > + # configure all variables set in this file
> > + configure_file(${ll_comp_in} ${CMAKE_PLATFORM_INFO_DIR}/CMakeLLAsmCompiler.cmake @ONLY)
> > + mark_as_advanced(ll_comp_in)
> > +--
> > +2.17.1
> > +
> > diff --git a/package/libclc/libclc.hash b/package/libclc/libclc.hash
> > index 2af64bc8e8..c496291d81 100644
> > --- a/package/libclc/libclc.hash
> > +++ b/package/libclc/libclc.hash
> > @@ -1,3 +1,3 @@
> >  # locally calculated
> > -sha256  54d7ae523aabf68d533011739d6c01546cae0c294442d0f44fd657c046cb707d  libclc-d1cbc92e2ceee59963f5c3a576382e5bba31f060-br1.tar.gz
> > +sha256  8f0213e52e2fcaca3dfcc438f05d0e15e9b3c96fd6b0994a802b267dc1047a1d  libclc-13.0.1.src.tar.xz
> >  sha256  3c536c052db9afd997809e38785c9f2a9e54e2892330fa7c5b438e18a7413479  LICENSE.TXT
> > diff --git a/package/libclc/libclc.mk b/package/libclc/libclc.mk
> > index 6fe8e10a77..5d246cf4f8 100644
> > --- a/package/libclc/libclc.mk
> > +++ b/package/libclc/libclc.mk
> > @@ -4,43 +4,39 @@
> >  #
> >  ################################################################################
> >
> > -# Use the latest commit from release_90 branch.
> > -LIBCLC_VERSION = d1cbc92e2ceee59963f5c3a576382e5bba31f060
> > -LIBCLC_SITE = https://github.com/llvm-mirror/libclc
> > -LIBCLC_SITE_METHOD = git
> > +LIBCLC_VERSION = 13.0.1
> > +LIBCLC_SITE = https://github.com/llvm/llvm-project/releases/download/llvmorg-$(LIBCLC_VERSION)
> > +LIBCLC_SOURCE = libclc-$(LIBCLC_VERSION).src.tar.xz
> >  LIBCLC_LICENSE = Apache-2.0 with exceptions or MIT
> >  LIBCLC_LICENSE_FILES = LICENSE.TXT
> >
> > -LIBCLC_DEPENDENCIES = host-clang host-llvm
> > +LIBCLC_DEPENDENCIES = host-clang host-llvm host-spirv-llvm-translator
> >  LIBCLC_INSTALL_STAGING = YES
> >
> > -# C++ compiler is used to build a small tool (prepare-builtins) for the host.
> > -# It must be built with the C++ compiler from the host.
> > +# CMAKE_*_COMPILER_FORCED=ON skips testing the tools and assumes
> > +# llvm-config provided values
> > +#
> > +# CMAKE_*_COMPILER has to be set to the host compiler to build a host
> > +# 'prepare_builtins' tool used during the build process
> >  #
> >  # The headers are installed in /usr/share and not /usr/include,
> >  # because they are needed at runtime on the target to build the OpenCL
> >  # kernels.
> >  LIBCLC_CONF_OPTS = \
> > -     --with-llvm-config=$(HOST_DIR)/usr/bin/llvm-config \
> > -     --prefix=/usr \
> > -     --includedir=/usr/share \
> > -     --pkgconfigdir=/usr/lib/pkgconfig \
> > -     --with-cxx-compiler=$(HOSTCXX_NOCCACHE)
> > -
> > -define LIBCLC_CONFIGURE_CMDS
> > -     (cd $(@D); $(TARGET_CONFIGURE_OPTS) ./configure.py $(LIBCLC_CONF_OPTS))
> > -endef
> > -
> > -define LIBCLC_BUILD_CMDS
> > -     $(TARGET_MAKE_ENV) $(MAKE) -C $(@D)
> > -endef
> > -
> > -define LIBCLC_INSTALL_TARGET_CMDS
> > -     $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) DESTDIR=$(TARGET_DIR) install
> > -endef
> > -
> > -define LIBCLC_INSTALL_STAGING_CMDS
> > -     $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) DESTDIR=$(STAGING_DIR) install
> > -endef
> > -
> > -$(eval $(generic-package))
> > +     -DCMAKE_SYSROOT="" \
> > +     -DCMAKE_C_COMPILER_FORCED=ON \
> > +     -DCMAKE_CXX_COMPILER_FORCED=ON \
> > +     -DCMAKE_CLC_COMPILER_FORCED=ON \
> > +     -DCMAKE_LLAsm_COMPILER_FORCED=ON \
> > +     -DCMAKE_INSTALL_DATADIR="share" \
> > +     -DCMAKE_FIND_ROOT_PATH="$(HOST_DIR)" \
> > +     -DCMAKE_C_FLAGS="$(HOST_CFLAGS)" \
> > +     -DCMAKE_CXX_FLAGS="$(HOST_CXXFLAGS)" \
> > +     -DCMAKE_EXE_LINKER_FLAGS="$(HOST_LDFLAGS)" \
> > +     -DCMAKE_SHARED_LINKER_FLAGS="$(HOST_LDFLAGS)" \
> > +     -DCMAKE_MODULE_LINKER_FLAGS="$(HOST_LDFLAGS)" \
> > +     -DCMAKE_C_COMPILER="$(CMAKE_HOST_C_COMPILER)" \
> > +     -DCMAKE_CXX_COMPILER="$(CMAKE_HOST_CXX_COMPILER)" \
> > +     -DLLVM_CONFIG="$(HOST_DIR)/bin/llvm-config"
>
> At least a comment about the issue with the cmake toolchain file is needed.
> I don't understand the libclc cmake and why this workaround is needed.

The cmake toolchain issue is not libclc specific, it's an issue for
anything that needs
to override a toolchain variable.

The host toolchain being needed for prepare_builtins is basically the
same as before
it's just that the build system was changed to cmake.

>
> Best regards,
> Romain
>
>
> > +
> > +$(eval $(cmake-package))
>
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH v12 09/11] package/clang: help host-clang to find our external toolchain
  2022-03-31 21:04   ` Romain Naour
@ 2022-03-31 21:40     ` James Hilliard
  0 siblings, 0 replies; 22+ messages in thread
From: James Hilliard @ 2022-03-31 21:40 UTC (permalink / raw)
  To: Romain Naour
  Cc: Joseph Kogut, Bernd Kuhls, Matthew Weber, Samuel Martin,
	Thomas Petazzoni, buildroot, Romain Naour, Matt Weber,
	Valentin Korenblit

On Thu, Mar 31, 2022 at 3:04 PM Romain Naour <romain.naour@gmail.com> wrote:
>
> Hi James,
>
> Le 23/03/2022 à 00:22, James Hilliard a écrit :
> > From: Romain Naour <romain.naour@smile.fr>
> >
> > To build libfuzzer package Matthew Weber noticed that (host) clang
> > doesn't run on the host without "-B $(HOST_DIR)/opt/ext-toolchain"
> > option. This option add a new search path for binaries and object
> > files used implicitly.
> >
> > Without -B clang fail to link due to missing crtbeging.o file and libgcc:
> > output/host/bin/aarch64-linux-gnu-ld: cannot find crtbegin.o: No such file or directory
> > output/host/bin/aarch64-linux-gnu-ld: cannot find -lgcc
> >
> > Indeed, clang search path doesn't include the dafault cross-gcc's search paths:
> >
> > $ output/host/bin/clang -print-search-dirs
> > programs: = output/host/bin:output/host/bin:/..//bin
> > libraries: = output/host/lib/clang/8.0.0:
> >              output/host/bin/../lib64:
> >              /lib/../lib64:
> >              /usr/lib/../lib64:
> >              output/host/bin/../lib:
> >              /lib:/usr/lib
> >
> > Here is the same command for cross-gcc:
> >
> > $ output/host/bin/aarch64-linux-gnu-gcc -print-search-dirs
> > install: output/host/opt/ext-toolchain/bin/../lib/gcc/aarch64-linux-gnu/8.3.0/
> > programs: = output/host/opt/ext-toolchain/bin/../libexec/gcc/aarch64-linux-gnu/8.3.0/:
> >             output/host/opt/ext-toolchain/bin/../libexec/gcc/:
> >             output/host/opt/ext-toolchain/bin/../lib/gcc/aarch64-linux-gnu/8.3.0/../../../../aarch64-linux-gnu/bin/aarch64-linux-gnu/8.3.0/:
> >             output/host/opt/ext-toolchain/bin/../lib/gcc/aarch64-linux-gnu/8.3.0/../../../../aarch64-linux-gnu/bin/
> > libraries: = output/opt/ext-toolchain/bin/../lib/gcc/aarch64-linux-gnu/8.3.0/:
> >              output/host/opt/ext-toolchain/bin/../lib/gcc/:
> >              output/host/opt/ext-toolchain/bin/../lib/gcc/aarch64-linux-gnu/8.3.0/../../../../aarch64-linux-gnu/lib/aarch64-linux-gnu/8.3.0/:
> >              output/host/opt/ext-toolchain/bin/../lib/gcc/aarch64-linux-gnu/8.3.0/../../../../aarch64-linux-gnu/lib/../lib64/:
> >              output/host/aarch64-buildroot-linux-gnu/sysroot/lib/aarch64-linux-gnu/8.3.0/:
> >              output/host/aarch64-buildroot-linux-gnu/sysroot/lib/../lib64/:
> >              output/host/aarch64-buildroot-linux-gnu/sysroot/usr/lib/aarch64-linux-gnu/8.3.0/:
> >              output/host/aarch64-buildroot-linux-gnu/sysroot/usr/lib/../lib64/:
> >              output/host/opt/ext-toolchain/bin/../lib/gcc/aarch64-linux-gnu/8.3.0/../../../../aarch64-linux-gnu/lib/:
> >              output/host/aarch64-buildroot-linux-gnu/sysroot/lib/:
> >              output/host/aarch64-buildroot-linux-gnu/sysroot/usr/lib/
> >
> > We can see that gcc default search path contains
> > "output/host/opt/ext-toolchain" directory where the external toolchain
> > has been extracted.
> >
> > Since we want to use clang without additional option like -B,
> > patch clang in order to use GCC_INSTALL_PREFIX instead of
> > using automatic detection (which doesn't work for Buildroot).
> >
> > We eventually want to relocate the Buildroot SDK containing the clang
> > cross-compiler, so we provide a relative path to GCC_INSTALL_PREFIX
> > in order to avoid to hardcode the path to the GCC toolchain.
> >
> > Also the path between clang and the GCC external toolchain is not always
> > the same, we have the following case:
> >
> > * Toolchain to be downloaded and installed
> >   The toolchain is extracted into $(HOST_DIR)/opt/ext-toolchain, so the
> >   path is "../opt/ext-toolchain".
> >
> > * Pre-installed toolchain
> >   The toolchain is localed somewhere in the host filesystem and
> >   defined by the user using BR2_TOOLCHAIN_EXTERNAL_PATH.
> >
> > So, set GCC_INSTALL_PREFIX using realpath:
> >
> > -DGCC_INSTALL_PREFIX:PATH=`realpath --relative-to=$(HOST_DIR)/bin/ $(TOOLCHAIN_EXTERNAL_INSTALL_DIR)`
> >
> > When we use a Buildroot's internal toolchain, clang will find theses
> > crt*.o files and libgcc.
> >
> > http://lists.busybox.net/pipermail/buildroot/2019-August/256204.html
> >
> > Signed-off-by: Romain Naour <romain.naour@smile.fr>
> > Cc: Matthew Weber <matthew.weber@rockwellcollins.com>
> > Cc: Valentin Korenblit <valentinkorenblit@gmail.com>
> > Tested-by: Matt Weber <matthew.weber@rockwellcollins.com>
> > ---
> > Changes v1 -> v2
> > [Arnout
> >  - Can't dropped ":PATH" from "-DGCC_INSTALL_PREFIX:PATH=" as suggested,
> >    The string isn't set correctly and results in "cannot find crtbegin.o"
> >  - Attempting to post patch upstream
> >  - I did not address the relative vs absolute path comment. The
> >    current approach seemed correct per my understanding for handling
> >    the two toolchain install location cases
> > ---
> >  ...hains-Gnu-Use-GCC_INSTALL_PREFIX-in-.patch | 78 +++++++++++++++++++
> >  package/clang/clang.mk                        |  7 ++
> >  2 files changed, 85 insertions(+)
> >  create mode 100644 package/clang/0001-lib-Driver-ToolChains-Gnu-Use-GCC_INSTALL_PREFIX-in-.patch
> >
> > diff --git a/package/clang/0001-lib-Driver-ToolChains-Gnu-Use-GCC_INSTALL_PREFIX-in-.patch b/package/clang/0001-lib-Driver-ToolChains-Gnu-Use-GCC_INSTALL_PREFIX-in-.patch
> > new file mode 100644
> > index 0000000000..08371154d5
> > --- /dev/null
> > +++ b/package/clang/0001-lib-Driver-ToolChains-Gnu-Use-GCC_INSTALL_PREFIX-in-.patch
> > @@ -0,0 +1,78 @@
> > +From fe21cede3939a435d62efbd5799547fab6af1b0a Mon Sep 17 00:00:00 2001
> > +From: Romain Naour <romain.naour@smile.fr>
> > +Date: Mon, 5 Aug 2019 16:06:48 +0200
> > +Subject: [PATCH] lib/Driver/ToolChains/Gnu: Use GCC_INSTALL_PREFIX in the set
> > + of prefixes for searching the gcc toolchain
> > +
> > +By default, the Gnu Toolchains driver is looking at the parent
> > +directory while looking for the gcc toolchain when clang is installed
> > +at "D.InstalledDir"
> > +
> > +But this doesn't work with Buildroot since the external
> > +toolchain is installed in host/opt/ext-toolchain and the sysroot is
> > +moved to host/<arch>-buildroot-linux-gnu/sysroot/ directory.
> > +
> > +We tried by setting GCC_INSTALL_PREFIX in clang.mk for host-clang
> > +but it doesn't work since we already provide a sysroot [1].
> > +
> > +Help the Gnu Toolchains driver by using GCC_INSTALL_PREFIX path.
> > +
> > +Since we want to be able to relocate the clang toolchain,
> > +allow to use a relative path with GCC_INSTALL_PREFIX.
> > +
> > +Buildroot will provide such relative path by using:
> > +HOST_CLANG_CONF_OPTS += -DGCC_INSTALL_PREFIX:PATH=`realpath --relative-to=$(HOST_DIR)/bin/ $(TOOLCHAIN_EXTERNAL_INSTALL_DIR)`
> > +
> > +Doing so allow to use clang without providing additional search
> > +paths with -B option on the clang's command line.
> > +
> > +[1] https://reviews.llvm.org/D49244
> > +[2] http://lists.busybox.net/pipermail/buildroot/2019-August/256204.html
> > +
> > +Signed-off-by: Romain Naour <romain.naour@smile.fr>
> > +Signed-off-by: Matthew Weber <matthew.weber@rockwellcollins.com>
> > +---
> > +Pending, access to llvm mailing lists to submit it is pending. They
> > +seem to be having issues with their listserv.
>
> Sadly, this patch (hack) never reach the upstream project and need to be rebased
> over llvm/clang releases...

I didn't bump the llvm/clang version so it still works as is.

>
> Best regards,
> Romain
>
> > +---
> > + lib/Driver/ToolChains/Gnu.cpp | 17 +++++++++++++++++
> > + 1 file changed, 17 insertions(+)
> > +
> > +diff --git a/lib/Driver/ToolChains/Gnu.cpp b/lib/Driver/ToolChains/Gnu.cpp
> > +index 2ad45097dc..90d6b5b748 100644
> > +--- a/lib/Driver/ToolChains/Gnu.cpp
> > ++++ b/lib/Driver/ToolChains/Gnu.cpp
> > +@@ -1725,6 +1725,8 @@ void Generic_GCC::GCCInstallationDetector::init(
> > +
> > +     Prefixes.push_back(GCCToolchainDir);
> > +   } else {
> > ++    StringRef GccIinstallPrefix = GCC_INSTALL_PREFIX;
> > ++
> > +     // If we have a SysRoot, try that first.
> > +     if (!D.SysRoot.empty()) {
> > +       Prefixes.push_back(D.SysRoot);
> > +@@ -1734,6 +1736,21 @@ void Generic_GCC::GCCInstallationDetector::init(
> > +     // Then look for gcc installed alongside clang.
> > +     Prefixes.push_back(D.InstalledDir + "/..");
> > +
> > ++    // Use GCC_INSTALL_PREFIX if provided by the buildsystem.
> > ++    if (!GccIinstallPrefix.empty())
> > ++    {
> > ++        if (llvm::sys::path::is_relative(GccIinstallPrefix))
> > ++        {
> > ++            // Use a relative path to gcc from clang install path.
> > ++            Prefixes.push_back(D.InstalledDir + "/" + GccIinstallPrefix.str());
> > ++        }
> > ++        else
> > ++        {
> > ++            // Hardcode the absolute path provided by GCC_INSTALL_PREFIX.
> > ++            Prefixes.push_back(GCC_INSTALL_PREFIX);
> > ++        }
> > ++    }
> > ++
> > +     // Next, look for prefix(es) that correspond to distribution-supplied gcc
> > +     // installations.
> > +     if (D.SysRoot.empty()) {
> > +--
> > +2.20.1
> > +
> > diff --git a/package/clang/clang.mk b/package/clang/clang.mk
> > index d1667d79b6..95b4964be3 100644
> > --- a/package/clang/clang.mk
> > +++ b/package/clang/clang.mk
> > @@ -105,5 +105,12 @@ CLANG_CONF_OPTS += -DLLVM_LINK_LLVM_DYLIB=ON
> >  HOST_CLANG_CONF_OPTS += -DLLVM_DYLIB_COMPONENTS=all
> >  CLANG_CONF_OPTS += -DLLVM_DYLIB_COMPONENTS=all
> >
> > +# Help host-clang to find our external toolchain, use a relative path from the clang
> > +# installation directory to the external toolchain installation directory in order to
> > +# not hardcode the toolchain absolute path.
> > +ifeq ($(BR2_TOOLCHAIN_EXTERNAL),y)
> > +HOST_CLANG_CONF_OPTS += -DGCC_INSTALL_PREFIX:PATH=`realpath --relative-to=$(HOST_DIR)/bin/ $(TOOLCHAIN_EXTERNAL_INSTALL_DIR)`
> > +endif
> > +
> >  $(eval $(cmake-package))
> >  $(eval $(host-cmake-package))
>
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH v12 06/11] package/libclc: bump version to 13.0.1
  2022-03-31 21:38     ` James Hilliard
@ 2022-04-02 17:11       ` Arnout Vandecappelle
  2022-04-02 18:13         ` James Hilliard
  0 siblings, 1 reply; 22+ messages in thread
From: Arnout Vandecappelle @ 2022-04-02 17:11 UTC (permalink / raw)
  To: James Hilliard, Romain Naour
  Cc: Joseph Kogut, Bernd Kuhls, Matt Weber, Samuel Martin,
	Thomas Petazzoni, buildroot, Matt Weber, Valentin Korenblit



On 31/03/2022 23:38, James Hilliard wrote:
> On Thu, Mar 31, 2022 at 2:50 PM Romain Naour <romain.naour@gmail.com> wrote:
>>
>> Hi James,
>>
[snip]
>> Ideally, llvm/clang should be updated to 13.0.1 first (or to the latest version
>> if possible).
> 
> There were some issues with lld in anything newer than 11.1.0, see:
> https://lore.kernel.org/buildroot/20220131015937.4113728-1-james.hilliard1@gmail.com/
> https://bugs.llvm.org/show_bug.cgi?id=49228

  To me that looks trivial to solve: we need to package libunwind (call it 
llvm-libunwind because we already have a libunwind package) and make lld depend 
on it. The CMakeLists.txt adds an include path that doesn't exist, but I think 
that will get silently ignored.

  Regards,
  Arnout

> 
> So I held off on going beyond 11.1.0 for now due to that.
[snip]
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH v12 06/11] package/libclc: bump version to 13.0.1
  2022-04-02 17:11       ` Arnout Vandecappelle
@ 2022-04-02 18:13         ` James Hilliard
  0 siblings, 0 replies; 22+ messages in thread
From: James Hilliard @ 2022-04-02 18:13 UTC (permalink / raw)
  To: Arnout Vandecappelle
  Cc: Joseph Kogut, Bernd Kuhls, Matt Weber, Samuel Martin,
	Thomas Petazzoni, buildroot, Romain Naour, Matt Weber,
	Valentin Korenblit

On Sat, Apr 2, 2022 at 11:11 AM Arnout Vandecappelle <arnout@mind.be> wrote:
>
>
>
> On 31/03/2022 23:38, James Hilliard wrote:
> > On Thu, Mar 31, 2022 at 2:50 PM Romain Naour <romain.naour@gmail.com> wrote:
> >>
> >> Hi James,
> >>
> [snip]
> >> Ideally, llvm/clang should be updated to 13.0.1 first (or to the latest version
> >> if possible).
> >
> > There were some issues with lld in anything newer than 11.1.0, see:
> > https://lore.kernel.org/buildroot/20220131015937.4113728-1-james.hilliard1@gmail.com/
> > https://bugs.llvm.org/show_bug.cgi?id=49228
>
>   To me that looks trivial to solve: we need to package libunwind (call it
> llvm-libunwind because we already have a libunwind package) and make lld depend
> on it. The CMakeLists.txt adds an include path that doesn't exist, but I think
> that will get silently ignored.

I think fixing it was a bit tricky due to conflicting dependencies or
something, since
it works with 11.1.0 I'd say best just do this upgrade first and
update to newer versions
after.

>
>   Regards,
>   Arnout
>
> >
> > So I held off on going beyond 11.1.0 for now due to that.
> [snip]
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH v12 04/11] package/spirv-llvm-translator: new package
  2022-03-22 23:22 ` [Buildroot] [PATCH v12 04/11] package/spirv-llvm-translator: new package James Hilliard
@ 2022-06-20 19:01   ` Arnout Vandecappelle
  0 siblings, 0 replies; 22+ messages in thread
From: Arnout Vandecappelle @ 2022-06-20 19:01 UTC (permalink / raw)
  To: James Hilliard, buildroot
  Cc: Joseph Kogut, Bernd Kuhls, Samuel Martin, Thomas Petazzoni,
	Romain Naour, Matt Weber, Valentin Korenblit



On 23/03/2022 00:22, James Hilliard wrote:
> Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
> ---
>   .../spirv-llvm-translator.hash                 |  3 +++
>   .../spirv-llvm-translator.mk                   | 18 ++++++++++++++++++
>   2 files changed, 21 insertions(+)
>   create mode 100644 package/spirv-llvm-translator/spirv-llvm-translator.hash
>   create mode 100644 package/spirv-llvm-translator/spirv-llvm-translator.mk
> 
> diff --git a/package/spirv-llvm-translator/spirv-llvm-translator.hash b/package/spirv-llvm-translator/spirv-llvm-translator.hash
> new file mode 100644
> index 0000000000..e6f9de3cad
> --- /dev/null
> +++ b/package/spirv-llvm-translator/spirv-llvm-translator.hash
> @@ -0,0 +1,3 @@
> +# locally calculated
> +sha256  a121579379ac3c7b63294b5274e0c4787b76003c89f7702a651384c3915464e9  spirv-llvm-translator-llvm_release_110.tar.gz

  This hash didn't match, so I updated it. However, could you save the file you 
have locally and compare it with the current version that is provided by github?

> +sha256  e3bc36440fc927c62d5cc24efeefe225a14d4e34ffeb0c92e430625cce9ee444  LICENSE.TXT
> diff --git a/package/spirv-llvm-translator/spirv-llvm-translator.mk b/package/spirv-llvm-translator/spirv-llvm-translator.mk
> new file mode 100644
> index 0000000000..fcc482027c
> --- /dev/null
> +++ b/package/spirv-llvm-translator/spirv-llvm-translator.mk
> @@ -0,0 +1,18 @@
> +################################################################################
> +#
> +# spirv-llvm-translator
> +#
> +################################################################################
> +
> +SPIRV_LLVM_TRANSLATOR_VERSION = llvm_release_110
> +SPIRV_LLVM_TRANSLATOR_SITE = $(call github,KhronosGroup,SPIRV-LLVM-Translator,$(SPIRV_LLVM_TRANSLATOR_VERSION))
> +SPIRV_LLVM_TRANSLATOR_LICENSE = Apache-2.0 with exceptions

  The license is actually NCSA...

  Regards,
  Arnout

> +SPIRV_LLVM_TRANSLATOR_LICENSE_FILES = LICENSE.TXT
> +HOST_SPIRV_LLVM_TRANSLATOR_DEPENDENCIES = host-clang host-llvm
> +HOST_SPIRV_LLVM_TRANSLATOR_CONF_OPTS = \
> +	-DLLVM_BUILD_TOOLS=ON \
> +	-DLLVM_DIR=$(HOST_DIR)/lib/cmake/llvm \
> +	-DLLVM_SPIRV_BUILD_EXTERNAL=YES \
> +	-DLLVM_SPIRV_INCLUDE_TESTS=OFF
> +
> +$(eval $(host-cmake-package))
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH v12 11/11] package/compiler-rt: runtime test use toolchain-wrapper
  2022-03-22 23:22 ` [Buildroot] [PATCH v12 11/11] package/compiler-rt: runtime test use toolchain-wrapper James Hilliard
@ 2022-06-20 19:34   ` Arnout Vandecappelle
  0 siblings, 0 replies; 22+ messages in thread
From: Arnout Vandecappelle @ 2022-06-20 19:34 UTC (permalink / raw)
  To: James Hilliard, buildroot
  Cc: Joseph Kogut, Bernd Kuhls, Matt Weber, Samuel Martin,
	Thomas Petazzoni, Romain Naour, Matt Weber, Valentin Korenblit



On 23/03/2022 00:22, James Hilliard wrote:
> From: Matt Weber <matthew.weber@rockwellcollins.com>
> 
> The toolchain wrapper for clang allows the build of the
> libfuzzer package to not point at "-B $(HOST_DIR)/opt/ext-toolchain"
> which prevents a build failure to link due to missing crtbeging.o
> and libgcc.

  I've reordered the patches and squashed this with the one that adds the test.

  Regards,
  Arnout

> 
> Signed-off-by: Matthew Weber <matthew.weber@rockwellcollins.com>
> ---
>   .../clang-compiler-rt/package/libfuzzer/libfuzzer.mk            | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/support/testing/tests/package/br2-external/clang-compiler-rt/package/libfuzzer/libfuzzer.mk b/support/testing/tests/package/br2-external/clang-compiler-rt/package/libfuzzer/libfuzzer.mk
> index 6c6371bea7..0515b9da35 100644
> --- a/support/testing/tests/package/br2-external/clang-compiler-rt/package/libfuzzer/libfuzzer.mk
> +++ b/support/testing/tests/package/br2-external/clang-compiler-rt/package/libfuzzer/libfuzzer.mk
> @@ -12,7 +12,7 @@ LIBFUZZER_DEPENDENCIES = compiler-rt
>   
>   define LIBFUZZER_BUILD_CMDS
>   	$(HOST_DIR)/bin/clang++ --sysroot=$(STAGING_DIR) \
> -		-B $(HOST_DIR)/opt/ext-toolchain -fsanitize=address,fuzzer \
> +		-fsanitize=address,fuzzer \
>   		$(@D)/tutorial/libFuzzer/fuzz_me.cc \
>   		-o $(@D)/fuzz_me
>   endef
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH v12 01/11] package/llvm: bump to version 11.1.0
  2022-03-22 23:22 [Buildroot] [PATCH v12 01/11] package/llvm: bump to version 11.1.0 James Hilliard
                   ` (9 preceding siblings ...)
  2022-03-22 23:22 ` [Buildroot] [PATCH v12 11/11] package/compiler-rt: runtime test use toolchain-wrapper James Hilliard
@ 2022-06-20 19:34 ` Arnout Vandecappelle
  10 siblings, 0 replies; 22+ messages in thread
From: Arnout Vandecappelle @ 2022-06-20 19:34 UTC (permalink / raw)
  To: James Hilliard, buildroot
  Cc: Joseph Kogut, Bernd Kuhls, Matt Weber, Samuel Martin,
	Thomas Petazzoni, Romain Naour, Matt Weber, Valentin Korenblit



On 23/03/2022 00:22, James Hilliard wrote:
> From: Matt Weber <matthew.weber@rockwellcollins.com>
> 
> Signed-off-by: Matthew Weber <matthew.weber@rockwellcollins.com>
> Signed-off-by: James Hilliard <james.hilliard1@gmail.com>

  Series applied to master, thanks!

  Regards,
  Arnout

> ---
> Changes v11 -> v12:
>    - add gcc 5 dependency due to c++14 requirement
>    - propagate gcc 5 reverse dependency
>    - remove unsupported config options
> ---
>   package/clang/Config.in  |  6 +++---
>   package/llvm/Config.in   |  6 +++---
>   package/llvm/llvm.hash   |  2 +-
>   package/llvm/llvm.mk     | 20 ++++++--------------
>   package/mesa3d/Config.in |  6 +++---
>   5 files changed, 16 insertions(+), 24 deletions(-)
> 
> diff --git a/package/clang/Config.in b/package/clang/Config.in
> index a67e7631a8..7c732c7af7 100644
> --- a/package/clang/Config.in
> +++ b/package/clang/Config.in
> @@ -1,7 +1,7 @@
>   config BR2_PACKAGE_CLANG
>   	bool "clang"
>   	depends on BR2_PACKAGE_LLVM_ARCH_SUPPORTS
> -	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_8
> +	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_5
>   	depends on BR2_TOOLCHAIN_HAS_THREADS
>   	depends on BR2_INSTALL_LIBSTDCPP
>   	depends on !BR2_TOOLCHAIN_HAS_GCC_BUG_64735 # std::shared_future
> @@ -14,10 +14,10 @@ config BR2_PACKAGE_CLANG
>   
>   	  http://clang.llvm.org
>   
> -comment "clang needs a toolchain w/ wchar, threads, C++, gcc >= 4.8, dynamic library"
> +comment "clang needs a toolchain w/ wchar, threads, C++, gcc >= 5, dynamic library"
>   	depends on BR2_PACKAGE_LLVM_ARCH_SUPPORTS
>   	depends on !BR2_TOOLCHAIN_HAS_THREADS || !BR2_INSTALL_LIBSTDCPP || \
> -		!BR2_TOOLCHAIN_GCC_AT_LEAST_4_8 \
> +		!BR2_TOOLCHAIN_GCC_AT_LEAST_5 \
>   		|| BR2_STATIC_LIBS || !BR2_USE_WCHAR
>   
>   comment "clang needs a toolchain not affected by GCC bug 64735"
> diff --git a/package/llvm/Config.in b/package/llvm/Config.in
> index 6ec2ffcfe6..c1887e36dd 100644
> --- a/package/llvm/Config.in
> +++ b/package/llvm/Config.in
> @@ -14,7 +14,7 @@ config BR2_PACKAGE_LLVM_TARGET_ARCH
>   config BR2_PACKAGE_LLVM
>   	bool "llvm"
>   	depends on BR2_PACKAGE_LLVM_ARCH_SUPPORTS
> -	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_8
> +	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_5
>   	depends on BR2_TOOLCHAIN_HAS_THREADS
>   	depends on BR2_INSTALL_LIBSTDCPP
>   	depends on !BR2_TOOLCHAIN_HAS_GCC_BUG_64735 # std::shared_future
> @@ -55,10 +55,10 @@ config BR2_PACKAGE_LLVM_BPF
>   
>   endif
>   
> -comment "llvm needs a toolchain w/ wchar, threads, C++, gcc >= 4.8, dynamic library"
> +comment "llvm needs a toolchain w/ wchar, threads, C++, gcc >= 5, dynamic library"
>   	depends on BR2_PACKAGE_LLVM_ARCH_SUPPORTS
>   	depends on !BR2_TOOLCHAIN_HAS_THREADS || !BR2_INSTALL_LIBSTDCPP || \
> -		!BR2_TOOLCHAIN_GCC_AT_LEAST_4_8 \
> +		!BR2_TOOLCHAIN_GCC_AT_LEAST_5 \
>   		|| BR2_STATIC_LIBS || !BR2_USE_WCHAR
>   
>   comment "llvm needs a toolchain not affected by GCC bug 64735"
> diff --git a/package/llvm/llvm.hash b/package/llvm/llvm.hash
> index 6bf2755777..e93a922492 100644
> --- a/package/llvm/llvm.hash
> +++ b/package/llvm/llvm.hash
> @@ -1,3 +1,3 @@
>   # locally calculated
> -sha256 00a1ee1f389f81e9979f3a640a01c431b3021de0d42278f6508391a2f0b81c9a llvm-9.0.1.src.tar.xz
> +sha256 ce8508e318a01a63d4e8b3090ab2ded3c598a50258cc49e2625b9120d4c03ea5 llvm-11.1.0.src.tar.xz
>   sha256 8d85c1057d742e597985c7d4e6320b015a9139385cff4cbae06ffc0ebe89afee LICENSE.TXT
> diff --git a/package/llvm/llvm.mk b/package/llvm/llvm.mk
> index 6c721c30b9..825de96392 100644
> --- a/package/llvm/llvm.mk
> +++ b/package/llvm/llvm.mk
> @@ -5,7 +5,7 @@
>   ################################################################################
>   
>   # LLVM, Clang and lld should be version bumped together
> -LLVM_VERSION = 9.0.1
> +LLVM_VERSION = 11.1.0
>   LLVM_SITE = https://github.com/llvm/llvm-project/releases/download/llvmorg-$(LLVM_VERSION)
>   LLVM_SOURCE = llvm-$(LLVM_VERSION).src.tar.xz
>   LLVM_LICENSE = Apache-2.0 with exceptions
> @@ -157,15 +157,9 @@ LLVM_CONF_OPTS += -DLLVM_ENABLE_PIC=ON
>   HOST_LLVM_CONF_OPTS += -DCMAKE_BUILD_TYPE=Release
>   LLVM_CONF_OPTS += -DCMAKE_BUILD_TYPE=Release
>   
> -# Disable C++1y (ISO C++ 2014 standard)
> -# Disable C++1z (ISO C++ 2017 standard)
> -# Compile llvm with the C++11 (ISO C++ 2011 standard) which is the fallback.
> -HOST_LLVM_CONF_OPTS += \
> -	-DLLVM_ENABLE_CXX1Y=OFF \
> -	-DLLVM_ENABLE_CXX1Z=OFF
> -LLVM_CONF_OPTS += \
> -	-DLLVM_ENABLE_CXX1Y=OFF \
> -	-DLLVM_ENABLE_CXX1Z=OFF
> +# Compile llvm with the C++14 (ISO C++ 2014 standard).
> +HOST_LLVM_CONF_OPTS += -DCMAKE_CXX_STANDARD=14
> +LLVM_CONF_OPTS += -DCMAKE_CXX_STANDARD=14
>   
>   # Disabled, requires sys/ndir.h header
>   # Disable debug in module
> @@ -237,13 +231,11 @@ endif
>   HOST_LLVM_CONF_OPTS += \
>   	-DLLVM_BUILD_EXTERNAL_COMPILER_RT=OFF \
>   	-DLLVM_BUILD_RUNTIME=OFF \
> -	-DLLVM_INCLUDE_RUNTIMES=OFF \
> -	-DLLVM_POLLY_BUILD=OFF
> +	-DLLVM_INCLUDE_RUNTIMES=OFF
>   LLVM_CONF_OPTS += \
>   	-DLLVM_BUILD_EXTERNAL_COMPILER_RT=OFF \
>   	-DLLVM_BUILD_RUNTIME=OFF \
> -	-DLLVM_INCLUDE_RUNTIMES=OFF \
> -	-DLLVM_POLLY_BUILD=OFF
> +	-DLLVM_INCLUDE_RUNTIMES=OFF
>   
>   HOST_LLVM_CONF_OPTS += \
>   	-DLLVM_ENABLE_WARNINGS=ON \
> diff --git a/package/mesa3d/Config.in b/package/mesa3d/Config.in
> index e41da562dc..b0ebc09212 100644
> --- a/package/mesa3d/Config.in
> +++ b/package/mesa3d/Config.in
> @@ -24,7 +24,7 @@ config BR2_PACKAGE_MESA3D_NEEDS_ELFUTILS
>   config BR2_PACKAGE_MESA3D_LLVM
>   	bool "llvm support"
>   	depends on BR2_PACKAGE_LLVM_ARCH_SUPPORTS
> -	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_8
> +	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_5
>   	depends on BR2_TOOLCHAIN_HAS_THREADS
>   	depends on BR2_INSTALL_LIBSTDCPP
>   	depends on !BR2_TOOLCHAIN_HAS_GCC_BUG_64735 # std::shared_future
> @@ -32,10 +32,10 @@ config BR2_PACKAGE_MESA3D_LLVM
>   	depends on BR2_USE_WCHAR # std::wstring
>   	select BR2_PACKAGE_LLVM
>   
> -comment "llvm support needs a toolchain w/ wchar, threads, C++, gcc >= 4.8, dynamic library"
> +comment "llvm support needs a toolchain w/ wchar, threads, C++, gcc >= 5, dynamic library"
>   	depends on BR2_PACKAGE_LLVM_ARCH_SUPPORTS
>   	depends on !BR2_TOOLCHAIN_HAS_THREADS || !BR2_INSTALL_LIBSTDCPP || \
> -		!BR2_TOOLCHAIN_GCC_AT_LEAST_4_8 \
> +		!BR2_TOOLCHAIN_GCC_AT_LEAST_5 \
>   		|| BR2_STATIC_LIBS || !BR2_USE_WCHAR
>   
>   comment "llvm support needs a toolchain not affected by GCC bug 64735"
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

end of thread, other threads:[~2022-06-20 19:34 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-22 23:22 [Buildroot] [PATCH v12 01/11] package/llvm: bump to version 11.1.0 James Hilliard
2022-03-22 23:22 ` [Buildroot] [PATCH v12 02/11] package/clang: " James Hilliard
2022-03-22 23:22 ` [Buildroot] [PATCH v12 03/11] package/lld: " James Hilliard
2022-03-22 23:22 ` [Buildroot] [PATCH v12 04/11] package/spirv-llvm-translator: new package James Hilliard
2022-06-20 19:01   ` Arnout Vandecappelle
2022-03-22 23:22 ` [Buildroot] [PATCH v12 05/11] support/misc/toolchainfile.cmake.in: allow variables to be overridden James Hilliard
2022-03-31 20:38   ` Romain Naour
2022-03-31 21:29     ` James Hilliard
2022-03-22 23:22 ` [Buildroot] [PATCH v12 06/11] package/libclc: bump version to 13.0.1 James Hilliard
2022-03-31 20:50   ` Romain Naour
2022-03-31 21:38     ` James Hilliard
2022-04-02 17:11       ` Arnout Vandecappelle
2022-04-02 18:13         ` James Hilliard
2022-03-22 23:22 ` [Buildroot] [PATCH v12 07/11] package/compiler-rt: new package James Hilliard
2022-03-22 23:22 ` [Buildroot] [PATCH v12 08/11] testing/tests: CLANG compiler-rt runtime test James Hilliard
2022-03-22 23:22 ` [Buildroot] [PATCH v12 09/11] package/clang: help host-clang to find our external toolchain James Hilliard
2022-03-31 21:04   ` Romain Naour
2022-03-31 21:40     ` James Hilliard
2022-03-22 23:22 ` [Buildroot] [PATCH v12 10/11] package/clang: install a toolchain-wrapper for the host clang cross-compiler James Hilliard
2022-03-22 23:22 ` [Buildroot] [PATCH v12 11/11] package/compiler-rt: runtime test use toolchain-wrapper James Hilliard
2022-06-20 19:34   ` Arnout Vandecappelle
2022-06-20 19:34 ` [Buildroot] [PATCH v12 01/11] package/llvm: bump to version 11.1.0 Arnout Vandecappelle

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.