Message ID | 20191017152929.49153-11-michael.drake@codethink.co.uk |
---|---|
State | Changes Requested |
Headers | show |
Series | Add Chromium Embedded Framework library | expand |
On Thu, Oct 17, 2019 at 10:30 AM Michael Drake <michael.drake@codethink.co.uk> wrote: > > From: Matt Weber <matthew.weber@rockwellcollins.com> > > This patch adds support for the compiler-rt (CLANG runtime) library. > It builds a set of static libraries and installs them into the > CLANG/LLVM toolchain resource folder. > FYI, I plan to publish (soon) a cleaned up version of my original series which add the compiler-rt feature. That refreshed patchset would have the feedback from my last series that's missing here. > Signed-off-by: Matthew Weber <matthew.weber@rockwellcollins.com> > Cc: Romain Naour <romain.naour@smile.fr> > Cc: Ricardo Martincoski <ricardo.martincoski@gmail.com> > Cc: Valentin Korenblit <valentinkorenblit@gmail.com> > Signed-off-by: Michael Drake <michael.drake@codethink.co.uk> > Signed-off-by: Thomas Preston <thomas.preston@codethink.co.uk> > --- > DEVELOPERS | 1 + > package/Config.in | 1 + > package/clang/clang.mk | 2 +- > package/compiler-rt/Config.in | 14 +++++++++++ > package/compiler-rt/compiler-rt.hash | 2 ++ > package/compiler-rt/compiler-rt.mk | 36 ++++++++++++++++++++++++++++ > package/llvm/llvm.mk | 2 +- > 7 files changed, 56 insertions(+), 2 deletions(-) > create mode 100644 package/compiler-rt/Config.in > create mode 100644 package/compiler-rt/compiler-rt.hash > create mode 100644 package/compiler-rt/compiler-rt.mk > > diff --git a/DEVELOPERS b/DEVELOPERS > index bdc98edd12..abaa710ccb 100644 > --- a/DEVELOPERS > +++ b/DEVELOPERS > @@ -1476,6 +1476,7 @@ F: package/bridge-utils/ > F: package/checkpolicy/ > F: package/checksec/ > F: package/cgroupfs-mount/ > +F: package/compiler-rt/ > F: package/crda/ > F: package/cunit/ > F: package/dacapo/ > diff --git a/package/Config.in b/package/Config.in > index 90dddfd346..ab9335a055 100644 > --- a/package/Config.in > +++ b/package/Config.in > @@ -1666,6 +1666,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" > diff --git a/package/clang/clang.mk b/package/clang/clang.mk > index 07e7fced2a..87a80ab258 100644 > --- a/package/clang/clang.mk > +++ b/package/clang/clang.mk > @@ -4,7 +4,7 @@ > # > ################################################################################ > > -# LLVM and Clang should be version bumped together > +# LLVM, Compiler-rt and Clang should be version bumped together > CLANG_VERSION = 8.0.0 > CLANG_SITE = http://llvm.org/releases/$(CLANG_VERSION) > CLANG_SOURCE = cfe-$(CLANG_VERSION).src.tar.xz > diff --git a/package/compiler-rt/Config.in b/package/compiler-rt/Config.in > new file mode 100644 > index 0000000000..9afc0d9d60 > --- /dev/null > +++ b/package/compiler-rt/Config.in > @@ -0,0 +1,14 @@ > +config BR2_PACKAGE_COMPILER_RT > + bool "compiler-rt" > + depends on BR2_PACKAGE_LLVM > + depends on BR2_TOOLCHAIN_USES_GLIBC # asan lib requires > + help > + A collection of runtime libraries primarily used by clang and > + llvm to provide builtins, sanitizer runtimes, and profiling > + at runtime. > + > + https://compiler-rt.llvm.org/ > + > +comment "compiler-rt requires llvm to be enabled and a glibc toolchain" > + depends on !BR2_PACKAGE_LLVM > + depends on !BR2_TOOLCHAIN_USES_GLIBC > diff --git a/package/compiler-rt/compiler-rt.hash b/package/compiler-rt/compiler-rt.hash > new file mode 100644 > index 0000000000..24ebdf206b > --- /dev/null > +++ b/package/compiler-rt/compiler-rt.hash > @@ -0,0 +1,2 @@ > +sha256 b435c7474f459e71b2831f1a4e3f1d21203cb9c0172e94e9d9b69f50354f21b1 compiler-rt-8.0.0.src.tar.xz > +sha256 dd27f8c290bcdc8368549cd7cd98710a9dbdc34122f2e096a1edb97824ed4148 LICENSE.TXT > diff --git a/package/compiler-rt/compiler-rt.mk b/package/compiler-rt/compiler-rt.mk > new file mode 100644 > index 0000000000..7eda3bc4fe > --- /dev/null > +++ b/package/compiler-rt/compiler-rt.mk > @@ -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 = 8.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 > +endef > +COMPILER_RT_POST_INSTALL_STAGING_HOOKS += COMPILER_RT_SETUP_RUNTIME_LIBS > + > +$(eval $(cmake-package)) > diff --git a/package/llvm/llvm.mk b/package/llvm/llvm.mk > index 44882d39a6..4fce59b95b 100644 > --- a/package/llvm/llvm.mk > +++ b/package/llvm/llvm.mk > @@ -4,7 +4,7 @@ > # > ################################################################################ > > -# LLVM and Clang should be version bumped together > +# LLVM, Compiler-rt and Clang should be version bumped together > LLVM_VERSION = 8.0.0 > LLVM_SITE = http://llvm.org/releases/$(LLVM_VERSION) > LLVM_SOURCE = llvm-$(LLVM_VERSION).src.tar.xz > -- > 2.20.1 >
Hi Matt, On 17/10/2019 20:17, Matthew Weber wrote: > On Thu, Oct 17, 2019 at 10:30 AM Michael Drake > <michael.drake@codethink.co.uk> wrote: >> >> From: Matt Weber <matthew.weber@rockwellcollins.com> >> >> This patch adds support for the compiler-rt (CLANG runtime) library. >> It builds a set of static libraries and installs them into the >> CLANG/LLVM toolchain resource folder. >> > > FYI, I plan to publish (soon) a cleaned up version of my original > series which add the compiler-rt feature. That refreshed patchset > would have the feedback from my last series that's missing here. Ooh, that's really interesting. At this very moment I am actually working on adding a host-compiler-rt. Currently I'm disabling CFI[1] in the CEF/Chromium build with `is_cfi=false`. When I enable that feature, I get clang errors like: clang++: error: no such file or directory: '/home/tlsa/buildroot/output/host/lib/clang/8.0.0/share/cfi_blacklist.txt' And I believe the missing cfi_blacklist.txt should come with compiler-rt. I'll have a look for the feedback from the last series. Thanks very much for the pointer for and the original patch! [1] http://clang.llvm.org/docs/ControlFlowIntegrity.html Best regards, Michael
Hi Matthew, On 18/10/2019 09:51, Michael Drake wrote: > On 17/10/2019 20:17, Matthew Weber wrote: >> FYI, I plan to publish (soon) a cleaned up version of my original >> series which add the compiler-rt feature. That refreshed patchset >> would have the feedback from my last series that's missing here. > > Ooh, that's really interesting. At this very moment I am actually > working on adding a host-compiler-rt. Currently I'm disabling > CFI[1] in the CEF/Chromium build with `is_cfi=false`. > > When I enable that feature, I get clang errors like: > > clang++: error: no such file or directory: > '/home/tlsa/buildroot/output/host/lib/clang/8.0.0/share/cfi_blacklist.txt' I tracked this down, btw. The attached patch fixes it. Basically, we create links for all the libclang_rt.* stuff for host-clang, but they use some data files in the share directory too, that weren't getting copied. Cheers, Michael
Hi Matt, On 17/10/2019 21:17, Matthew Weber wrote: > On Thu, Oct 17, 2019 at 10:30 AM Michael Drake > <michael.drake@codethink.co.uk> wrote: >> From: Matt Weber <matthew.weber@rockwellcollins.com> >> >> This patch adds support for the compiler-rt (CLANG runtime) library. >> It builds a set of static libraries and installs them into the >> CLANG/LLVM toolchain resource folder. >> > FYI, I plan to publish (soon) a cleaned up version of my original > series which add the compiler-rt feature. That refreshed patchset > would have the feedback from my last series that's missing here. There are probably interactions with Romain's clang series and Joseph's LLD series, so it would be nice if all of that could be combined in one series or at least ordered somewhat... Regards, Arnout
Arnout, On Sat, Oct 19, 2019 at 4:48 PM Arnout Vandecappelle <arnout@mind.be> wrote: > > Hi Matt, > > On 17/10/2019 21:17, Matthew Weber wrote: > > On Thu, Oct 17, 2019 at 10:30 AM Michael Drake > > <michael.drake@codethink.co.uk> wrote: > >> From: Matt Weber <matthew.weber@rockwellcollins.com> > >> > >> This patch adds support for the compiler-rt (CLANG runtime) library. > >> It builds a set of static libraries and installs them into the > >> CLANG/LLVM toolchain resource folder. > >> > > FYI, I plan to publish (soon) a cleaned up version of my original > > series which add the compiler-rt feature. That refreshed patchset > > would have the feedback from my last series that's missing here. > > There are probably interactions with Romain's clang series and Joseph's LLD > series, so it would be nice if all of that could be combined in one series or at > least ordered somewhat... > Agree, I'll get something together today ahead of the working meeting this week. Right now, I've got a working copy pulling in Romain's series, however its out of date with respect to current master. Plus I need to review Michael's reuse of compiler-rt and any changes. Regards, Matt
Michael / Romain / Arnout, On Fri, Oct 18, 2019 at 10:18 AM Michael Drake <michael.drake@codethink.co.uk> wrote: > > Hi Matthew, > > On 18/10/2019 09:51, Michael Drake wrote: > > On 17/10/2019 20:17, Matthew Weber wrote: > > >> FYI, I plan to publish (soon) a cleaned up version of my original > >> series which add the compiler-rt feature. That refreshed patchset > >> would have the feedback from my last series that's missing here. > > > > Ooh, that's really interesting. At this very moment I am actually > > working on adding a host-compiler-rt. Currently I'm disabling > > CFI[1] in the CEF/Chromium build with `is_cfi=false`. > > > > When I enable that feature, I get clang errors like: > > > > clang++: error: no such file or directory: > > '/home/tlsa/buildroot/output/host/lib/clang/8.0.0/share/cfi_blacklist.txt' > > I tracked this down, btw. The attached patch fixes it. > > Basically, we create links for all the libclang_rt.* stuff > for host-clang, but they use some data files in the share > directory too, that weren't getting copied. I incorporated that symlink fix into the clang v8 series [1]. The new series is now just two patches as it leverages a new clang cross-compiler framework. The new framework is provided in Romain's clang cross-compiler series [2] and needs to be applied first (or the core parts of it). Regards, Matt [1] http://patchwork.ozlabs.org/project/buildroot/list/?series=138196 [2] http://patchwork.ozlabs.org/project/buildroot/list/?series=129565
diff --git a/DEVELOPERS b/DEVELOPERS index bdc98edd12..abaa710ccb 100644 --- a/DEVELOPERS +++ b/DEVELOPERS @@ -1476,6 +1476,7 @@ F: package/bridge-utils/ F: package/checkpolicy/ F: package/checksec/ F: package/cgroupfs-mount/ +F: package/compiler-rt/ F: package/crda/ F: package/cunit/ F: package/dacapo/ diff --git a/package/Config.in b/package/Config.in index 90dddfd346..ab9335a055 100644 --- a/package/Config.in +++ b/package/Config.in @@ -1666,6 +1666,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" diff --git a/package/clang/clang.mk b/package/clang/clang.mk index 07e7fced2a..87a80ab258 100644 --- a/package/clang/clang.mk +++ b/package/clang/clang.mk @@ -4,7 +4,7 @@ # ################################################################################ -# LLVM and Clang should be version bumped together +# LLVM, Compiler-rt and Clang should be version bumped together CLANG_VERSION = 8.0.0 CLANG_SITE = http://llvm.org/releases/$(CLANG_VERSION) CLANG_SOURCE = cfe-$(CLANG_VERSION).src.tar.xz diff --git a/package/compiler-rt/Config.in b/package/compiler-rt/Config.in new file mode 100644 index 0000000000..9afc0d9d60 --- /dev/null +++ b/package/compiler-rt/Config.in @@ -0,0 +1,14 @@ +config BR2_PACKAGE_COMPILER_RT + bool "compiler-rt" + depends on BR2_PACKAGE_LLVM + depends on BR2_TOOLCHAIN_USES_GLIBC # asan lib requires + help + A collection of runtime libraries primarily used by clang and + llvm to provide builtins, sanitizer runtimes, and profiling + at runtime. + + https://compiler-rt.llvm.org/ + +comment "compiler-rt requires llvm to be enabled and a glibc toolchain" + depends on !BR2_PACKAGE_LLVM + depends on !BR2_TOOLCHAIN_USES_GLIBC diff --git a/package/compiler-rt/compiler-rt.hash b/package/compiler-rt/compiler-rt.hash new file mode 100644 index 0000000000..24ebdf206b --- /dev/null +++ b/package/compiler-rt/compiler-rt.hash @@ -0,0 +1,2 @@ +sha256 b435c7474f459e71b2831f1a4e3f1d21203cb9c0172e94e9d9b69f50354f21b1 compiler-rt-8.0.0.src.tar.xz +sha256 dd27f8c290bcdc8368549cd7cd98710a9dbdc34122f2e096a1edb97824ed4148 LICENSE.TXT diff --git a/package/compiler-rt/compiler-rt.mk b/package/compiler-rt/compiler-rt.mk new file mode 100644 index 0000000000..7eda3bc4fe --- /dev/null +++ b/package/compiler-rt/compiler-rt.mk @@ -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 = 8.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 +endef +COMPILER_RT_POST_INSTALL_STAGING_HOOKS += COMPILER_RT_SETUP_RUNTIME_LIBS + +$(eval $(cmake-package)) diff --git a/package/llvm/llvm.mk b/package/llvm/llvm.mk index 44882d39a6..4fce59b95b 100644 --- a/package/llvm/llvm.mk +++ b/package/llvm/llvm.mk @@ -4,7 +4,7 @@ # ################################################################################ -# LLVM and Clang should be version bumped together +# LLVM, Compiler-rt and Clang should be version bumped together LLVM_VERSION = 8.0.0 LLVM_SITE = http://llvm.org/releases/$(LLVM_VERSION) LLVM_SOURCE = llvm-$(LLVM_VERSION).src.tar.xz