build: add lto configure option #10800

pull theuni wants to merge 2 commits into bitcoin:master from theuni:enable-lto changing 4 files +23 −9
  1. theuni commented at 5:03 am on July 12, 2017: member

    Addresses #10616. Please see the commit messages and note that AR/RANLIB may need to be set manually!

    This is testing the waters for LTO. There are a few unknowns:

    • A boost LTO issue was addressed here, but others may remain for different libs/versions
    • ar/ranlib detection will likely turn out to be annoying
    • Not yet tested with Gitian

    I propose adding this as-is (maybe after Gitian testing), and seeking feedback. I suspect that there will be quite a few platforms/toolchains where it’s broken, but there’s only so much we can do about it.

  2. lto: workaround for boost issue
    I'm not sure what the root cause of the issue is yet, but defining a
    boost::filesystem::path at global scope breaks linking with lto. The issue is
    either:
    - Some non-obvious ODR violation
    - A bug or UB in gcc's handling of where to put the symbol for the inlined dtor
    - Same as above, but for ld at link time
    
    Presumably this is caused by the fact that boost::filesystem::path contains a
    few methods which use static instances of a path object,
    
    The work-around is to use a static string instead.
    182736895b
  3. lto: add --enable-lto option
    Note that for gcc, AR and RANLIB may need to be manually set to gcc-ar and
    gcc-ranlib respectively.
    
    Depending on how much trouble this causes, we may need to attempt to set these.
    e05d1c2030
  4. fanquake added the label Build system on Jul 12, 2017
  5. jonasschnelli commented at 3:32 pm on July 12, 2017: contributor
    Built successfully on my gitian machine (haven’t tested the build yes though): https://bitcoin.jonasschnelli.ch/build/213
  6. laanwj commented at 7:47 pm on September 6, 2017: member
    Bleh, the boost work-around is really nasty. It breaks my use-case with cloudabi, where fs::path is not actually convertible from/to a string losslessly.
  7. MarcoFalke commented at 1:05 am on April 9, 2018: member
    @theuni This can be closed given #10616 (comment) ? Otherwise needs rebase
  8. MarcoFalke added the label Needs rebase on Jun 6, 2018
  9. laanwj commented at 6:14 pm on June 24, 2018: member
    Closing, let me know when it needs to be reopened.
  10. laanwj closed this on Jun 24, 2018

  11. laanwj removed the label Needs rebase on Oct 24, 2019
  12. fanquake referenced this in commit 681b25e3cd on Nov 25, 2021
  13. sidhujag referenced this in commit 67658eec7d on Nov 25, 2021
  14. DrahtBot locked this on Dec 16, 2021

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-09-29 01:12 UTC

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