package/compiler-rt: new package
PATCH v8 1/2 package/compiler-rt: new package
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.
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
--- 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
@@ -1522,6 +1522,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
@@ -1700,6 +1700,7 @@ menu "Other" source "package/clapack/Config.in" source "package/classpath/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 56e4cd96dd1d8c346b07b4d6b255f976570c6f2389697347a6c3dcb9e820d10e compiler-rt-9.0.0.src.tar.xz +sha256 dd27f8c290bcdc8368549cd7cd98710a9dbdc34122f2e096a1edb97824ed4148 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 = 9.0.0 +COMPILER_RT_SOURCE = compiler-rt-$(COMPILER_RT_VERSION).src.tar.xz +COMPILER_RT_SITE = http://llvm.org/releases/$(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
@@ -217,8 +217,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 # Compiler-rt not in the source tree. # llvm runtime libraries are not in the source tree.
Signature · 1 line
2.17.1
PATCH v8 1/2 package/compiler-rt: new package
All,
Quoted 5 lines · Matt Weber
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.
This patch series for compiler-rt and runtime testing requires the following minimal list of patches from Romain's clang cross series. These patches setup clang such that it functions to compile target executables but doesn't expose this option as a formal cross compiler.
http://patchwork.ozlabs.org/patch/1159304/
http://patchwork.ozlabs.org/patch/1159303/
http://patchwork.ozlabs.org/patch/1159306/
http://patchwork.ozlabs.org/patch/1159311/
Quoted 192 lines
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/AddressSanitizerCallStackSigned-off-by Matthew Weber <[email protected]>Cc Romain Naour <[email protected]>Cc Ricardo Martincoski <[email protected]>Cc Valentin Korenblit <[email protected]>Cc Michael Drake <[email protected]>---
Changes
v1 -> v2
[Romain
- Removed unnecessary host-cmake dependencyv2 -> v3
[Romain
- Update to useCOMPILER_RT_INSTALL_PATHfor library install
[Ricardo
- Fixed check-package extra line
- Spelling in commit messagev3 -> 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 pathv6
- Bumped to 7.0.1 to match current LLVM/Clang versionv7
- 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--- 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.mkDEVELOPERS +1
-0@@ -1522,6 +1522,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@@ -1700,6 +1700,7 @@ menu "Other" source "package/clapack/Config.in" source "package/classpath/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_GLIBCpackage/compiler-rt/compiler-rt.hash new file +3
-0@@ -0,0 +1,3 @@ +# Locally computed: +sha256 56e4cd96dd1d8c346b07b4d6b255f976570c6f2389697347a6c3dcb9e820d10e compiler-rt-9.0.0.src.tar.xz +sha256 dd27f8c290bcdc8368549cd7cd98710a9dbdc34122f2e096a1edb97824ed4148 LICENSE.TXTpackage/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 = 9.0.0 +COMPILER_RT_SOURCE = compiler-rt-$(COMPILER_RT_VERSION).src.tar.xz +COMPILER_RT_SITE = http://llvm.org/releases/$(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
-2@@ -217,8 +217,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 # Compiler-rt not in the source tree. # llvm runtime libraries are not in the source tree. --2.17.1
Signature · 23 lines
Matthew Weber | Associate Director Software Engineer | Commercial Avionics COLLINS AEROSPACE 400 Collins Road NE, Cedar Rapids, Iowa 52498, USA Tel: +1 319 295 7349 | FAX: +1 319 263 6099 matthew.weber at collins.com | collinsaerospace.com CONFIDENTIALITY WARNING: This message may contain proprietary and/or privileged information of Collins Aerospace and its affiliated companies. If you are not the intended recipient, please 1) Do not disclose, copy, distribute or use this message or its contents. 2) Advise the sender by return email. 3) Delete all copies (including all attachments) from your computer. Your cooperation is greatly appreciated. Any export restricted material should be shared using my matthew.weber at corp.rockwellcollins.com address.
PATCH v8 1/2 package/compiler-rt: new package
Hi Matt,
I have a few questions about your compiler-rt patch, see below.
Quoted 28 lines · Matthew Weber
Quoted 26 lines · Matt Weber
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.
package/compiler-rt/compiler-rt.mk new file +15
-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 = 9.0.0 +COMPILER_RT_SOURCE = compiler-rt-$(COMPILER_RT_VERSION).src.tar.xz +COMPILER_RT_SITE = http://llvm.org/releases/$(COMPILER_RT_VERSION) +COMPILER_RT_LICENSE = NCSA MIT +COMPILER_RT_LICENSE_FILES = LICENSE.TXT +COMPILER_RT_DEPENDENCIES = host-clang llvm +
Quoted 8 lines
package/compiler-rt/compiler-rt.mk line 23
Quoted 8 lines
package/compiler-rt/compiler-rt.mk new file +8
-0+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 +
You set both:
-DCOMPILER_RT_STANDALONE_BUILD=OFF
-DCOMPILER_RT_STANDALONE_BUILD=ON
Presumably you just mean the second?
Quoted 5 lines
Quoted 5 lines
package/compiler-rt/compiler-rt.mk new file +5
-0+# 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
Quoted 8 lines
package/compiler-rt/compiler-rt.mk line 36
Quoted 8 lines
package/compiler-rt/compiler-rt.mk new file +8
-0+# 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 +
The second of those symlinks should only go up three directories.
Also, why do you create symlinks into $(HOST_DIR) from a "target" package? Why not just add host-compiler-rt logic and depend on "host-compiler-rt" where appropriate? Then you could remove this define entirely. I'd also add:
HOST_COMPILER_RT_CONF_OPTS = $(COMPILER_RT_CONF_OPTS)
The default target is still the same. I'm testing this at the minute.
Thanks,
Thomas Preston
PATCH v8 1/2 package/compiler-rt: new package
Quoted 19 lines · Thomas Preston
Quoted 15 lines · Matthew Weber
package/compiler-rt/compiler-rt.mk line 36
Quoted 13 lines · Matt Weber
package/compiler-rt/compiler-rt.mk new file +13
-0+# 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 +The second of those symlinks should only go up three directories.
Quoted 8 lines
Also, why do you create symlinks into $(HOST_DIR) from a "target" package? Why not just add host-compiler-rt logic and depend on "host-compiler-rt" where appropriate? Then you could remove this define entirely. I'd also add:
HOST_COMPILER_RT_CONF_OPTS = $(COMPILER_RT_CONF_OPTS)The default target is still the same. I'm testing this at the minute.
Actually scratch that, host-compiler-rt would build a compiler-rt for the host system - which we don't want.
host-clang expects to find lib/linux and share (target) compiler-rt files, which is what these symlinks provide.
Sorry for spam, although my other two comments still apply.
Thanks
PATCH v8 1/2 package/compiler-rt: new package
In reply to Matt WeberHi Matt,
Le 23/10/2019 ? 23:46, Matt Weber a ?crit?:
Quoted 135 lines
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.
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/AddressSanitizerCallStackSigned-off-by Matthew Weber <[email protected]>Cc Romain Naour <[email protected]>Cc Ricardo Martincoski <[email protected]>Cc Valentin Korenblit <[email protected]>Cc Michael Drake <[email protected]>---
Changes
v1 -> v2
[Romain
- Removed unnecessary host-cmake dependencyv2 -> v3
[Romain
- Update to useCOMPILER_RT_INSTALL_PATHfor library install
[Ricardo
- Fixed check-package extra line
- Spelling in commit messagev3 -> 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 pathv6
- Bumped to 7.0.1 to match current LLVM/Clang versionv7
- 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--- 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.mkDEVELOPERS +1
-0@@ -1522,6 +1522,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@@ -1700,6 +1700,7 @@ menu "Other" source "package/clapack/Config.in" source "package/classpath/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_GLIBCpackage/compiler-rt/compiler-rt.hash new file +3
-0@@ -0,0 +1,3 @@ +# Locally computed: +sha256 56e4cd96dd1d8c346b07b4d6b255f976570c6f2389697347a6c3dcb9e820d10e compiler-rt-9.0.0.src.tar.xz +sha256 dd27f8c290bcdc8368549cd7cd98710a9dbdc34122f2e096a1edb97824ed4148 LICENSE.TXTpackage/compiler-rt/compiler-rt.mk new file +2
-0@@ -0,0 +1,37 @@ +################################################################################ +#
package/compiler-rt/compiler-rt.mk line 12
Quoted 10 lines
package/compiler-rt/compiler-rt.mk new file +10
-0+# 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 = 9.0.0 +COMPILER_RT_SOURCE = compiler-rt-$(COMPILER_RT_VERSION).src.tar.xz +COMPILER_RT_SITE = http://llvm.org/releases/$(COMPILER_RT_VERSION) +COMPILER_RT_LICENSE = NCSA MIT
With LLVM 9.0.0, the LLVM based packages has been relicensed to the Apache License 2.0 with LLVM Exceptions.
It guess you upadated the license file hash accordingly :)
See you tomorrow,
Romain
Quoted 49 lines
package/compiler-rt/compiler-rt.mk new file +25
-0+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@@ -217,8 +217,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 # Compiler-rt not in the source tree. # llvm runtime libraries are not in the source tree.
PATCH v8 2/2 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.
Depends on the following Clang cross-compiler series to be applied first.
http://patchwork.ozlabs.org/project/buildroot/list/?series=129565
[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]
---
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
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
--- .gitlab-ci.yml | 1 + .../br2-external/clang-compiler-rt/Config.in | 1 + .../clang-compiler-rt/external.desc | 1 + .../clang-compiler-rt/external.mk | 1 + .../package/libfuzzer/Config.in | 7 +++ .../package/libfuzzer/libfuzzer.hash | 2 + .../package/libfuzzer/libfuzzer.mk | 24 ++++++++++ support/testing/tests/package/test_clang.py | 46 +++++++++++++++++++ 8 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
.gitlab-ci.yml +1 -0
@@ -372,6 +372,7 @@ tests.init.test_systemd.TestInitSystemSystemdRwFull: { extends: .runtime_test } tests.init.test_systemd.TestInitSystemSystemdRwIfupdown: { extends: .runtime_test } tests.init.test_systemd.TestInitSystemSystemdRwNetworkd: { extends: .runtime_test } tests.package.test_atop.TestAtop: { extends: .runtime_test } +tests.package.test_clang.TestClangCompilerRT: { extends: .runtime_test } tests.package.test_docker_compose.TestDockerCompose: { extends: .runtime_test } tests.package.test_dropbear.TestDropbear: { extends: .runtime_test } tests.package.test_glxinfo.TestGlxinfo: { extends: .runtime_test }
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 +7 -0
@@ -0,0 +1,7 @@ +config BR2_PACKAGE_LIBFUZZER + bool "libfuzzer" + help + This is a set of tests (benchmarks) for fuzzing + engines (fuzzers). + + https://github.com/google/fuzzer-test-suite
support/testing/tests/package/br2-external/clang-compiler-rt/package/libfuzzer/libfuzzer.hash new file +2 -0
@@ -0,0 +1,2 @@ +sha256 c0addb4d7f0447fc9fd7c80e5721fafe4c137f29a8ebd94c5fef7e1d6a2c944c libfuzzer-64e4d9aa19a8d33b61882154addbf8419d7416e1.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 = 64e4d9aa19a8d33b61882154addbf8419d7416e1 +LIBFUZZER_SITE = $(call github,google,fuzzer-test-suite,$(LIBFUZZER_VERSION)) +LIBFUZZER_LICENSE = Apache-2.0 +LIBFUZZER_LICENSE_FILES = LICENSE +LIBFUZZER_DEPENDENCIES = compiler-rt + +define LIBFUZZER_BUILD_CMDS + $(HOST_DIR)/bin/clang++ \ + -fsanitize=address,fuzzer \ + $(@D)/tutorial/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