package/compiler-rt: new package
PATCH v6 1/7 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.
---
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
--- 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 | 36 ++++++++++++++++++++++++++++++++++++ 5 files changed, 55 insertions(+) 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
@@ -1399,6 +1399,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/devmem2/
package/Config.in +1 -0
@@ -1629,6 +1629,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 782edfc119ee172f169c91dd79f2c964fb6b248bd9b73523149030ed505bbe18 compiler-rt-7.0.1.src.tar.xz +sha256 417541d990edb3f96327ac03cb67e52eac80fc5c3e7afc69213cd04d7c3b9b27 LICENSE.TXT
package/compiler-rt/compiler-rt.mk new file +36 -0
@@ -0,0 +1,36 @@ +################################################################################ +# +# 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 = 7.0.1 +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_INCLUDE_TESTS=ON \ + -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 +endef +COMPILER_RT_POST_INSTALL_STAGING_HOOKS += COMPILER_RT_SETUP_RUNTIME_LIBS + +$(eval $(cmake-package))
Signature · 1 line
1.9.1
PATCH v6 2/7 package/llvm: install target binary/debug tools
The compiler-rt fuzzer and address sanitizer tools require additional LLVM binary tools installed to allow stack trace decoding actively during executable analysis.
https://github.com/google/sanitizers/wiki/AddressSanitizerCallStack
---
Changes
v1 -> v3
- None
v4
- Added new patch for llvm dependency on libxml2 which was noticed during testing
v5
- Rebased post 2018.11 on master
--- package/llvm/llvm.mk | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
package/llvm/llvm.mk +10 -1
@@ -197,8 +197,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
1.9.1
PATCH v6 3/7 testing/infra/builder: build with target and environment
In reply to Matt WeberFrom: Ricardo Martincoski <[email protected]>
Make the builder able to call 'VAR1=1 make VAR2=2 target'.
Allow to send extra parameters to be added to the end of make command line. It can be used for these purposes:
- to configure a br2-external, by passing 'BR2_EXTERNAL="dir"';
- to specify a make target, such as 'foo-source'.
Allow to add variables to the environment in which make runs. It can be used to override values from environment, such as 'BR2_DL_DIR="dl"'.
This change will be needed when adding support for br2-externals to the test infra.
---
Changes
v2
- New from: http://patchwork.ozlabs.org/patch/912351/
v2 -> v3
[Ricardo
- Updated patch commit description context.
v4
- None
v5
- Rebased post 2018.11 on master
--- support/testing/infra/builder.py | 38 ++++++++++++++++++++++++++++++++++---- 1 file changed, 34 insertions(+), 4 deletions(-)
support/testing/infra/builder.py +34 -4
@@ -12,7 +12,18 @@ class Builder(object): self.builddir = builddir self.logfile = infra.open_log_file(builddir, "build", logtofile) - def configure(self): + def configure(self, make_extra_opts=[], make_extra_env={}): + """ + Configure the build. + + make_extra_opts: a list of arguments to be passed to the make + command. + e.g. make_extra_opts=["BR2_EXTERNAL=/path"] + + make_extra_env: a dict of variables to be appended (or replaced) + in the environment that calls make. + e.g. make_extra_env={"BR2_DL_DIR": "/path"} + """ if not os.path.isdir(self.builddir): os.makedirs(self.builddir)
@@ -25,22 +36,41 @@ class Builder(object): self.logfile.flush() env = {"PATH": os.environ["PATH"]} + env.update(make_extra_env) + cmd = ["make", - "O={}".format(self.builddir), - "olddefconfig"] + "O={}".format(self.builddir)] + cmd += make_extra_opts + cmd += ["olddefconfig"] + ret = subprocess.call(cmd, stdout=self.logfile, stderr=self.logfile, env=env) if ret != 0: raise SystemError("Cannot olddefconfig") - def build(self): + def build(self, make_extra_opts=[], make_extra_env={}): + """ + Perform the build. + + make_extra_opts: a list of arguments to be passed to the make + command. It can include a make target. + e.g. make_extra_opts=["foo-source"] + + make_extra_env: a dict of variables to be appended (or replaced) + in the environment that calls make. + e.g. make_extra_env={"BR2_DL_DIR": "/path"} + """ env = {"PATH": os.environ["PATH"]} if "http_proxy" in os.environ: self.logfile.write("Using system proxy: " + os.environ["http_proxy"] + "\n") env['http_proxy'] = os.environ["http_proxy"] env['https_proxy'] = os.environ["http_proxy"] + env.update(make_extra_env) + cmd = ["make", "-C", self.builddir] + cmd += make_extra_opts + ret = subprocess.call(cmd, stdout=self.logfile, stderr=self.logfile, env=env) if ret != 0:
Signature · 1 line
1.9.1
PATCH v6 4/7 testing/infra/basetest: support br2-external
In reply to Matt WeberFrom: Ricardo Martincoski <[email protected]>
Some upcoming test cases can use one or more br2-external trees as fixtures that provide packages used only in runtime tests.
Add support for br2-external into the BRTest class. Any test case can then provide a list of paths for be used as br2-external trees during the build of the image to be tested.
---
Changes
v2
- New from: http://patchwork.ozlabs.org/patch/912354/
v2 -> v3
[Ricardo
- Updated patch commit description context.
v4
- None
v5
- Rebased post 2018.11 on master
--- support/testing/infra/basetest.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
support/testing/infra/basetest.py +2 -1
@@ -30,6 +30,7 @@ MINIMAL_CONFIG = \ class BRTest(unittest.TestCase): config = None + br2_external = list() downloaddir = None outputdir = None logtofile = True
@@ -58,7 +59,7 @@ class BRTest(unittest.TestCase): if not self.b.is_finished(): self.show_msg("Building") - self.b.configure() + self.b.configure(["BR2_EXTERNAL={}".format(":".join(self.br2_external))]) self.b.build() self.show_msg("Building done")
Signature · 1 line
1.9.1
PATCH v6 5/7 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
[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
--- .gitlab-ci.yml | 1 + .../br2-external/clang-compiler-rt/Config.in | 1 + .../br2-external/clang-compiler-rt/external.desc | 1 + .../br2-external/clang-compiler-rt/external.mk | 1 + .../clang-compiler-rt/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
@@ -316,6 +316,7 @@ tests.init.test_systemd.TestInitSystemSystemdRoNetworkd: *runtime_test tests.init.test_systemd.TestInitSystemSystemdRwFull: *runtime_test tests.init.test_systemd.TestInitSystemSystemdRwIfupdown: *runtime_test tests.init.test_systemd.TestInitSystemSystemdRwNetworkd: *runtime_test +tests.package.test_clang.TestClangCompilerRT: *runtime_test tests.package.test_dropbear.TestDropbear: *runtime_test tests.package.test_ipython.TestIPythonPy2: *runtime_test tests.package.test_ipython.TestIPythonPy3: *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++ -mcpu=cortex-a53 --sysroot=$(STAGING_DIR) \ + -B $(HOST_DIR)/opt/ext-toolchain -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
1.9.1
PATCH v6 6/7 llvm/clang: add note about version bumping together
In reply to Matt Weber---
Changes
v1 -> v2
- None
v2 -> v3
[Ricardo
- Added compiler-rt to list of items to bump. I originaly had kept this patch independent of the compiler-rt series but since compiler-rt is first in the series, this one may as well include it in the statements
v4
- None
v5
- Rebased post 2018.11 on master
v6
- Rebased after LLVM/Clang bump to 7.0.1
--- package/clang/clang.mk | 1 + package/llvm/llvm.mk | 1 + 2 files changed, 2 insertions(+)
package/clang/clang.mk +1 -0
@@ -4,6 +4,7 @@ # ################################################################################ +# LLVM, Clang and Compiler-RT should be version bumped together CLANG_VERSION = 7.0.1 CLANG_SITE = http://llvm.org/releases/$(CLANG_VERSION) CLANG_SOURCE = cfe-$(CLANG_VERSION).src.tar.xz
package/llvm/llvm.mk +1 -0
@@ -4,6 +4,7 @@ # ################################################################################ +# LLVM, Clang and Compiler-RT should be version bumped together LLVM_VERSION = 7.0.1 LLVM_SITE = http://llvm.org/releases/$(LLVM_VERSION) LLVM_SOURCE = llvm-$(LLVM_VERSION).src.tar.xz
Signature · 1 line
1.9.1
PATCH v6 7/7 package/llvm: disable libxml2
In reply to Matt Weberlibxml2 is needed during Windows builds to populate the COFF file manifest info
If left enabled, a dependency would need to be added and paths set for libxml2 include and library paths. This isn't require at this point for Linux builds.
---
This change was discovered during testing of compiler-rt patchset. This patch could be independently applied.
Romain, hopefully you are able to verify this resolves the path posioning you observed with the target build and libxml2.
v4
- New patch
v5
- Rebased post 2018.11 on master
--- package/llvm/llvm.mk | 5 +++++ 1 file changed, 5 insertions(+)
package/llvm/llvm.mk +5 -0
@@ -123,6 +123,11 @@ HOST_LLVM_CONF_OPTS += -DLLVM_ENABLE_ZLIB=ON HOST_LLVM_DEPENDENCIES += host-zlib LLVM_CONF_OPTS += -DLLVM_ENABLE_ZLIB=OFF +# libxml2 can be disabled as it is used for LLVM Windows builds where COFF +# files include manifest info +HOST_LLVM_CONF_OPTS += -DLLVM_ENABLE_LIBXML2=OFF +LLVM_CONF_OPTS += -DLLVM_ENABLE_LIBXML2=OFF + # We don't use llvm for static only build, so enable PIC HOST_LLVM_CONF_OPTS += -DLLVM_ENABLE_PIC=ON LLVM_CONF_OPTS += -DLLVM_ENABLE_PIC=ON
Signature · 1 line
1.9.1
PATCH v6 7/7 package/llvm: disable libxml2
Hi Matt,
Le 03/01/2019 ? 22:52, Matt Weber a ?crit?:
Quoted 6 lines
libxml2 is needed during Windows builds to populate the COFF file manifest info
If left enabled, a dependency would need to be added and paths set for libxml2 include and library paths. This isn't require at this point for Linux builds.
It seems not really useful to add these options if it's only used for Windows build.
Quoted 9 lines
Cc Romain Naour <[email protected]>Signed-off-by Matthew Weber <[email protected]>---
This change was discovered during testing of compiler-rt patchset. This patch could be independently applied.Romain, hopefully you are able to verify this resolves the path posioning you observed with the target build and libxml2.
Sorry but this patch is not enough to fix the path poisoning issue. Hopefully my patch [1] will do it.
[1] http://patchwork.ozlabs.org/patch/1026229/
Best regards,
Romain
Quoted 27 lines
v4
- New patchv5
- Rebased post 2018.11 on master--- package/llvm/llvm.mk | 5 +++++ 1 file changed, 5 insertions(+)package/llvm/llvm.mk +5
-0@@ -123,6 +123,11 @@ HOST_LLVM_CONF_OPTS += -DLLVM_ENABLE_ZLIB=ON HOST_LLVM_DEPENDENCIES += host-zlib LLVM_CONF_OPTS += -DLLVM_ENABLE_ZLIB=OFF +# libxml2 can be disabled as it is used for LLVM Windows builds where COFF +# files include manifest info +HOST_LLVM_CONF_OPTS += -DLLVM_ENABLE_LIBXML2=OFF +LLVM_CONF_OPTS += -DLLVM_ENABLE_LIBXML2=OFF + # We don't use llvm for static only build, so enable PIC HOST_LLVM_CONF_OPTS += -DLLVM_ENABLE_PIC=ON LLVM_CONF_OPTS += -DLLVM_ENABLE_PIC=ON
PATCH v6 1/7 package/compiler-rt: new package
In reply to Matt WeberHi Matt,
Le 03/01/2019 ? 22:52, Matt Weber a ?crit?:
Quoted 115 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.
Signed-off-by Matthew Weber <[email protected]>Cc Romain Naour <[email protected]>Cc Ricardo Martincoski <[email protected]>Cc Valentin Korenblit <[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 version--- 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 | 36 ++++++++++++++++++++++++++++++++++++ 5 files changed, 55 insertions(+) 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@@ -1399,6 +1399,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/devmem2/package/Config.in +1
-0@@ -1629,6 +1629,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 +13
-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 782edfc119ee172f169c91dd79f2c964fb6b248bd9b73523149030ed505bbe18 compiler-rt-7.0.1.src.tar.xz +sha256 417541d990edb3f96327ac03cb67e52eac80fc5c3e7afc69213cd04d7c3b9b27 LICENSE.TXTpackage/compiler-rt/compiler-rt.mk new file +9
-0@@ -0,0 +1,36 @@ +################################################################################ +# +# 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 = 7.0.1
package/compiler-rt/compiler-rt.mk line 19
Quoted 10 lines
package/compiler-rt/compiler-rt.mk new file +10
-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_INCLUDE_TESTS=ON \
Why building the testsuite and tests ?
Otherwise, the patch looks good.
Build tested on x86_64.
Quoted 18 lines
package/compiler-rt/compiler-rt.mk new file +17
-0+ -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 +endef +COMPILER_RT_POST_INSTALL_STAGING_HOOKS += COMPILER_RT_SETUP_RUNTIME_LIBS + +$(eval $(cmake-package))
PATCH v6 1/7 package/compiler-rt: new package
Romain,
Quoted 123 lines · Romain Naour
Hi Matt,
Le 03/01/2019 ? 22:52, Matt Weber a ?crit :
Quoted 119 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.
Signed-off-by Matthew Weber <[email protected]>Cc Romain Naour <[email protected]>Cc Ricardo Martincoski <[email protected]>Cc Valentin Korenblit <[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 version--- 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 | 36 ++++++++++++++++++++++++++++++++++++ 5 files changed, 55 insertions(+) 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@@ -1399,6 +1399,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/devmem2/package/Config.in +1
-0@@ -1629,6 +1629,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 +13
-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 782edfc119ee172f169c91dd79f2c964fb6b248bd9b73523149030ed505bbe18 compiler-rt-7.0.1.src.tar.xz +sha256 417541d990edb3f96327ac03cb67e52eac80fc5c3e7afc69213cd04d7c3b9b27 LICENSE.TXTpackage/compiler-rt/compiler-rt.mk new file +13
-0@@ -0,0 +1,36 @@ +################################################################################ +# +# 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 = 7.0.1 +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
Quoted 8 lines
package/compiler-rt/compiler-rt.mk line 19
Quoted 6 lines
package/compiler-rt/compiler-rt.mk new file +6
-0+COMPILER_RT_DEPENDENCIES = host-clang llvm + +COMPILER_RT_INSTALL_STAGING = YES +COMPILER_RT_INSTALL_TARGET = NO + +COMPILER_RT_CONF_OPTS=-DCOMPILER_RT_INCLUDE_TESTS=ON \Why building the testsuite and tests ?
It has been awhile and I don't remember the specific reason. After glancing at the cmake files, I believe I was using the test builds as a way to verify the libraries could be linked against. I'll start a test build with that option removed and see if the runtime test has any issues. I would keep the tests enabled though as it allows the user to see if their llvm setup works for fuzzing without having to debug a custom application too. (Maybe that should be a comment above the conf opts :-)
Quoted 24 lines
Otherwise, the patch looks good.
Reviewed-by Romain Naour <[email protected]>Build tested on
x86_64.Quoted 18 lines
package/compiler-rt/compiler-rt.mk new file +17
-0+ -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 +endef +COMPILER_RT_POST_INSTALL_STAGING_HOOKS += COMPILER_RT_SETUP_RUNTIME_LIBS + +$(eval $(cmake-package))
Signature · 23 lines
Matthew Weber | Pr. 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 v6 1/7 package/compiler-rt: new package
Hi Matt,
Le 17/01/2019 ? 00:36, Matthew Weber a ?crit?:
Quoted 8 lines
Romain,
Quoted 4 lines · Romain Naour
Hi Matt,
Le 03/01/2019 ? 22:52, Matt Weber a ?crit :
[...]
Quoted 5 lines
Quoted 4 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+ +COMPILER_RT_CONF_OPTS=-DCOMPILER_RT_INCLUDE_TESTS=ON \Why building the testsuite and tests ?
Quoted 9 lines
It has been awhile and I don't remember the specific reason. After glancing at the cmake files, I believe I was using the test builds as a way to verify the libraries could be linked against. I'll start a test build with that option removed and see if the runtime test has any issues. I would keep the tests enabled though as it allows the user to see if their llvm setup works for fuzzing without having to debug a custom application too. (Maybe that should be a comment above the conf opts :-)
By default, Buildroot packages should disable tests and testsuite when possible in order to keep rootfs small as possible.
That is why several options are set in the package infra (see pkg-cmake.mk):
-DBUILD_EXAMPLE=OFF
-DBUILD_EXAMPLES=OFF
-DBUILD_TEST=OFF
-DBUILD_TESTS=OFF
-DBUILD_TESTING=OFF
But the question is, do we need a global option to enable building packages tests and testsuite?
Otherwise, I'm fine to keep this option enabled if this is useful.
Best regards,
Romain
PATCH v6 1/7 package/compiler-rt: new package
Romain,
Quoted 30 lines · Romain Naour
Hi Matt,
Le 17/01/2019 ? 00:36, Matthew Weber a ?crit :
Quoted 8 lines
Romain,
Quoted 4 lines · Romain Naour
Hi Matt,
Le 03/01/2019 ? 22:52, Matt Weber a ?crit :
[...]
Quoted 5 lines
Quoted 4 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+ +COMPILER_RT_CONF_OPTS=-DCOMPILER_RT_INCLUDE_TESTS=ON \Why building the testsuite and tests ?
Quoted 9 lines
It has been awhile and I don't remember the specific reason. After glancing at the cmake files, I believe I was using the test builds as a way to verify the libraries could be linked against. I'll start a test build with that option removed and see if the runtime test has any issues. I would keep the tests enabled though as it allows the user to see if their llvm setup works for fuzzing without having to debug a custom application too. (Maybe that should be a comment above the conf opts :-)
Quoted 2 lines
By default, Buildroot packages should disable tests and testsuite when possible in order to keep rootfs small as possible.
I've verified we can disable them without impact. If I respin another revision I can set that option to OFF.
Quoted 8 lines
That is why several options are set in the package infra (see pkg-cmake.mk):
-DBUILD_EXAMPLE=OFF
-DBUILD_EXAMPLES=OFF
-DBUILD_TEST=OFF
-DBUILD_TESTS=OFF
-DBUILD_TESTING=OFF
Quoted 4 lines
But the question is, do we need a global option to enable building packages tests and testsuite?
Otherwise, I'm fine to keep this option enabled if this is useful.
My preference is that we leave them enabled as then the run-time test would catch additional corner cases as versions are bumped. :-)
Matt