Using non-standard linker
Warner Losh
imp at bsdimp.com
Thu Dec 13 14:48:34 UTC 2012
On Dec 13, 2012, at 6:18 AM, Erik Cederstrand wrote:
> Den 13/12/2012 kl. 14.10 skrev David Chisnall <theraven at FreeBSD.org>:
>
>> Hi Eric,
>>
>> The easiest way of doing this is to make /usr/bin/ld (in the host system and in the bootstrap) into a symbolic link that points to whatever the selected linker is. I had to do this when testing gold as well (we end up with ld-gold and ld-bfd and ld being a symlink to one of them).
>
> Yes, a symlink is of course an easy solution post-install. But 'ld' is built as part of 'make toolchain', I believe, so this approach wouldn't work if I wanted mclinker to be used as the linker in 'make buildworld'. The newly built 'ld' in /usr/obj/ would be used as the linker instead.
Install ld as ld.gnu during the build and after. Make ld a small shell script that invokes ld.gnu by default, or something else if a variable is set. Much like the way we have different mail backends to a common mail front end. Then ld does what people want, and you have a hook to do different things.
Warner
More information about the freebsd-toolchain
mailing list