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

Issue 670136 link

Starred by 2 users

Issue metadata

Status: WontFix
Owner:
Last visit > 30 days ago
Closed: Jan 2017
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Chrome
Pri: 2
Type: Bug



Sign in to add a comment

clang-generated GCDA files fail under lcov

Project Member Reported by nlewycky@google.com, Dec 1 2016

Issue description

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

Steps to reproduce the problem:
1. locally "git revert 43b13fc173a7cca980afa857ab7e9fae0dadc1e0" aka https://chrome-internal-review.googlesource.com/#/c/305881/
2. locally patch in 
https://chrome-internal-review.googlesource.com/304825
https://chrome-internal-review.googlesource.com/304807 to work around crashes introduced by step 1
3. FEATURES=test emerge-whirlwind ap-daemons

What is the expected behavior?
lcov profiling data in HTML, woo!

What went wrong?
  [...]
[  PASSED  ] 309 tests.
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)
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)
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)
  [...]
qemu: uncaught target signal 11 (Segmentation fault) - core dumped

By default clang attempts to emulate gcc-4.2 format gcno and gcda files. I tried adding flags to make it emulate the gcc 4.9 format:
  '-Xclang-only=-Xclang=-coverage-version=409*'
  '-Xclang-only=-Xclang=-coverage-cfg-checksum'
  '-Xclang-only=-Xclang=-coverage-exit-block-before-body'
  '-Xclang-only=-Xclang=-coverage-no-function-names-in-data'
in the .gyp file, but it had no effect.

Did this work before? N/A 

Chrome version: 54.0.2840.71  Channel: n/a
OS Version: 
Flash Version: Shockwave Flash 23.0 r0
 
I made a mistake, '-Xclang=-flag' does not work. It must be two flags '-Xclang' '-somecc1flag'. Making it:

  '-Xclang-only=-Xclang', '-Xclang-only=-coverage-version=409*',
  '-Xclang-only=-Xclang', '-Xclang-only=-coverage-cfg-checksum',
  '-Xclang-only=-Xclang', '-Xclang-only=-coverage-exit-block-before-body',
  '-Xclang-only=-Xclang', '-Xclang-only=-coverage-no-function-names-in-data',

in the gyp file is sufficient to work around the crash, though there's still lots of angry messages about gcov files that should be resolved.

Comment 2 by ajha@chromium.org, Dec 1 2016

Components: Build
Labels: M-54
Labels: TE-NeedsTriageHelp
This looks like out of scope for TE, hence adding the respective label for it to  triage further.

Thanks..
Labels: Build-Toolchain OS-Chrome
Owner: rahulchaudhry@chromium.org
Rahul, could you please take a look at this?


Status: Assigned (was: Unconfirmed)
Are there some other CLs needed to reproduce this?
I reverted c/305881 and locally patched in c/304807 and c/304825.
Did "setup_board whirlwind" and "build_packages whirlwind", followed by "FEATURES=test emerge-whirlwind ap-daemons".
Gives me linking errors (missing libclang_rt.profile-armhf.a):

FAILED: flock linker.lock armv7a-cros-linux-gnueabi-clang++ -lgcov -coverage -Wl,-O1 -Wl,-O2 -Wl,--as-needed -Wl,-z,relro -Wl,-z,noexecstack -Wl,-z,now -Wl,--as-needed --sysroot=/build/whirlwind -pie -L/build/whirlwind/usr/lib -pthread -o ap-attestation-client -Wl,--start-group platf
orm/ap-daemons/api-server/tools/ap-attestation-client.attestation_client.o  -Wl,--end-group -lattestation -lbrillo-395517 -lbase-395517 -lwebserv-395517 -lprotobuf -lpthread -lsystem_api-power_manager-protos -lsystem_api-cryptohome-protos -lsystem_api-protos -ldbus-1 -lmetrics-395517
 -lssl -lcrypto -lexpat -lshill-net-395517
/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.9.0/lib/linux/libclang_rt.profile-armhf.a: No such file or directory
../../../../../../../usr/include/attestation/common/interface.pb.h:6659: error: undefined reference to 'llvm_gcda_start_file'
../../../../../../../usr/include/attestation/common/interface.pb.h:6659: error: undefined reference to 'llvm_gcda_emit_function'
../../../../../../../usr/include/attestation/common/interface.pb.h:6659: error: undefined reference to 'llvm_gcda_emit_arcs'
../../../../../../../usr/include/attestation/common/interface.pb.h:6659: error: undefined reference to 'llvm_gcda_emit_function'
../../../../../../../usr/include/attestation/common/interface.pb.h:6659: error: undefined reference to 'llvm_gcda_emit_arcs'
../../../../../../../usr/include/attestation/common/interface.pb.h:6659: error: undefined reference to 'llvm_gcda_emit_function'
../../../../../../../usr/include/attestation/common/interface.pb.h:6659: error: undefined reference to 'llvm_gcda_emit_arcs'
../../../../../../../usr/include/attestation/common/interface.pb.h:6659: error: undefined reference to 'llvm_gcda_emit_function'
../../../../../../../usr/include/attestation/common/interface.pb.h:6659: error: undefined reference to 'llvm_gcda_emit_arcs'
../../../../../../../usr/include/attestation/common/interface.pb.h:6659: error: undefined reference to 'llvm_gcda_summary_info'
../../../../../../../usr/include/attestation/common/interface.pb.h:6659: error: undefined reference to 'llvm_gcda_end_file'
../../../../../../../usr/include/attestation/common/interface.pb.h:6659: error: undefined reference to 'llvm_gcov_init'
clang-3.9: error: linker command failed with exit code 1 (use -v to see invocation)

You need to cherry pick
https://chromium-review.googlesource.com/#/c/340280/
and install the package.
Thanks Yunlian.

Patching this extra CL resolves the linker errors.
Now when I run "FEATURES=test emerge-whirlwind ap-daemons" it runs successfully (all tests passed, no signal 11/seg fault).

I notice that the errors in the original report are something about "cannot merge previous GCDA file"..
Maybe you had some gcda files left over from older runs with gcc, and now since newer runs use clang, things get confused?

Comment 9 by nlewycky@google.com, Dec 14 2016

I deleted /build and did setup_board + build_packages again, the GCDA errors are still there. The gcda errors aren't the last thing in the output, they come right before the line: 

 * Running stacked hooks for post_src_test

which is 136 lines from the bottom.
This is what I got near that. Maybe I'm missing some other CL / USE flags etc:

<snip>
[----------] Global test environment tear-down
[==========] 309 tests from 74 test cases ran. (7732 ms total)
[  PASSED  ] 309 tests.
 * Running stacked hooks for post_src_test
 *    asan_check ...                                                                                                                                                                                                                                                                 [ ok ]

>>> Install ap-daemons-0.0.3-r2447 into /build/whirlwind/tmp/portage/chromeos-base/ap-daemons-0.0.3-r2447/image/ category chromeos-base
<snip>

Ping! Is this still an issue?
Yes the problem still reproduces for me. I don't understand why, I plan to do more debugging and update when I have something. Sorry for the quiet, this my first day back post-vacation. I went OoO Dec 15th.
Status: WontFix (was: Assigned)
As you suspected, I had a gcda and gcno file pair in an unusual place that were still being picked up despite outside the /build directory. It didn't get cleaned up between runs because I was simply deleting /build. Sorry to bother you!

Sign in to add a comment