New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 604877 link

Starred by 1 user

Issue metadata

Status: Verified
Owner:
Last visit > 30 days ago
Closed: Apr 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 2
Type: Bug



Sign in to add a comment

please supply libclang_rt.*-armhf.a with armv7a-cros-linux-gnueabi-clang

Project Member Reported by nlewycky@google.com, Apr 19 2016

Issue description

UserAgent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.116 Safari/537.36

Steps to reproduce the problem:
Sample config.log:

configure:3597: armv7a-cros-linux-gnueabi-clang -O2 -fsanitize=address,undefined -fsanitize-coverage=edge,indirect-calls,8bit-counters,trace-cmp -O2 -pipe -march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=hard -g -fno-exceptions -fno-unwind-tables   -fno-asynchronous-unwind-tables  -clang-syntax  -fsanitize=address,undefined -fsanitize-coverage=edge,indirect-calls,8bit-counters,trace-cmp -Wl,-O1 -Wl,-O2 -Wl,--as-needed conftest.c  >&5
/usr/x86_64-pc-linux-gnu/armv7a-cros-linux-gnueabi/binutils-bin/2.25.51/ld.gold.real: error: cannot open /usr/bin/../lib64/clang/3.8.0/lib/linux/libclang_rt.asan-armhf.a: No such file or directory
conftest.c:14: error: undefined reference to '__sanitizer_cov'
conftest.c:14: error: undefined reference to '__asan_init'
conftest.c:14: error: undefined reference to '__asan_version_mismatch_check_v6'
conftest.c:14: error: undefined reference to '__asan_register_globals'
conftest.c:14: error: undefined reference to '__sanitizer_cov_module_init'
conftest.c:14: error: undefined reference to '__asan_unregister_globals'
clang-3.8: error: linker command failed with exit code 1 (use -v to see invocation)

To get here I built a new profile for the whirlwind board, in src/private-overlays/overlay-whirlwind-private/profiles create a new 'llvm' directory with two files. "parent" which simply contains "whirlwind-private:base", and "make.defaults" with:
  USE="clang"
  CC="armv7a-cros-linux-gnueabi-clang --sysroot=/build/whirlwind"
  CXX="armv7a-cros-linux-gnueabi-clang++ --sysroot=/build/whirlwind"
  CFLAGS="${CFLAGS} -fsanitize=address,undefined -fsanitize-coverage=edge,indirect-calls,8bit-counters,trace-cmp"
  CXXFLAGS="${CXXFLAGS} -fsanitize=address,undefined -fsanitize-coverage=edge,indirect-calls,8bit-counters,trace-cmp"
  CPPFLAGS="${CPPFLAGS} -fsanitize=address,undefined -fsanitize-coverage=edge,indirect-calls,8bit-counters,trace-cmp"

Note that if you don't specify the sysroot to the compiler, it will try to link against x86-64 libraries.

What is the expected behavior?
Successful link producing wicked awesome asanified ubsanified fuzzable binaries.

What went wrong?
Nobody included compiler-rt library for asan on arm hard float in the whirlwind board?

Did this work before? No 

Chrome version: 48.0.2564.116  Channel: n/a
OS Version: 
Flash Version: Shockwave Flash 20.0 r0
 
Labels: -OS-Linux Build-Toolchain OS-Chrome
Owner: yunlian@chromium.org
Status: Assigned (was: Unconfirmed)
Status: Started (was: Assigned)
Upstream bug filed at
https://bugs.gentoo.org/show_bug.cgi?id=580870

We have a local patch
https://chromium-review.googlesource.com/#/c/340280/

You can cherry pick this one and
do
sudo emerge arm-compiler-rt after
running setup_board --board daisy(or any arm based board) to get the library
installed.
Project Member

Comment 4 by sheriffbot@chromium.org, Jun 2 2016

Labels: Hotlist-Google
I patched that it but it had no effect, I think because we (whirlwind) aren't using sys-libs/arm-compiler-rt anywhere. Instead, I think this needs to be a patch to sys-devel/llvm/llvm-3.9_pre265926-r0.ebuild?

I also note that that .ebuild refers to files/cmake which don't exist. This block:
		# Install clang runtime into /usr/lib/clang
		# https://llvm.org/bugs/show_bug.cgi?id=23792
		epatch "${FILESDIR}"/cmake/clang-0001-Install-clang-runtime-into-usr-lib-without-suffix-3.8.patch
		epatch "${FILESDIR}"/cmake/compiler-rt-0001-cmake-Install-compiler-rt-into-usr-lib-without-suffi.patch

vs. the directory contents:
(cr) ((78477c4...)) nlewycky@ducttape /usr/local/portage/chromiumos/sys-devel/llvm/files/cmake $ ls
0002-cmake-Support-overriding-Sphinx-HTML-doc-install-dir.patch
0003-cmake-Add-an-ordering-dep-between-HTML-man-Sphinx-ta.patch
0004-cmake-Do-not-install-libgtest.patch
llvm-3.7.0-ocaml-multilib.patch
llvm-3.8-allow_custom_cmake_build_types.patch


I will take a look.
The sys-libs/arm-compiler-rt will install the required library.

To install this package, you need to have arm gcc inside the chroot.
You can just run 
setup_board --board daisy to get it.

After installing the package, I can run

 armv7a-cros-linux-gnueabi-clang++ -O2 -fsanitize=address a.cc --sysroot=/usr/armv7a-cros-linux-gnueabi/

without any problem.

BTW, the files installed by this package are as follows.

/usr/lib64/clang/3.9.0/lib/linux/libclang_rt.asan-armhf.a
/usr/lib64/clang/3.9.0/lib/linux/libclang_rt.asan-armhf.a.syms
/usr/lib64/clang/3.9.0/lib/linux/libclang_rt.asan-armhf.so
/usr/lib64/clang/3.9.0/lib/linux/libclang_rt.asan-preinit-armhf.a
/usr/lib64/clang/3.9.0/lib/linux/libclang_rt.asan_cxx-armhf.a
/usr/lib64/clang/3.9.0/lib/linux/libclang_rt.asan_cxx-armhf.a.syms
/usr/lib64/clang/3.9.0/lib/linux/libclang_rt.builtins-armhf.a
/usr/lib64/clang/3.9.0/lib/linux/libclang_rt.profile-armhf.a
/usr/lib64/clang/3.9.0/lib/linux/libclang_rt.stats-armhf.a
/usr/lib64/clang/3.9.0/lib/linux/libclang_rt.stats_client-armhf.a
/usr/lib64/clang/3.9.0/lib/linux/libclang_rt.ubsan_standalone-armhf.a
/usr/lib64/clang/3.9.0/lib/linux/libclang_rt.ubsan_standalone-armhf.a.syms
/usr/lib64/clang/3.9.0/lib/linux/libclang_rt.ubsan_standalone_cxx-armhf.a
/usr/lib64/clang/3.9.0/lib/linux/libclang_rt.ubsan_standalone_cxx-armhf.a.syms
After setup_board --board daisy

(cr) ((3e05772...)) nlewycky@ducttape ~/trunk/src/scripts $ sudo emerge arm-compiler-rt
Calculating dependencies... done!

emerge: there are no ebuilds to satisfy "arm-compiler-rt".

emerge: searching for similar names...
emerge: Maybe you meant any of these: dev-lang/closure-compiler-bin, app-shells/bash-completion?

Comment 9 by nlewycky@google.com, Feb 14 2017

Summary: please supply libclang_rt.*-armhf.a with armv7a-cros-linux-gnueabi-clang (was: please supply libclang_rt.asa n-armhf.a with armv7a-cros-linux-gnueabi-clang)
Owner: manojgupta@chromium.org
Asking Manoj to help with this.
It may not be that simple to get deployed.. 
Compiler-rt does not support building libraries for multiple target architectures at same time.
So far it looks like we have to use Yunlian's solution to provide compiler-rt libraries for different architectures.

Just to remind, this bug is holding up migration of Jetstream (ap daemons) build to use LLVM:
https://chrome-internal-review.googlesource.com/c/316239/

Failure to link here:
https://uberchromegw.corp.google.com/i/chromiumos.tryserver/builders/pre_cq/builds/19006/steps/UnitTest/logs/stdio


grundler@, If it is urgent, the ebuild at https://chromium-review.googlesource.com/c/340280 can be used to build the required libraries. 

It may not be the cleanest approach since compiler-rt libraries will be provided by 2 packages : llvm for x86 and amd64 and arm-compiler-rt for armv7.

grundler, 

how important is that you get a workaround now?
Nick suggested running the unittest in a different mode until we have a solution for this? 
otherwise you could try to use the hacked ebuild provided by Manoj but it would be though to merge that CL into chromeos. 

we should have something fixed in a few days.


Cc: grundler@chromium.org yunlian@chromium.org vapier@chromium.org llozano@chromium.org nlewycky@chromium.org
It's important but not urgent IMHO - I'll defer to Nick priority. If you don't mind reverting CL340280 as a requirement for submitting the right fix, I'm ok with that going in now.
Project Member

Comment 17 by bugdroid1@chromium.org, Mar 2 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/overlays/chromiumos-overlay/+/98cdfc64108ec9247b090545a68a757cfb184a70

commit 98cdfc64108ec9247b090545a68a757cfb184a70
Author: Yunlian Jiang <yunlian@google.com>
Date: Thu Mar 02 19:29:05 2017

arm-compiler-rt: Supply libclang_rt.asan-armhf.a

By default, the compiler-rt only provides amd64 and x86 version of
sanitizer library when building llvm. This add a new package named
arm-compiler-rt and it provides arm compiler-rt libraries.

BUG= chromium:604877 
TEST=armv7a-cros-linux-gnueabi-clang --sysroot=/usr/armv7a-cros-linux-gnueabi/
     -fsanitize=address,undefined  -mfloat-abi=hard a.c
     passes.

Change-Id: I363525b13f1e90805923f14fb172662ec60541cc
Reviewed-on: https://chromium-review.googlesource.com/340280
Commit-Ready: Manoj Gupta <manojgupta@chromium.org>
Tested-by: Manoj Gupta <manojgupta@chromium.org>
Reviewed-by: Yunlian Jiang <yunlian@chromium.org>

[add] https://crrev.com/98cdfc64108ec9247b090545a68a757cfb184a70/sys-libs/arm-compiler-rt/arm-compiler-rt-4.0_pre285905.ebuild

Project Member

Comment 18 by bugdroid1@chromium.org, Mar 2 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/overlays/chromiumos-overlay/+/98cdfc64108ec9247b090545a68a757cfb184a70

commit 98cdfc64108ec9247b090545a68a757cfb184a70
Author: Yunlian Jiang <yunlian@google.com>
Date: Thu Mar 02 19:29:05 2017

arm-compiler-rt: Supply libclang_rt.asan-armhf.a

By default, the compiler-rt only provides amd64 and x86 version of
sanitizer library when building llvm. This add a new package named
arm-compiler-rt and it provides arm compiler-rt libraries.

BUG= chromium:604877 
TEST=armv7a-cros-linux-gnueabi-clang --sysroot=/usr/armv7a-cros-linux-gnueabi/
     -fsanitize=address,undefined  -mfloat-abi=hard a.c
     passes.

Change-Id: I363525b13f1e90805923f14fb172662ec60541cc
Reviewed-on: https://chromium-review.googlesource.com/340280
Commit-Ready: Manoj Gupta <manojgupta@chromium.org>
Tested-by: Manoj Gupta <manojgupta@chromium.org>
Reviewed-by: Yunlian Jiang <yunlian@chromium.org>

[add] https://crrev.com/98cdfc64108ec9247b090545a68a757cfb184a70/sys-libs/arm-compiler-rt/arm-compiler-rt-4.0_pre285905.ebuild

I made compiler-rt a target package and now UnitTest builds mostly..

No wI am getting profiling errors in ap-daemons:
https://uberchromegw.corp.google.com/i/chromiumos.tryserver/builders/release/builds/9807/

ap-daemons-0.0.3-r2677: profiling: /mnt/host/source/ap-daemons-coverage-tmp//platform/ap-daemons/api-server/ap-daemons_unittest.cors_request_handler_test.gcda: cannot merge previous GCDA file: mismatched number of counters (2)
ap-daemons-0.0.3-r2677: profiling: /mnt/host/source/ap-daemons-coverage-tmp//platform/ap-daemons/api-server/ap-daemons_unittest.cors_request_handler_test.gcda: cannot merge previous GCDA file: corrupt arc tag (0x00000000)

On my local chroot, which has an older package of ap-daemons-0.0.3 (r2658), I do not see any such errors.

@ nlewycky, Do you know if ap-daemons had an update which could affect profiling?
I updated my chroot and tests ran fine. So not sure what's happening when running on server. I launched another build with --clobber to see if that solves the issue.
This build passed without any profiling related issues (https://uberchromegw.corp.google.com/i/chromiumos.tryserver/builders/release/builds/9810)

Project Member

Comment 22 by bugdroid1@chromium.org, Mar 30 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/overlays/chromiumos-overlay/+/f50604fbe779e0012e73826394dddf90011d272d

commit f50604fbe779e0012e73826394dddf90011d272d
Author: Manoj Gupta <manojgupta@google.com>
Date: Thu Mar 30 22:48:17 2017

Make compiler-rt ebuild suitable for cross compiling in crossdev.

Add compiler-rt ebuild which can be built for multiple targets
by crossdev.
Existing arm-compiler-rt ebuild can be removed once this is added
to chromiumos-sdk prebuilts.

BUG= chromium:604877 
TEST=emerge cross-armv7a-cros-linux-gnueabi/compiler-rt works.
TEST=emerge cross-aarch64-cros-linux-gnu-clang/compiler-rt works.
(After setting symlinks in crossdev)

Change-Id: Ie6eb43e79488b6f0ea7157addc55a54e8d22000b
Reviewed-on: https://chromium-review.googlesource.com/459068
Commit-Ready: Manoj Gupta <manojgupta@chromium.org>
Tested-by: Manoj Gupta <manojgupta@chromium.org>
Reviewed-by: Yunlian Jiang <yunlian@chromium.org>

[add] https://crrev.com/f50604fbe779e0012e73826394dddf90011d272d/sys-libs/compiler-rt/compiler-rt-4.0_pre285905.ebuild

Project Member

Comment 23 by bugdroid1@chromium.org, Apr 1 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/chromite/+/1b5642e19bd403802ba01802a33caa9bf9e12385

commit 1b5642e19bd403802ba01802a33caa9bf9e12385
Author: Manoj Gupta <manojgupta@google.com>
Date: Sat Apr 01 08:35:57 2017

Add compiler-rt package to arm board prebuilts.

compiler-rt package is required to run clang with
profiler/sanitizer options on arm boards.
To avoid breaking builders, compiler-rt will not be installed
with --usepkg option till chromiumos-sdk builder uploads new prebuilts.

BUG= chromium:604877 
TEST="./setup_board --board=arm-generic --nousepkg" builds compiler-rt
TEST="./setup_board --board=arm-generic" does not  build compiler-rt

Change-Id: I22669c41065586a81f8ab04b88f591f2df73e876
Reviewed-on: https://chromium-review.googlesource.com/451977
Commit-Ready: Manoj Gupta <manojgupta@chromium.org>
Tested-by: Manoj Gupta <manojgupta@chromium.org>
Reviewed-by: Grant Grundler <grundler@chromium.org>
Reviewed-by: Yunlian Jiang <yunlian@chromium.org>

[modify] https://crrev.com/1b5642e19bd403802ba01802a33caa9bf9e12385/scripts/cros_setup_toolchains.py

Project Member

Comment 24 by bugdroid1@chromium.org, Apr 3 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/chromite/+/1c2b4a72fbc7c5554fb2ec8e876422c7eee6b7ce

commit 1c2b4a72fbc7c5554fb2ec8e876422c7eee6b7ce
Author: Manoj Gupta <manojgupta@google.com>
Date: Mon Apr 03 20:49:56 2017

Install compiler-rt package with other arm board prebuilts.

Remove the lines for --usepkg option since compiler-rt
is now available as prebuilt for arm.

BUG= chromium:604877 
TEST="./setup_board --board=arm-generic" installs compiler-rt binary package.

Change-Id: I2adf42b7938d79a7a9f5c8f9e0f424e6933e9303
Reviewed-on: https://chromium-review.googlesource.com/465382
Commit-Ready: Manoj Gupta <manojgupta@chromium.org>
Tested-by: Manoj Gupta <manojgupta@chromium.org>
Reviewed-by: Yunlian Jiang <yunlian@chromium.org>

[modify] https://crrev.com/1c2b4a72fbc7c5554fb2ec8e876422c7eee6b7ce/scripts/cros_setup_toolchains.py

Project Member

Comment 25 by bugdroid1@chromium.org, Apr 3 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/chromite/+/1c2b4a72fbc7c5554fb2ec8e876422c7eee6b7ce

commit 1c2b4a72fbc7c5554fb2ec8e876422c7eee6b7ce
Author: Manoj Gupta <manojgupta@google.com>
Date: Mon Apr 03 20:49:56 2017

Install compiler-rt package with other arm board prebuilts.

Remove the lines for --usepkg option since compiler-rt
is now available as prebuilt for arm.

BUG= chromium:604877 
TEST="./setup_board --board=arm-generic" installs compiler-rt binary package.

Change-Id: I2adf42b7938d79a7a9f5c8f9e0f424e6933e9303
Reviewed-on: https://chromium-review.googlesource.com/465382
Commit-Ready: Manoj Gupta <manojgupta@chromium.org>
Tested-by: Manoj Gupta <manojgupta@chromium.org>
Reviewed-by: Yunlian Jiang <yunlian@chromium.org>

[modify] https://crrev.com/1c2b4a72fbc7c5554fb2ec8e876422c7eee6b7ce/scripts/cros_setup_toolchains.py

grundler@ and nlewycky@, compiler-rt should now be available when doing a setup board.

Do a full sync, and run ./setup_board --board=Some_ARM_Board should install compiler-rt libraries.

Or run : sudo `which cros_setup_toolchains` --reconfig -t armv7a-cros-linux-gnueabi
Project Member

Comment 27 by bugdroid1@chromium.org, Apr 3 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/overlays/chromiumos-overlay/+/df0a9af8489fe0d2431db2e1d15a7e3a81c398e0

commit df0a9af8489fe0d2431db2e1d15a7e3a81c398e0
Author: Manoj Gupta <manojgupta@google.com>
Date: Mon Apr 03 22:41:51 2017

Remove arm-compiler-rt ebuild.

Another ebuild compiler-rt suitable for cross compilation has been
checked in. So no need to have a special arm variant.

BUG= chromium:604877 
TEST=emerge arm-compile-rt fails to find arm-compiler-rt package.

Change-Id: Ica9b5bd1c6689870e7e07ba2442298702c27db42
Reviewed-on: https://chromium-review.googlesource.com/466507
Commit-Ready: Manoj Gupta <manojgupta@chromium.org>
Tested-by: Manoj Gupta <manojgupta@chromium.org>
Reviewed-by: Yunlian Jiang <yunlian@chromium.org>

[delete] https://crrev.com/0c0d01f3b42c68535d400f0a8b44bd31d7148941/sys-libs/arm-compiler-rt/arm-compiler-rt-4.0_pre285905.ebuild

Owner: nlewycky@chromium.org
grundler@ and nlewycky@, I am getting following errors in the UnitTest for ap-daemons.

ap-daemons-0.0.3-r2718: profiling: /mnt/host/source/ap-daemons-coverage-tmp//platform/ap-daemons/api-server/ap-daemons_unittest.cors_request_handler_test.gcda: cannot merge previous GCDA file: corrupt arc tag (0xffffff55)

https://uberchromegw.corp.google.com/i/chromiumos.tryserver/builders/pre_cq/builds/25875/steps/UnitTest/logs/stdio

This error does not happen if --clobber is passed to cbuildbot. So, the issue is most likely because of old stale files. Can you update the ap-daemons to clean the /mnt/host/source/ap-daemons-coverage-tmp/ directory before the UnitTests are run?

Owner: nlewycky@google.com
Project Member

Comment 30 by bugdroid1@chromium.org, Apr 5 2017

Status: Fixed (was: Started)
Marking as fixed since the asan libraries are now available.

Comment 32 by dchan@google.com, May 30 2017

Labels: VerifyIn-60
Labels: VerifyIn-61
Status: Verified (was: Fixed)
Closing. Please reopen it if its not fixed. Thanks!

Sign in to add a comment