[swift-dev] [RFC] Moving to gold linker

William Dillon william at housedillon.com
Thu Jan 14 13:07:57 CST 2016

>> 1. Is moving to or supporting Gold within the swift toolchain (not building swift itself) a goal, non-goal, or not desired?
> I can't speak for the project, but I can speak for myself.
> My naive understanding is that swift uses two linkers because 'INSERT
> AFTER' linker script directive isn't supported (in gold). I read a lot about
> that -- and I felt like the gold developers didn't care about adding
> this command as it's mainly of use for the default linker script
> shipped with ld.bfd.
> They also provided an alternative way to obtain the same semantics
> without providing an additional directive. Other than that, I don't
> know any other reasons why gold shouldn't be used.

That’s right, AFAIK.  Orlando developed a system using two assembler files that bookend the objects during link to achieve the same result as the ld script.  Additionally, this method works with BFD, so swift.ld can be discarded entirely.

>> 2. Should the swift toolchain support the selection of linkers on the command line, and if so, what’s the default?
> If you mean something like -fuse-ld for clang, I'd like to see that
> happen (if not supported already). As lld developer I found that very
> useful and I hope to be able to link swift and swiftc-generated
> executables using lld, so, yes.

That is the expectation, yes.

More information about the swift-dev mailing list