theuni
commented at 8:57 PM on July 15, 2020:
member
This didn't work for a few reasons (various toolchain compatibility issues) the last time I tested it, but after the last round of bumps it works with no apparent issues.
Note that this does not enable LTO by default in any way, only hooks up the machinery for -flto to work correctly when specified.
Lines were split for an easier rebase after #17919 is merged.
fanquake added the label Build system on Jul 15, 2020
fanquake
commented at 1:00 PM on July 16, 2020:
member
Concept ACK 🚀
depends: enable lto support for Apple's ld64
Note that this does not _enable_ lto by default in any way, only hooks up the
machinery for -flto to work correctly.
enable-lto-support is explicitly used for pinned-clang because we know it
works. It is neither enabled nor disabled in the external clang case so that
it can be auto-detected.
00d1ba7aaa
depends: bump native_cctools for fixed lto with external clang
https://github.com/tpoechtrager/cctools-port/pull/85 was merged upstream, which
fixes lto detection for external clang with some Linux Distro's including
Ubuntu.
5962522fbc
theuni force-pushed on Jul 16, 2020
theuni
commented at 8:06 PM on July 16, 2020:
member
[ 97%] Building C object genisoimage/CMakeFiles/genisoimage.dir/endian.o
[ 97%] Building C object genisoimage/CMakeFiles/genisoimage.dir/sha1.o
[ 97%] Building C object genisoimage/CMakeFiles/genisoimage.dir/sha256.o
[ 98%] Building C object genisoimage/CMakeFiles/genisoimage.dir/sha512.o
[ 98%] Building C object genisoimage/CMakeFiles/genisoimage.dir/checksum.o
[100%] Linking C executable genisoimage
/usr/bin/ld: CMakeFiles/genisoimage.dir/apple.o:(.bss+0x0): multiple definition of `outfile'; CMakeFiles/genisoimage.dir/genisoimage.o:(.bss+0x0): first defined here
/usr/bin/ld: CMakeFiles/genisoimage.dir/boot.o:(.bss+0x0): multiple definition of `outfile'; CMakeFiles/genisoimage.dir/genisoimage.o:(.bss+0x0): first defined here
/usr/bin/ld: CMakeFiles/genisoimage.dir/desktop.o:(.bss+0x0): multiple definition of `outfile'; CMakeFiles/genisoimage.dir/genisoimage.o:(.bss+0x0): first defined here
/usr/bin/ld: CMakeFiles/genisoimage.dir/dvd_file.o:(.bss+0x0): multiple definition of `outfile'; CMakeFiles/genisoimage.dir/genisoimage.o:(.bss+0x0): first defined here
/usr/bin/ld: CMakeFiles/genisoimage.dir/dvd_reader.o:(.bss+0x0): multiple definition of `outfile'; CMakeFiles/genisoimage.dir/genisoimage.o:(.bss+0x0): first defined here
/usr/bin/ld: CMakeFiles/genisoimage.dir/eltorito.o:(.bss+0x0): multiple definition of `outfile'; CMakeFiles/genisoimage.dir/genisoimage.o:(.bss+0x0): first defined here
/usr/bin/ld: CMakeFiles/genisoimage.dir/files.o:(.bss+0x0): multiple definition of `outfile'; CMakeFiles/genisoimage.dir/genisoimage.o:(.bss+0x0): first defined here
/usr/bin/ld: CMakeFiles/genisoimage.dir/hash.o:(.bss+0x0): multiple definition of `outfile'; CMakeFiles/genisoimage.dir/genisoimage.o:(.bss+0x0): first defined here
/usr/bin/ld: CMakeFiles/genisoimage.dir/ifo_read.o:(.bss+0x0): multiple definition of `outfile'; CMakeFiles/genisoimage.dir/genisoimage.o:(.bss+0x0): first defined here
/usr/bin/ld: CMakeFiles/genisoimage.dir/joliet.o:(.bss+0x0): multiple definition of `outfile'; CMakeFiles/genisoimage.dir/genisoimage.o:(.bss+0x0): first defined here
/usr/bin/ld: CMakeFiles/genisoimage.dir/mac_label.o:(.bss+0x0): multiple definition of `outfile'; CMakeFiles/genisoimage.dir/genisoimage.o:(.bss+0x0): first defined here
/usr/bin/ld: CMakeFiles/genisoimage.dir/multi.o:(.bss+0x0): multiple definition of `outfile'; CMakeFiles/genisoimage.dir/genisoimage.o:(.bss+0x0): first defined here
/usr/bin/ld: CMakeFiles/genisoimage.dir/name.o:(.bss+0x0): multiple definition of `outfile'; CMakeFiles/genisoimage.dir/genisoimage.o:(.bss+0x0): first defined here
/usr/bin/ld: CMakeFiles/genisoimage.dir/rock.o:(.bss+0x0): multiple definition of `outfile'; CMakeFiles/genisoimage.dir/genisoimage.o:(.bss+0x0): first defined here
/usr/bin/ld: CMakeFiles/genisoimage.dir/scsi.o:(.bss+0x0): multiple definition of `outfile'; CMakeFiles/genisoimage.dir/genisoimage.o:(.bss+0x0): first defined here
/usr/bin/ld: CMakeFiles/genisoimage.dir/stream.o:(.bss+0x0): multiple definition of `outfile'; CMakeFiles/genisoimage.dir/genisoimage.o:(.bss+0x0): first defined here
/usr/bin/ld: CMakeFiles/genisoimage.dir/tree.o:(.bss+0x0): multiple definition of `outfile'; CMakeFiles/genisoimage.dir/genisoimage.o:(.bss+0x0): first defined here
/usr/bin/ld: CMakeFiles/genisoimage.dir/udf.o:(.bss+0x0): multiple definition of `outfile'; CMakeFiles/genisoimage.dir/genisoimage.o:(.bss+0x0): first defined here
/usr/bin/ld: CMakeFiles/genisoimage.dir/volume.o:(.bss+0x0): multiple definition of `outfile'; CMakeFiles/genisoimage.dir/genisoimage.o:(.bss+0x0): first defined here
/usr/bin/ld: CMakeFiles/genisoimage.dir/write.o:(.bss+0x0): multiple definition of `outfile'; CMakeFiles/genisoimage.dir/genisoimage.o:(.bss+0x0): first defined here
/usr/bin/ld: CMakeFiles/genisoimage.dir/boot-alpha.o:(.bss+0x0): multiple definition of `outfile'; CMakeFiles/genisoimage.dir/genisoimage.o:(.bss+0x0): first defined here
/usr/bin/ld: CMakeFiles/genisoimage.dir/boot-hppa.o:(.bss+0x0): multiple definition of `outfile'; CMakeFiles/genisoimage.dir/genisoimage.o:(.bss+0x0): first defined here
/usr/bin/ld: CMakeFiles/genisoimage.dir/boot-mips.o:(.bss+0x0): multiple definition of `outfile'; CMakeFiles/genisoimage.dir/genisoimage.o:(.bss+0x0): first defined here
/usr/bin/ld: CMakeFiles/genisoimage.dir/jte.o:(.bss+0x0): multiple definition of `outfile'; CMakeFiles/genisoimage.dir/genisoimage.o:(.bss+0x0): first defined here
/usr/bin/ld: CMakeFiles/genisoimage.dir/rsync.o:(.bss+0x0): multiple definition of `outfile'; CMakeFiles/genisoimage.dir/genisoimage.o:(.bss+0x0): first defined here
/usr/bin/ld: CMakeFiles/genisoimage.dir/boot-mipsel.o:(.bss+0x0): multiple definition of `outfile'; CMakeFiles/genisoimage.dir/genisoimage.o:(.bss+0x0): first defined here
/usr/bin/ld: CMakeFiles/genisoimage.dir/checksum.o:(.bss+0x0): multiple definition of `outfile'; CMakeFiles/genisoimage.dir/genisoimage.o:(.bss+0x0): first defined here
collect2: error: ld returned 1 exit status
Have not investigated further.
fanquake added the label Needs gitian build on Jul 17, 2020
theuni
commented at 12:53 PM on July 17, 2020:
member
@fanquake Strange... this is fine locally, and our c-i didn't have any trouble with it either.
Is the problem locally reproducible?
theuni
commented at 3:21 PM on July 17, 2020:
member
For me, builds of bitcoind and bitcoin-qt even succeed with lto enabled for dependencies as well with the following hack:
diff --git a/depends/hosts/darwin.mk b/depends/hosts/darwin.mk
index 6099fd4c71..c4180ac2f8 100644
--- a/depends/hosts/darwin.mk
+++ b/depends/hosts/darwin.mk
@@ -28,8 +28,8 @@ OSX_SDK=$(SDK_PATH)/Xcode-$(XCODE_VERSION)-$(XCODE_BUILD_ID)-extracted-SDK-with-
# https://reviews.llvm.org/D64089, we should use that instead. Read the
# differential summary there for more details.
#
-darwin_CC=clang -target $(host) -mmacosx-version-min=$(OSX_MIN_VERSION) --sysroot $(OSX_SDK) -mlinker-version=$(LD64_VERSION) -B$(build_prefix)/bin
-darwin_CXX=clang++ -target $(host) -mmacosx-version-min=$(OSX_MIN_VERSION) --sysroot $(OSX_SDK) -stdlib=libc++ -mlinker-version=$(LD64_VERSION) -B$(build_prefix)/bin -nostdinc++ -isystem $(OSX_SDK)/usr/include/c++/v1
+darwin_CC=clang -target $(host) -mmacosx-version-min=$(OSX_MIN_VERSION) --sysroot $(OSX_SDK) -mlinker-version=$(LD64_VERSION) -B$(build_prefix)/bin -flto=thin
+darwin_CXX=clang++ -target $(host) -mmacosx-version-min=$(OSX_MIN_VERSION) --sysroot $(OSX_SDK) -stdlib=libc++ -mlinker-version=$(LD64_VERSION) -B$(build_prefix)/bin -nostdinc++ -isystem $(OSX_SDK)/usr/include/c++/v1 -flto=thin
darwin_CFLAGS=-pipe
darwin_CXXFLAGS=$(darwin_CFLAGS)
It's almost suspicious how well/easily that worked. I'll dig further to make sure it's actually doing full lto under the hood.
DrahtBot
commented at 5:56 PM on July 18, 2020:
member
The solution seemed to be to pass -object_path_lto through to ld64. Doing that I end up with a properly generated .dSYM:
I think I understand what's happening here. From the clang docs
The default for :option:`-flto` is "full", in which the
LLVM bitcode is suitable for monolithic Link Time Optimization (LTO), where
the linker merges all such modules into a single combined module for
optimization. With "thin", :doc:`ThinLTO <../ThinLTO>`
compilation is invoked instead.
.. note::
On Darwin, when using :option:`-flto` along with :option:`-g` and
compiling and linking in separate steps, you also need to pass
``-Wl,-object_path_lto,<lto-filename>.o`` at the linking step to instruct the
ld64 linker not to delete the temporary object file generated during Link
Time Optimization (this flag is automatically passed to the linker by Clang
if compilation and linking are done in a single step). This allows debugging
the executable as well as generating the ``.dSYM`` bundle using :manpage:`dsymutil(1)`.
That's describing us.
The machinery to get clang to do this for you only applies when compiling and linking at the same time. Here's a comment from elsewhere explaining why:
// Add a 'dsymutil' step if necessary, when debug info is enabled and we
// have a compile input. We need to run 'dsymutil' ourselves in such cases
// because the debug info will refer to a temporary object file which
// will be removed at the end of the compilation process.
I can confirm that is working as intended with a test-case:
So, it sounds as though everything is actually working as intended. We just need to add that link flag if lto and debugging are on. But we're getting ahead of ourselves, as we don't have an option for lto yet :)
fanquake referenced this in commit 007e15dcd7 on Jul 24, 2020
naumenkogs referenced this in commit 1c73c54479 on Jul 24, 2020
sidhujag referenced this in commit 26b9a95b92 on Jul 24, 2020
sidhujag referenced this in commit 72a7a0e88b on Jul 24, 2020
sidhujag referenced this in commit ff4a47add1 on Jul 24, 2020
fanquake approved
fanquake
commented at 7:41 AM on July 28, 2020:
member
ACK5962522fbcb7b72c269fc271ac4463791a103918. The relevant option upstream is here.
fanquake merged this on Jul 28, 2020
fanquake closed this on Jul 28, 2020
sidhujag referenced this in commit aad54d66aa on Jul 28, 2020
zkbot referenced this in commit 2a39656e6d on Jul 30, 2020
Warchant referenced this in commit 3b5baf7709 on Aug 6, 2020
zkbot referenced this in commit e0692ed4df on Aug 7, 2020
deadalnix referenced this in commit 9e3969ba97 on Jan 5, 2021
furszy referenced this in commit 816f42d7ac on May 25, 2021
PastaPastaPasta referenced this in commit 53ed3f6697 on Jun 27, 2021
PastaPastaPasta referenced this in commit 22165582ec on Jun 28, 2021
PastaPastaPasta referenced this in commit 19bd7eb467 on Jun 29, 2021
PastaPastaPasta referenced this in commit 08a97ffed1 on Jul 1, 2021
PastaPastaPasta referenced this in commit 3e33950447 on Jul 1, 2021
PastaPastaPasta referenced this in commit c3a4b8ea1b on Jul 15, 2021
PastaPastaPasta referenced this in commit ca2d095489 on Jul 16, 2021
kittywhiskers referenced this in commit 9f97a97a11 on Aug 24, 2021
kittywhiskers referenced this in commit e7a28348a0 on Aug 24, 2021
kittywhiskers referenced this in commit cbe90ef8eb on Aug 24, 2021
kittywhiskers referenced this in commit 0220032161 on Aug 24, 2021
kittywhiskers referenced this in commit 7686acc1a5 on Aug 24, 2021
kittywhiskers referenced this in commit be1b17355e on Aug 24, 2021
kittywhiskers referenced this in commit b86adc79fc on Aug 25, 2021
kittywhiskers referenced this in commit 1ab73d5e71 on Aug 25, 2021
kittywhiskers referenced this in commit ebe5a0c20a on Aug 26, 2021
kittywhiskers referenced this in commit 2ec15d3d75 on Aug 26, 2021
kittywhiskers referenced this in commit 62dc66ce3d on Aug 26, 2021
kittywhiskers referenced this in commit f9ba0f6995 on Aug 27, 2021
kittywhiskers referenced this in commit 17e32dd03f on Aug 30, 2021
kittywhiskers referenced this in commit bba2bd4b7b on Sep 1, 2021
kittywhiskers referenced this in commit 66f68786c6 on Sep 1, 2021
kittywhiskers referenced this in commit cc575e6f0c on Sep 2, 2021
kittywhiskers referenced this in commit d3c22d9474 on Sep 3, 2021
kittywhiskers referenced this in commit 9f2019b36b on Sep 3, 2021
kittywhiskers referenced this in commit 9c81cd1e82 on Sep 3, 2021
kittywhiskers referenced this in commit adbc5f1dde on Sep 4, 2021
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: 2026-04-26 09:15 UTC
This site is hosted by @0xB10C More mirrored repositories can be found on mirror.b10c.me