Make compiler-rt as default lib for llvm |
||||||||||
Issue descriptionWe want to move to compiler-rt instead of using libgcc in llvm.
,
Apr 5 2017
Issue 708405 has been merged into this issue.
,
Apr 17 2017
llvm-libunwind is now part of toolchain prebuilts. Compiler-rt can be used now by adding these 2 options to clang: -rtlib=compiler-rt -lunwind
,
Apr 22 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromiumos/overlays/chromiumos-overlay/+/56a0198065757e37b0830bc477357c9a4c85584b commit 56a0198065757e37b0830bc477357c9a4c85584b Author: Manoj Gupta <manojgupta@google.com> Date: Sat Apr 22 04:57:33 2017 Add llvm-next use to compiler-rt and llvm-libunwind ebuilds. Also add a patch to clang in llvm-next to use libunwind when compiler-rt is the default rtlib. BUG= chromium:705071 TEST=compiler-rt and llvm-libwinds build with llvm-next use. TEST=-lunwind is added to linker flags when -rtlib=compiler-rt is specified in clang (llvm-next). Change-Id: I5c7d47cf8f6d52f60f3c9a7db679f10927d3de08 Reviewed-on: https://chromium-review.googlesource.com/482465 Commit-Ready: Manoj Gupta <manojgupta@chromium.org> Tested-by: Manoj Gupta <manojgupta@chromium.org> Reviewed-by: Rahul Chaudhry <rahulchaudhry@chromium.org> Reviewed-by: Mike Frysinger <vapier@chromium.org> [add] https://crrev.com/56a0198065757e37b0830bc477357c9a4c85584b/sys-devel/llvm/files/cherry/clang-5.0-enable-libunwind-with-compiler-rt.patch [modify] https://crrev.com/56a0198065757e37b0830bc477357c9a4c85584b/sys-libs/compiler-rt/compiler-rt-4.0_pre285905.ebuild [rename] https://crrev.com/56a0198065757e37b0830bc477357c9a4c85584b/sys-devel/llvm/llvm-4.0_pre285905-r17.ebuild [modify] https://crrev.com/56a0198065757e37b0830bc477357c9a4c85584b/sys-libs/llvm-libunwind/llvm-libunwind-4.0_pre285905.ebuild
,
May 3 2017
bcf@ can you try using compiler-rt now? Please pass -rtlib=compiler-rt to clang arguments.
,
May 3 2017
Sure, I'll give it a try.
,
May 11 2017
Updates: amd64 boards work fine with compiler-rt. Caroline: https://uberchromegw.corp.google.com/i/chromiumos.tryserver/builders/release/builds/10942 Peppy: https://uberchromegw.corp.google.com/i/chromiumos.tryserver/builders/release/builds/11026 Arm however does not work (failed in UnitTests). Kevin: https://uberchromegw.corp.google.com/i/chromiumos.tryserver/builders/release/builds/11027 Failed packages: chromeos-base/p2p chromeos-base/quipper After quite a bit of debugging, I root caused it to be a calling convention mismatch. LLVM expects aapcs for aeabi_ functions but compiler-rt was mapping them to aapcs_vfp. Fixing the incorrect calling convention issues in compiler-rt locally fixed these UnitTests. However, there is a new UnitTest fail in chromeos-base/shill (qeum-arm seg faults). Also the image when booting reaches the logo stage but fails to continue and reboots.
,
May 12 2017
I suspect kevin failures because of using llvm-libunwind as the unwinder, and not compiler-rt itself.
In particular, the UnitTest shows the problem with this sequence of code using GTest.
cellular_capability_universal_unittest.cc
TEST_F(CellularCapabilityUniversalMainTest, UpdateActiveBearer) {
....
// Handle exceptions in following statement.
EXPECT_DEATH(capability_->UpdateActiveBearer(),
"Found more than one active bearer.");
...
void CellularCapabilityUniversal::UpdateActiveBearer() {
...
// This statement is expected to fail
CHECK(!active_bearer_) << "Found more than one active bearer.";
,
May 12 2017
I am testing using libgcc as the unwinder for compiler-rt. If that works, llvm-libunwind can't be used as the unwinder for now.
,
May 12 2017
Kevin image with compiler_rt and libgcc as unwinder works :)
,
May 15 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromiumos/overlays/chromiumos-overlay/+/b1b954b7cc00e19afc874250605aa24712d7c658 commit b1b954b7cc00e19afc874250605aa24712d7c658 Author: Manoj Gupta <manojgupta@google.com> Date: Mon May 15 15:18:24 2017 Use libgcc_eh as the unwinder for compiler-rt. Compiler-rt does not have a builtin unwinder. Therefore, link libgcc when using compiler-rt. BUG= chromium:705071 TEST=Compiling using -rtlib=compiler-rt works. libgcc_eh is passed to linker. Change-Id: Ie2cf5c12d62c78fcaefd8648264695df85dc53bc Reviewed-on: https://chromium-review.googlesource.com/493772 Commit-Ready: Manoj Gupta <manojgupta@chromium.org> Tested-by: Manoj Gupta <manojgupta@chromium.org> Reviewed-by: Caroline Tice <cmtice@chromium.org> [rename] https://crrev.com/b1b954b7cc00e19afc874250605aa24712d7c658/sys-devel/llvm/llvm-5.0_pre300080-r4.ebuild [add] https://crrev.com/b1b954b7cc00e19afc874250605aa24712d7c658/sys-devel/llvm/files/clang-5.0-enable-libgcc-with-compiler-rt.patch [delete] https://crrev.com/cf288c6e12215df40f777b9de29fd9d20b9adf32/sys-devel/llvm/files/clang-5.0-enable-libunwind-with-compiler-rt.patch [rename] https://crrev.com/b1b954b7cc00e19afc874250605aa24712d7c658/sys-libs/compiler-rt/compiler-rt-5.0_pre300080-r3.ebuild [add] https://crrev.com/b1b954b7cc00e19afc874250605aa24712d7c658/sys-libs/compiler-rt/files/compiler-rt-arm-aapcs-abi.patch
,
May 15 2017
,
May 21 2017
,
May 23 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromiumos/chromite/+/b818156c0bd4701dd8887ea596c18fa9ace0a4d7 commit b818156c0bd4701dd8887ea596c18fa9ace0a4d7 Author: Manoj Gupta <manojgupta@google.com> Date: Tue May 23 15:28:11 2017 Build compiler-rt before other cross-target packages. When compiler-rt is used as builtin library, compiler-rt library needs to be built before other cross packages are built. BUG= chromium:705071 TEST=Cross packages get built with compiler-rt as default. Change-Id: I59d2284a4fd76d98ab552ac1b1de0093ea71b57a Reviewed-on: https://chromium-review.googlesource.com/510175 Tested-by: Manoj Gupta <manojgupta@chromium.org> Reviewed-by: Caroline Tice <cmtice@chromium.org> [modify] https://crrev.com/b818156c0bd4701dd8887ea596c18fa9ace0a4d7/scripts/cros_setup_toolchains.py
,
May 24 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromiumos/third_party/toolchain-utils/+/66682c74f91da6a90274dfea967dba1a43504bcb commit 66682c74f91da6a90274dfea967dba1a43504bcb Author: Manoj Gupta <manojgupta@google.com> Date: Wed May 24 22:56:23 2017 Start testing compiler-rt with llvm-next. We want to test compiler-rt performance and stability. So start testing llvm-next with compiler-rt as default using CL 513590. BUG= chromium:705071 TEST=buildbot runs with CL 513590 are fine for daisy, squawks, elm and peppy. Change-Id: Ic43ef238c7fce0cb88caabab7e6a32b1940cb860 Reviewed-on: https://chromium-review.googlesource.com/514302 Commit-Queue: Manoj Gupta <manojgupta@chromium.org> Tested-by: Manoj Gupta <manojgupta@chromium.org> Trybot-Ready: Manoj Gupta <manojgupta@chromium.org> Reviewed-by: Caroline Tice <cmtice@chromium.org> [modify] https://crrev.com/66682c74f91da6a90274dfea967dba1a43504bcb/buildbot_test_toolchains.py
,
May 31 2017
,
Jun 2 2017
,
Jun 12 2017
,
Jul 26 2017
,
Aug 8 2017
Done as part of llvm roll on Aug 6.
,
Sep 15 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromiumos/overlays/chromiumos-overlay/+/1697df2534816342993337cb64b8c2ed1691d44f commit 1697df2534816342993337cb64b8c2ed1691d44f Author: Manoj Gupta <manojgupta@google.com> Date: Fri Sep 15 23:54:09 2017 compiler-rt: Patches for ARM softfp and clear_cache bugs. clear_cache: Disable abort() if ARM syscall may error. Also Cherry pick upstream CL 4854a215fc3c0b10ab57b4b9b5e4cbeb5bf0624a Author: Oleg Ranevskyy <oranevskyy@accesssoftek.com> CommitDate: Wed Aug 23 14:26:31 2017 +0000 [ARM][Compiler-rt] Fix AEABI builtins to correctly pass arguments to non-AEABI functions on HF targets Summary: This is a patch for PR34167. On HF targets functions like `__{eq,lt,le,ge,gt}df2` and `__{eq,lt,le,ge,gt}sf2` expect their arguments to be passed in d/s registers, while some of the AEABI builtins pass them in r registers. Reviewers: compnerd, peter.smith, asl Reviewed By: peter.smith, asl Subscribers: peter.smith, aemerson, dberris, javed.absar, llvm-commits, asl, kristof.beyls Differential Revision: https://reviews.llvm.org/D36675 BUG= chromium:761103 BUG= chromium:705071 TEST=NaCL on ARM works. TEST=ARM softfp code with mfpu=none and mfloat-abi=softfp is correct for cmp builtins. Change-Id: I399ebae1e69dbb6727b89dffa062de72dbf39a62 Reviewed-on: https://chromium-review.googlesource.com/669661 Reviewed-by: Manoj Gupta <manojgupta@chromium.org> Commit-Queue: Manoj Gupta <manojgupta@chromium.org> Tested-by: Manoj Gupta <manojgupta@chromium.org> Trybot-Ready: Manoj Gupta <manojgupta@chromium.org> [add] https://crrev.com/1697df2534816342993337cb64b8c2ed1691d44f/sys-libs/compiler-rt/files/compiler-rt-disable-abort-cacheflush.patch [rename] https://crrev.com/1697df2534816342993337cb64b8c2ed1691d44f/sys-libs/compiler-rt/compiler-rt-5.0_pre305632-r4.ebuild [add] https://crrev.com/1697df2534816342993337cb64b8c2ed1691d44f/sys-libs/compiler-rt/files/cherry/4854a215fc3c0b10ab57b4b9b5e4cbeb5bf0624a.patch
,
Sep 22 2017
On 2017.08.01.163007, it looks like if I specify '-rtlib=compiler-rt', we still depend on libgcc. Is this expected? ./prebuilt/toolchain/armv7a/bin/armv7a-cros-linux-gnueabi-clang++ -stdlib=libc++ -std=c++11 -rtlib=compiler-rt ~/src/scratch/test.cc % readelf -d a.out | grep gcc 0x00000001 (NEEDED) Shared library: [libgcc_s.so.1]
,
Sep 22 2017
bcf@ You need a newer version of toolchain :). This is what I see for a simple c++ file. $ armv7a-cros-linux-gnueabi-clang++ -stdlib=libc++ -std=c++11 -rtlib=compiler-rt main.cpp -o main $ readelf -d main|grep NEEDED 0x00000001 (NEEDED) Shared library: [libc++.so.1] 0x00000001 (NEEDED) Shared library: [libc++abi.so.1] 0x00000001 (NEEDED) Shared library: [libm.so.6] 0x00000001 (NEEDED) Shared library: [libc.so.6] 0x00000001 (NEEDED) Shared library: [ld-linux-armhf.so.3]
,
Sep 22 2017
For reference, I enabled building libc++ with compiler-rt on Sept 1. So toolchains post Sept 2 or 3 should not have libgcc_s dependency when compiling a file with libc++. (https://bugs.chromium.org/p/chromium/issues/detail?id=747113)
,
Sep 22 2017
Thanks for confirming.
,
Feb 5 2018
|
||||||||||
►
Sign in to add a comment |
||||||||||
Comment 1 by bugdroid1@chromium.org
, Mar 27 2017