package/llvm: bump to version 11.1.0
PATCH v11 1/9 package/llvm: bump to version 11.1.0
--- package/llvm/llvm.hash | 2 +- package/llvm/llvm.mk | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
package/llvm/llvm.hash +1 -1
@@ -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
package/llvm/llvm.mk +1 -1
@@ -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
Signature · 1 line
2.17.1
PATCH v11 2/9 package/clang: bump to version 11.1.0
--- package/clang/clang.hash | 2 +- package/clang/clang.mk | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-)
package/clang/clang.hash +1 -1
@@ -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
package/clang/clang.mk +2 -1
@@ -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
Signature · 1 line
2.17.1
PATCH v11 3/9 package/lld: bump to version 11.1.0
In reply to Matt Weber--- package/lld/lld.hash | 2 +- package/lld/lld.mk | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
package/lld/lld.hash +1 -1
@@ -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
package/lld/lld.mk +1 -1
@@ -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
Signature · 1 line
2.17.1
PATCH v11 4/9 package/libclc: bump version to 11.1.0
In reply to Matt Weber * 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
--- .../0001-support-out-of-tree-build.patch | 71 +++++++++++++++++++ package/libclc/libclc.hash | 2 +- package/libclc/libclc.mk | 42 +++-------- 3 files changed, 83 insertions(+), 32 deletions(-) create mode 100644 package/libclc/0001-support-out-of-tree-build.patch
package/libclc/0001-support-out-of-tree-build.patch new file +71 -0
@@ -0,0 +1,71 @@ +From 495491e9d53bfb184c15753b5187e4bb55b19511 Mon Sep 17 00:00:00 2001 +From: Matt Weber <[email protected]> +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 <[email protected]> +--- + 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 +
package/libclc/libclc.hash +1 -1
@@ -1,3 +1,3 @@ # locally calculated -sha256 54d7ae523aabf68d533011739d6c01546cae0c294442d0f44fd657c046cb707d libclc-d1cbc92e2ceee59963f5c3a576382e5bba31f060-br1.tar.gz +sha256 198dc45cdcc426c7968b9628a55062162ea338931157a18ddefb47188d119e1d libclc-11.1.0.src.tar.xz sha256 3c536c052db9afd997809e38785c9f2a9e54e2892330fa7c5b438e18a7413479 LICENSE.TXT
package/libclc/libclc.mk +11 -31
54 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v11 4/9 package/libclc: bump version to 11.1.0
Romain,
Quoted 8 lines · Matt Weber
* Converts to the cmake pkg type
* Updates download site
* Adds a crosscompile fixups patch
* Allowprepare_builtinsutility to be directly called (it isn't installed into the path when cross compiling)
* Fixfile_find()for root search limitation
Do you have a way to runtime test libclc? I've verified mesa3d and the library all built correctly on x86 and ARM64
Quoted 156 lines
Signed-off-by Matthew Weber <[email protected]>--- .../0001-support-out-of-tree-build.patch | 71 +++++++++++++++++++ package/libclc/libclc.hash | 2 +- package/libclc/libclc.mk | 42 +++-------- 3 files changed, 83 insertions(+), 32 deletions(-) create mode 100644 package/libclc/0001-support-out-of-tree-build.patchpackage/libclc/0001-support-out-of-tree-build.patch new file +71
-0@@ -0,0 +1,71 @@ +From 495491e9d53bfb184c15753b5187e4bb55b19511 Mon Sep 17 00:00:00 2001 +From: Matt Weber <[email protected]> +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 <[email protected]> +--- + 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 +package/libclc/libclc.hash +1
-1@@ -1,3 +1,3 @@ # locally calculated -sha256 54d7ae523aabf68d533011739d6c01546cae0c294442d0f44fd657c046cb707d libclc-d1cbc92e2ceee59963f5c3a576382e5bba31f060-br1.tar.gz +sha256 198dc45cdcc426c7968b9628a55062162ea338931157a18ddefb47188d119e1d libclc-11.1.0.src.tar.xz sha256 3c536c052db9afd997809e38785c9f2a9e54e2892330fa7c5b438e18a7413479 LICENSE.TXTpackage/libclc/libclc.mk +11
-32@@ -4,43 +4,23 @@ # ################################################################################ -# 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 = 11.1.0 +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_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 # -# 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. +# CMAKE_CXX_COMPILER has to be set to the host compiler to build a host +# 'prepare_builtins' tool used during the build process 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) + -DCMAKE_CLC_COMPILER_FORCED=ON \ + -DCMAKE_LLAsm_COMPILER_FORCED=ON \ + -DCMAKE_CXX_COMPILER="$(CMAKE_HOST_CXX_COMPILER)" -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)) +$(eval $(cmake-package)) --2.17.1
PATCH v11 4/9 package/libclc: bump version to 11.1.0
" Romain,
Quoted 144 lines · Matthew Weber
Romain,
Quoted 8 lines · Matt Weber
* Converts to the cmake pkg type
* Updates download site
* Adds a crosscompile fixups patch
* Allowprepare_builtinsutility to be directly called (it isn't installed into the path when cross compiling)
* Fixfile_find()for root search limitationDo you have a way to runtime test libclc? I've verified mesa3d and the library all built correctly on x86 and ARM64
Quoted 126 lines
Signed-off-by Matthew Weber <[email protected]>--- .../0001-support-out-of-tree-build.patch | 71 +++++++++++++++++++ package/libclc/libclc.hash | 2 +- package/libclc/libclc.mk | 42 +++-------- 3 files changed, 83 insertions(+), 32 deletions(-) create mode 100644 package/libclc/0001-support-out-of-tree-build.patchpackage/libclc/0001-support-out-of-tree-build.patch new file +71
-0@@ -0,0 +1,71 @@ +From 495491e9d53bfb184c15753b5187e4bb55b19511 Mon Sep 17 00:00:00 2001 +From: Matt Weber <[email protected]> +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 <[email protected]> +--- + 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 +package/libclc/libclc.hash +1
-1@@ -1,3 +1,3 @@ # locally calculated -sha256 54d7ae523aabf68d533011739d6c01546cae0c294442d0f44fd657c046cb707d libclc-d1cbc92e2ceee59963f5c3a576382e5bba31f060-br1.tar.gz +sha256 198dc45cdcc426c7968b9628a55062162ea338931157a18ddefb47188d119e1d libclc-11.1.0.src.tar.xz sha256 3c536c052db9afd997809e38785c9f2a9e54e2892330fa7c5b438e18a7413479 LICENSE.TXTpackage/libclc/libclc.mk +7
-9@@ -4,43 +4,23 @@ # ################################################################################ -# 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 = 11.1.0 +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_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 # -# 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. +# CMAKE_CXX_COMPILER has to be set to the host compiler to build a host +# 'prepare_builtins' tool used during the build process LIBCLC_CONF_OPTS = \
Quoted 8 lines
package/libclc/libclc.mk line 24
Quoted 8 lines
package/libclc/libclc.mk +3
-5- --with-llvm-config=$(HOST_DIR)/usr/bin/llvm-config \ - --prefix=/usr \ - --includedir=/usr/share \ - --pkgconfigdir=/usr/lib/pkgconfig \ - --with-cxx-compiler=$(HOSTCXX_NOCCACHE) + -DCMAKE_CLC_COMPILER_FORCED=ON \ + -DCMAKE_LLAsm_COMPILER_FORCED=ON \ + -DCMAKE_CXX_COMPILER="$(CMAKE_HOST_CXX_COMPILER)"
Looks like I have a couple of bugs (I didn't have opencl checked in menuconfig)
1) mesa3d.mk needs MESA3D_MESON_EXTRA_BINARIES += llvm-config='$(STAGING_DIR)/bin/llvm-config' updated to point to the HOST_DIR llvm-config because it needs to be able to execute the tool. However this doesn't work since then you get the "host/lib/libLLVM-11.so when searching for -lLLVM-11 " error which makes sense since that's the host llvm-config we pointed at..... Unsure how to solve this one and we don't notice it in x86 builds. When you enable the AMD Radeon to build for aarch64 you can cause this error.
2) mesa3d doesn't quite build (pkgconfig can't find libclc). I didn't catch that CMAKE_INSTALL_PREFIX is getting ignored (we set it in the pkg-cmake.mk infra) so the libclc.pc is getting installed in $HOST_DIR/usr/local/share vs $HOST_DIR/usr/share . I haven't been able to figure out why the value doesn't take hold (ie after the configuration step libclc-11.1.0/CMakeCache.txt still shows /usr/local unless I force set the CMAKE_INSTALL_PREFIX value in libclc-11.1.0/CMakeList.txt before project().
Matt
PATCH v11 4/9 package/libclc: bump version to 11.1.0
Hi Matt,
I was going to apply this series to next...
On 11/03/2021 20:37, Matthew Weber via buildroot wrote:
[snip]
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
package/libclc/libclc.mk +4
-7-# 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 # -# 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. +# CMAKE_CXX_COMPILER has to be set to the host compiler to build a host +# 'prepare_builtins' tool used during the build process LIBCLC_CONF_OPTS = \ - --with-llvm-config=$(HOST_DIR)/usr/bin/llvm-config \ - --prefix=/usr \
Quoted 8 lines
Quoted 6 lines
package/libclc/libclc.mk line 24
Quoted 6 lines
package/libclc/libclc.mk +3
-3- --includedir=/usr/share \ - --pkgconfigdir=/usr/lib/pkgconfig \ - --with-cxx-compiler=$(HOSTCXX_NOCCACHE) + -DCMAKE_CLC_COMPILER_FORCED=ON \ + -DCMAKE_LLAsm_COMPILER_FORCED=ON \ + -DCMAKE_CXX_COMPILER="$(CMAKE_HOST_CXX_COMPILER)"Looks like I have a couple of bugs (I didn't have opencl checked in menuconfig)
... but then I saw this. So I didn't. Instead, I've marked the series as Changes Requested. If you think it should be applied after all, please repost (or just update patchwork if unchanged).
Oh, and 12.0.0 has been released now...
Quoted 3 lines
1) mesa3d.mk needs
MESA3D_MESON_EXTRA_BINARIES+= llvm-config='$(STAGING_DIR)/bin/llvm-config' updated to point to the
Normally, the foo-config programs are script, so it's OK to use the one in
staging. If it's an actual binary, we have to somehow patch it so it has target config but compiles for host.
I'd expect llvm and related to be cross-compile friendly though...
Quoted 8 lines
HOST_DIRllvm-config because it needs to be able to execute the tool. However this doesn't work since then you get the "host/lib/libLLVM-11.so when searching for -lLLVM-11 " error which makes sense since that's the host llvm-config we pointed at..... Unsure how to solve this one and we don't notice it in x86 builds. When you enable the AMD Radeon to build for aarch64 you can cause this error.
Quoted 8 lines
2) mesa3d doesn't quite build (pkgconfig can't find libclc). I didn't catch that
CMAKE_INSTALL_PREFIXis getting ignored (we set it in the pkg-cmake.mk infra) so the libclc.pc is getting installed in $HOST_DIR/usr/local/share vs $HOST_DIR/usr/share . I haven't been able to figure out why the value doesn't take hold (ie after the configuration steplibclc-11.1.0/CMakeCache.txtstill shows/usr/localunless I force set theCMAKE_INSTALL_PREFIXvalue inlibclc-11.1.0/CMakeList.txtbeforeproject().
That *is* weird...
Regards,
Arnout
Quoted 8 lines
Matt
_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
Weber
[Buildroot] [External] Re: [PATCH v11 4/9] package/libclc: bump version to 11.1.0
Arnout,
Quoted 43 lines
-----Original Message-----
From: Arnout Vandecappelle <[email protected]>
Sent: Tuesday, May 18, 2021 4:04 PM
To: Weber, Matthew L Collins <[email protected]>; buildroot <[email protected]>
Cc: Joseph Kogut <[email protected]>; Romain Naour <[email protected]>; Samuel Martin <[email protected]>; Thomas Petazzoni <[email protected]>; Valentin Korenblit <[email protected]>
Subject: [External] Re: [Buildroot] [PATCH v11 4/9] package/libclc: bump version to 11.1.0Hi Matt,
I was going to apply this series to next...
On 11/03/2021 20:37, Matthew Weber via buildroot wrote:
[snip]Quoted 1 line
Quoted 1 line
Quoted 1 line
-# C++ compiler is used to build a small tool (prepare-builtins) for the
host.
Quoted 2 lines
Quoted 2 lines
Review
Quoted 2 lines
(quoted diff) +1
-1-# It must be built with the C++ compiler from the host. +# CMAKE_*_COMPILER_FORCED=ON skips testing the tools andassumes #
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
(quoted diff) +1
-1+llvm-config provided values # -# The headers are installed in /usr/share and not /usr/include, -#because they are needed at runtime on the target to build the OpenCL
package/libclc/libclc.mk +2
-4-# kernels. +# CMAKE_CXX_COMPILER has to be set to the host compiler to build a +host # 'prepare_builtins' tool used during the build process LIBCLC_CONF_OPTS = \ - --with-llvm-config=$(HOST_DIR)/usr/bin/llvm-config \ - --prefix=/usr \ - --includedir=/usr/share \Quoted 8 lines
Quoted 5 lines
package/libclc/libclc.mk line 24
Quoted 5 lines
package/libclc/libclc.mk +3
-2- --pkgconfigdir=/usr/lib/pkgconfig \ - --with-cxx-compiler=$(HOSTCXX_NOCCACHE) + -DCMAKE_CLC_COMPILER_FORCED=ON \ + -DCMAKE_LLAsm_COMPILER_FORCED=ON \ + -DCMAKE_CXX_COMPILER="$(CMAKE_HOST_CXX_COMPILER)"Looks like I have a couple of bugs (I didn't have opencl checked in menuconfig)
Quoted 3 lines
... but then I saw this. So I didn't. Instead, I've marked the series as Changes Requested. If you think it should be applied after all, please repost (or just update patchwork if unchanged).
Thx, this is definitely still broken. I'll update the version as well when I take another look.
-Matt
Quoted 46 lines
Oh, and 12.0.0 has been released now...
Quoted 3 lines
1) mesa3d.mk needs
MESA3D_MESON_EXTRA_BINARIES+= llvm-config='$(STAGING_DIR)/bin/llvm-config' updated to point to theNormally, the foo-config programs are script, so it's OK to use the one in
staging. If it's an actual binary, we have to somehow patch it so it has target config but compiles for host.I'd expect llvm and related to be cross-compile friendly though...
Quoted 8 lines
HOST_DIRllvm-config because it needs to be able to execute the tool. However this doesn't work since then you get the "host/lib/libLLVM-11.so when searching for -lLLVM-11 " error which makes sense since that's the host llvm-config we pointed at..... Unsure how to solve this one and we don't notice it in x86 builds. When you enable the AMD Radeon to build for aarch64 you can cause this error.Quoted 8 lines
2) mesa3d doesn't quite build (pkgconfig can't find libclc). I didn't catch that
CMAKE_INSTALL_PREFIXis getting ignored (we set it in the pkg-cmake.mk infra) so the libclc.pc is getting installed in $HOST_DIR/usr/local/share vs $HOST_DIR/usr/share . I haven't been able to figure out why the value doesn't take hold (ie after the configuration steplibclc-11.1.0/CMakeCache.txtstill shows/usr/localunless I force set theCMAKE_INSTALL_PREFIXvalue inlibclc-11.1.0/CMakeList.txtbeforeproject().That *is* weird...
Regards,
ArnoutQuoted 8 lines
Matt
_______________________________________________
buildroot mailing list
buildroot at busybox.net
https://urldefense.com/v3/__http://lists.busybox.net/mailman/listinfo/
buildroot__;!!MvWE!SQZRb-v4QExXQlkcTN3XlQyQjWlvHZdLk91QeKU2DXoT1xjmvjZ
Quoted 2 lines
TjEB3aW0gMBkR77hW$
Re: [Buildroot] [PATCH v11 4/9] package/libclc: bump version to 11.1.0
In reply to Arnout VandecappelleQuoted 62 lines · Arnout Vandecappelle
Hi Matt,
I was going to apply this series to next...
On 11/03/2021 20:37, Matthew Weber via buildroot wrote:
[snip]Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
package/libclc/libclc.mk +4
-7-# 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 # -# 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. +# CMAKE_CXX_COMPILER has to be set to the host compiler to build a host +# 'prepare_builtins' tool used during the build process LIBCLC_CONF_OPTS = \ - --with-llvm-config=$(HOST_DIR)/usr/bin/llvm-config \ - --prefix=/usr \Quoted 8 lines
Quoted 6 lines
package/libclc/libclc.mk line 24
Quoted 6 lines
package/libclc/libclc.mk +3
-3- --includedir=/usr/share \ - --pkgconfigdir=/usr/lib/pkgconfig \ - --with-cxx-compiler=$(HOSTCXX_NOCCACHE) + -DCMAKE_CLC_COMPILER_FORCED=ON \ + -DCMAKE_LLAsm_COMPILER_FORCED=ON \ + -DCMAKE_CXX_COMPILER="$(CMAKE_HOST_CXX_COMPILER)"Looks like I have a couple of bugs (I didn't have opencl checked in menuconfig)
... but then I saw this. So I didn't. Instead, I've marked the series as Changes Requested. If you think it should be applied after all, please repost (or just update patchwork if unchanged).
Oh, and 12.0.0 has been released now...
Quoted 3 lines
1) mesa3d.mk needs
MESA3D_MESON_EXTRA_BINARIES+= llvm-config='$(STAGING_DIR)/bin/llvm-config' updated to point to theNormally, the foo-config programs are script, so it's OK to use the one in
staging. If it's an actual binary, we have to somehow patch it so it has target config but compiles for host.I'd expect llvm and related to be cross-compile friendly though...
Quoted 8 lines
HOST_DIRllvm-config because it needs to be able to execute the tool. However this doesn't work since then you get the "host/lib/libLLVM-11.so when searching for -lLLVM-11 " error which makes sense since that's the host llvm-config we pointed at..... Unsure how to solve this one and we don't notice it in x86 builds. When you enable the AMD Radeon to build for aarch64 you can cause this error.Quoted 8 lines
2) mesa3d doesn't quite build (pkgconfig can't find libclc). I didn't catch that
CMAKE_INSTALL_PREFIXis getting ignored (we set it in the pkg-cmake.mk infra) so the libclc.pc is getting installed in $HOST_DIR/usr/local/share vs $HOST_DIR/usr/share . I haven't been able to figure out why the value doesn't take hold (ie after the configuration steplibclc-11.1.0/CMakeCache.txtstill shows/usr/localunless I force set theCMAKE_INSTALL_PREFIXvalue inlibclc-11.1.0/CMakeList.txtbeforeproject().
Quoted 1 line
That *is* weird...
This should fix the CMAKE_INSTALL_PREFIX issue:
https://patchwork.ozlabs.org/project/buildroot/patch/[email protected]/
Quoted 12 lines
Regards,
ArnoutQuoted 8 lines
Matt
_______________________________________________
buildroot mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/buildroot
Quoted 4 lines
_______________________________________________
buildroot mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/buildroot
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH v11 5/9 package/compiler-rt: new package
In reply to Matt WeberThis 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
---
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
--- 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 | 11 ++++++++- 6 files changed, 66 insertions(+), 1 deletion(-) 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
DEVELOPERS +1 -0
@@ -1709,6 +1709,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/
package/Config.in +1 -0
@@ -1856,6 +1856,7 @@ menu "Other" source "package/clang/Config.in" source "package/clapack/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"
package/compiler-rt/Config.in new file +14 -0
@@ -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
package/compiler-rt/compiler-rt.hash new file +3 -0
@@ -0,0 +1,3 @@ +# Locally computed: +sha256 def1fc00c764cd3abbba925c712ac38860a756a43b696b291f46fee09e453274 compiler-rt-11.1.0.src.tar.xz +sha256 1a8f1058753f1ba890de984e48f0242a3a5c29a6a8f2ed9fd813f36985387e8d LICENSE.TXT
package/compiler-rt/compiler-rt.mk new file +37 -0
@@ -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))
package/llvm/llvm.mk +10 -1
@@ -215,8 +215,17 @@ 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_INCLUDE_TOOLS=ON + +# The llvm-symbolizer binary is used by the Compiler-RT Fuzzer +# and AddressSanitizer tools for stack traces. +ifeq ($(BR2_PACKAGE_COMPILER_RT),y) +LLVM_CONF_OPTS += \ + -DLLVM_BUILD_TOOLS=ON +else +LLVM_CONF_OPTS += \ -DLLVM_BUILD_TOOLS=OFF +endif ifeq ($(BR2_PACKAGE_LLVM_RTTI),y) HOST_LLVM_CONF_OPTS += -DLLVM_ENABLE_RTTI=ON
Signature · 1 line
2.17.1
PATCH v11 6/9 testing/tests: CLANG compiler-rt runtime test
In reply to Matt WeberThis 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).
---
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
support/testing/tests/package/br2-external/clang-compiler-rt/Config.in new file +1 -0
@@ -0,0 +1 @@ +source "$BR2_EXTERNAL_CLANG_COMPILER_RT_PATH/package/libfuzzer/Config.in"
support/testing/tests/package/br2-external/clang-compiler-rt/external.desc new file +1 -0
@@ -0,0 +1 @@ +name: CLANG_COMPILER_RT
support/testing/tests/package/br2-external/clang-compiler-rt/external.mk new file +1 -0
@@ -0,0 +1 @@ +include $(sort $(wildcard $(BR2_EXTERNAL_CLANG_COMPILER_RT_PATH)/package/*/*.mk))
support/testing/tests/package/br2-external/clang-compiler-rt/package/libfuzzer/Config.in new file +8 -0
@@ -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
support/testing/tests/package/br2-external/clang-compiler-rt/package/libfuzzer/libfuzzer.hash new file +2 -0
@@ -0,0 +1,2 @@ +sha256 c71360c3b1ba1d88b28b0b3cb3a1744d251b87a12f2881224cc53ec26eb7a2db libfuzzer-cec02db916d21baa4db5b8d262d78848b3a35f4b.tar.gz +sha256 cfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30 LICENSE
support/testing/tests/package/br2-external/clang-compiler-rt/package/libfuzzer/libfuzzer.mk new file +24 -0
@@ -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))
support/testing/tests/package/test_clang.py new file +46 -0
46 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v11 7/9 package/clang: help host-clang to find our external toolchain
In reply to Matt WeberFrom: Romain Naour <[email protected]>
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/libHere 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
---
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
package/clang/0001-lib-Driver-ToolChains-Gnu-Use-GCC_INSTALL_PREFIX-in-.patch new file +78 -0
@@ -0,0 +1,78 @@ +From fe21cede3939a435d62efbd5799547fab6af1b0a Mon Sep 17 00:00:00 2001 +From: Romain Naour <[email protected]> +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 <[email protected]> +Signed-off-by: Matthew Weber <[email protected]> +--- +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 +
package/clang/clang.mk +7 -0
@@ -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))
Signature · 1 line
2.17.1
PATCH v11 8/9 package/clang: install a toolchain-wrapper for the host clang cross-compiler
In reply to Matt WeberFrom: Romain Naour <[email protected]>
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.
---
Changes
v1 -> v2
[Arnout
- Fixup commit description and clarified *.br_real
- Simplified loop
--- package/clang/clang.mk | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+)
package/clang/clang.mk +28 -0
@@ -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))
Signature · 1 line
2.17.1
PATCH v11 9/9 package/compiler-rt: runtime test use toolchain-wrapper
In reply to Matt WeberThe 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.
--- .../clang-compiler-rt/package/libfuzzer/libfuzzer.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
support/testing/tests/package/br2-external/clang-compiler-rt/package/libfuzzer/libfuzzer.mk +1 -1
@@ -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
Signature · 1 line
2.17.1