Closed Bug 1471339 Opened 7 years ago Closed 7 years ago

Enable Rust coverage in Linux builds

Categories

(Testing :: Code Coverage, enhancement)

enhancement
Not set
normal

Tracking

(firefox63 fixed)

RESOLVED FIXED
mozilla63
Tracking Status
firefox63 --- fixed

People

(Reporter: marco, Assigned: marco)

References

Details

Attachments

(7 files, 1 obsolete file)

We have two options: 1) Switch the Linux ccov builds to use Clang; 2) Keep using GCC, manually link to clang_rt.profile-x86_64. Locally the GCC build works with clang_rt.profile-x86_64 (after removing the __gcov_flush symbol from this library, as otherwise the linking fails as the symbol is defined twice). It might be the fasteset avenue, compared to fighting with the test failures in the Clang build.
Depends on: 1404433
Assignee: nobody → mcastelluccio
Status: NEW → ASSIGNED
Attachment #8991280 - Flags: review?(mh+mozilla)
Attachment #8991280 - Attachment description: update_rust_nightly → Update Rust Nightly to 2018-06-23
Attachment #8991280 - Attachment is patch: true
Attachment #8991282 - Flags: review?(mh+mozilla)
Attachment #8991284 - Flags: review?(jmaher)
Comment on attachment 8991281 [details] [diff] [review] Use Nightly Rust for coverage builds on Linux Review of attachment 8991281 [details] [diff] [review]: ----------------------------------------------------------------- will we switch back? if so we should have a bug on file and maybe a comment here referencing the bug.
Attachment #8991281 - Flags: review?(jmaher) → review+
Comment on attachment 8991284 [details] [diff] [review] Use clang 7 for Linux ccov builds Review of attachment 8991284 [details] [diff] [review]: ----------------------------------------------------------------- I am assuming this is not causing other problems in the builds or tests.
Attachment #8991284 - Flags: review?(jmaher) → review+
Comment on attachment 8991287 [details] [diff] [review] Add RUSTFLAGS to Linux coverage build to enable gcov profiling for Rust Review of attachment 8991287 [details] [diff] [review]: ----------------------------------------------------------------- big old rubber stamp
Attachment #8991287 - Flags: review?(jmaher) → review+
Comment on attachment 8991280 [details] [diff] [review] Update Rust Nightly to 2018-06-23 Review of attachment 8991280 [details] [diff] [review]: ----------------------------------------------------------------- ::: taskcluster/ci/toolchain/linux.yml @@ +454,5 @@ > run: > using: toolchain-script > script: repack_rust.py > arguments: [ > + '--channel', 'nightly-2018-06-23', might as well update the the last version available when you land, which will get you a version with llvm 7.
Attachment #8991280 - Flags: review?(mh+mozilla) → review+
Attachment #8991282 - Flags: review?(mh+mozilla) → review+
Comment on attachment 8991285 [details] [diff] [review] Rename LLVM's __gcov_flush function to __llvm_gcov_flush to avoid naming clashes with GCC profiling library Review of attachment 8991285 [details] [diff] [review]: ----------------------------------------------------------------- Why would we have naming clashes? Because of bug 1409276?
Comment on attachment 8991286 [details] [diff] [review] Link with clang_rt.profile-x86_64 library in code coverage builds Review of attachment 8991286 [details] [diff] [review]: ----------------------------------------------------------------- ::: toolkit/library/moz.build @@ +350,5 @@ > + > +# This library contains functions needed for gcov profiling, which Rust uses > +# when compiled with -Zprofile. > +if CONFIG['MOZ_CODE_COVERAGE']: > + OS_LIBS += ['clang_rt.profile-x86_64'] the windows builds do that through LDFLAGS in the mozconfig. Which sounds better because libxul is not the only thing we link, although at the moment it happens to be the only one that links rust, but that's not going to stay true.
Attachment #8991286 - Flags: review?(mh+mozilla)
(In reply to Mike Hommey [:glandium] from comment #13) > Comment on attachment 8991286 [details] [diff] [review] > Link with clang_rt.profile-x86_64 library in code coverage builds > > Review of attachment 8991286 [details] [diff] [review]: > ----------------------------------------------------------------- > > ::: toolkit/library/moz.build > @@ +350,5 @@ > > + > > +# This library contains functions needed for gcov profiling, which Rust uses > > +# when compiled with -Zprofile. > > +if CONFIG['MOZ_CODE_COVERAGE']: > > + OS_LIBS += ['clang_rt.profile-x86_64'] > > the windows builds do that through LDFLAGS in the mozconfig. Which sounds > better because libxul is not the only thing we link, although at the moment > it happens to be the only one that links rust, but that's not going to stay > true. The problem is that adding it to LDFLAGS doesn't add it at the end of the linker command, so the gcov symbols get removed. Any suggestion how to work around this?
Flags: needinfo?(mh+mozilla)
(In reply to Mike Hommey [:glandium] from comment #12) > Comment on attachment 8991285 [details] [diff] [review] > Rename LLVM's __gcov_flush function to __llvm_gcov_flush to avoid naming > clashes with GCC profiling library > > Review of attachment 8991285 [details] [diff] [review]: > ----------------------------------------------------------------- > > Why would we have naming clashes? Because of bug 1409276? Both GCC and LLVM are providing __gcov_flush. We are compiling the C++ code with GCC and the Rust code with LLVM, so in the end we end up with two __gcov_flush symbols.
Why not do the C++ compilation for those coverage builds with clang? Wouldn't clang even add clang_rt.profile-x86_64 to its linker invocation on its own?
Flags: needinfo?(mh+mozilla)
(In reply to Mike Hommey [:glandium] from comment #16) > Why not do the C++ compilation for those coverage builds with clang? > Wouldn't clang even add clang_rt.profile-x86_64 to its linker invocation on > its own? We can do it but it will require more time to get it fully working (there are many tests failing or timing out when switching to Clang, so we need to tweak their timeouts, disable the ones we can't fix, etc.). Also, GCC currently has more precise gcov coverage information.
Attachment #8991285 - Flags: review?(mh+mozilla) → review+
(In reply to Marco Castelluccio [:marco] from comment #14) > The problem is that adding it to LDFLAGS doesn't add it at the end of the > linker command, so the gcov symbols get removed. > Any suggestion how to work around this? Try setting LIBS instead of LDFLAGS (from the mozconfig).
(In reply to Mike Hommey [:glandium] from comment #18) > (In reply to Marco Castelluccio [:marco] from comment #14) > > The problem is that adding it to LDFLAGS doesn't add it at the end of the > > linker command, so the gcov symbols get removed. > > Any suggestion how to work around this? > > Try setting LIBS instead of LDFLAGS (from the mozconfig). Thanks, it worked!
Attachment #8991286 - Attachment is obsolete: true
Attachment #8992881 - Flags: review?(mh+mozilla)
Attachment #8992881 - Flags: review?(mh+mozilla) → review+
Pushed by mcastelluccio@mozilla.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/4bd5799f38ea Update Rust Nightly to 2018-07-18. r=glandium https://hg.mozilla.org/integration/mozilla-inbound/rev/a2c059da18d6 Use Nightly Rust for coverage builds on Linux. r=jmaher https://hg.mozilla.org/integration/mozilla-inbound/rev/8c07f4beab64 Introduce clang 7 toolchain build. r=glandium https://hg.mozilla.org/integration/mozilla-inbound/rev/4506b20cab42 Use clang 7 for Linux ccov builds. r=jmaher https://hg.mozilla.org/integration/mozilla-inbound/rev/a4e32af75247 Rename LLVM's __gcov_flush function to __llvm_gcov_flush to avoid naming clashes with GCC profiling library. r=glandium https://hg.mozilla.org/integration/mozilla-inbound/rev/3424dbb3eaa5 Link with clang_rt.profile-x86_64 library in Linux code coverage builds. r=glandium https://hg.mozilla.org/integration/mozilla-inbound/rev/76540384ad3d Add RUSTFLAGS to Linux coverage build to enable gcov profiling for Rust. r=jmaher
Backed out changeset 76540384ad3d (bug 1471339) by marco's request. https://hg.mozilla.org/mozilla-central/rev/4aa8eb6e5ca7
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Target Milestone: mozilla63 → ---
Status: REOPENED → RESOLVED
Closed: 7 years ago7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla63
All the prerequisites landed, but the patch to actually enable it is backed out (errors while linking dump_syms).
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Depends on: 1478969
Pushed by mcastelluccio@mozilla.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/5cd3b13d5eb9 Add RUSTFLAGS to Linux coverage build to enable gcov profiling for Rust. r=jmaher
Status: REOPENED → RESOLVED
Closed: 7 years ago7 years ago
Resolution: --- → FIXED
No longer depends on: 1404433
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: