build: Use -ffile-prefix-map in release builds only #31337

pull hebasto wants to merge 1 commits into bitcoin:master from hebasto:241120-prefix-map changing 2 files +6 −2
  1. hebasto commented at 9:41 pm on November 20, 2024: member

    This PR follows up on #30811, which inadvertently broke OSS-Fuzz coverage builds due to the -ffile-prefix-map option also implying -fprofile-prefix-map.

    With this PR, only the -fdebug-prefix-map and -fmacro-prefix-map options are applied only for non-release builds.

    Note for reviewers: Please ensure that #30799 is not reintroduced.

  2. build: Use `-ffile-prefix-map` in release builds only
    The `-ffile-prefix-map` option also implies `-fprofile-prefix-map`,
    which causes issues with Clang's source-based code coverage,
    particularly in OSS-Fuzz builds
    (see https://issues.oss-fuzz.com/issues/379122777).
    
    This change partially reverts commit 788c1324f3d840f7a39b8bc3537dcff26ca0b552
    from https://github.com/bitcoin/bitcoin/pull/30811. For non-release
    builds, only the `-fdebug-prefix-map` and `-fmacro-prefix-map` options
    are applied.
    7002a4b392
  3. hebasto added the label Build system on Nov 20, 2024
  4. DrahtBot commented at 9:41 pm on November 20, 2024: contributor

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    Code Coverage & Benchmarks

    For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/31337.

    Reviews

    See the guideline for information on the review process. A summary of reviews will appear here.

  5. in contrib/guix/libexec/build.sh:215 in 7002a4b392
    211@@ -212,6 +212,7 @@ CONFIGFLAGS="-DREDUCE_EXPORTS=ON -DBUILD_BENCH=OFF -DBUILD_GUI_TESTS=OFF -DBUILD
    212 HOST_CFLAGS="-O2 -g"
    213 HOST_CFLAGS+=$(find /gnu/store -maxdepth 1 -mindepth 1 -type d -exec echo -n " -ffile-prefix-map={}=/usr" \;)
    214 case "$HOST" in
    215+    *linux*)  HOST_CFLAGS+=" -ffile-prefix-map=${DISTSRC}/src=." ;;
    


    maflcko commented at 8:05 am on November 21, 2024:
    Why is this needed? guix never compiles with --coverage, no? See https://gcc.gnu.org/onlinedocs/gcc/Instrumentation-Options.html#index-fprofile-prefix-map
  6. maflcko commented at 8:06 am on November 21, 2024: member
    Good catch, but I think the upstream docs were wrong in this case. For me, they don’t mention coverage is affected as well: https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-ffile-prefix-map
  7. maflcko added this to the milestone 29.0 on Nov 21, 2024


hebasto DrahtBot maflcko

Labels
Build system

Milestone
29.0


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-11-21 09:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me