cmake: fatal error when PIE not supported #33282

pull stickies-v wants to merge 1 commits into bitcoin:master from stickies-v:2025-09/cmake-pie-fatal changing 3 files +24 −7
  1. stickies-v commented at 1:22 pm on September 2, 2025: contributor

    This simultaneously avoids silently overriding user preferences while making it harder to accidentally build without PIE support by requiring an explicit setting.

    This introduces two behaviour changes:

    1. a user-defined CMAKE_POSITION_INDEPENDENT_CODE=OFF will now be respected by our build system, instead of silently overriding it like before
    2. when not explicitly disabled, lack of PIE support will raise a FATAL_ERROR instead of a WARNING, with a help instruction that this can be overridden with -DCMAKE_POSITION_INDEPENDENT_CODE=0

    Removes a dependency on our custom configure_warnings system.

  2. DrahtBot added the label Build system on Sep 2, 2025
  3. DrahtBot commented at 1:22 pm on September 2, 2025: 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/33282.

    Reviews

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

  4. hebasto commented at 2:35 pm on September 2, 2025: member
  5. purpleKarrot commented at 3:48 pm on September 3, 2025: contributor

    Where is it defined or documented why CMAKE_POSITION_INDEPENDENT_CODE is set to ON in the first place?

    A better approach would be to not override user preferences at all and set the POSITION_INDEPENDENT_CODE target property explicitly on targets that need it.

  6. stickies-v force-pushed on Sep 3, 2025
  7. stickies-v commented at 4:23 pm on September 3, 2025: contributor

    A better approach would be to not override user preferences at all

    Thanks for the review. I think I agree. I already tried to improve that behaviour by not overriding CMAKE_POSITION_INDEPENDENT_CODE when it was set by the user, but it seems better to not change it at all, as you say.

    I’ve force-pushed to use our existing core_interface to propagate INTERFACE_POSITION_INDEPENDENT_CODE to all our targets, since I think the current behaviour of using PIE for all targets is sensible. What do you think about this approach?

  8. purpleKarrot commented at 4:36 pm on September 3, 2025: contributor

    I think the current behaviour of using PIE for all targets is sensible

    I am not convinced and I really would like to know the rationale for that. Maybe @hebasto or @theuni knows?

  9. cmake: fatal error when PIE not supported
    This simultaneously avoids silently overriding user preferences while
    making it harder to accidentally build without PIE support by requiring an
    explicit setting.
    
    This introduces two behaviour changes:
    1. a user-defined `CMAKE_POSITION_INDEPENDENT_CODE=OFF will now be
       respected by our build system, instead of overriding it like before
    2. when not explicitly disabled, lack of PIE support will raise a
       FATAL_ERROR instead of a WARNING
    
    Removes a dependency on our custom configure_warnings system.
    917d7461c0
  10. stickies-v force-pushed on Sep 3, 2025

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: 2025-09-10 18:13 UTC

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