On 1/10/2016 1:57 AM, John Frankish wrote:
Isn't this the same as compiling with CC="gcc -flto -fuse-linker-plugin.."? If so, maybe just this could be mentioned.
Nope, two completely different animals. gold is a new linker that was introduced to binutils in 2008. LTO (Link-time Optimization) was a feature that was introduced to GCC fairly recently as well (I don't have an exact date, but it wasn't too far behind gold). The BFD linker will use LTO directly - more accurately, GCC just dumps everything to disk and ld already knows how to deal with it. It was also introduced as a plugin for both the bfd and gold linkers. Obviously, 'new' is a relative term being it's already 9 years old, but our current libbfd backed linker dates back to 1991, at 25 years, or maybe even older...I pulled up the Cygnus history, but it's fuzzy about the time frame for libbfd. Our current linker also supports tons of platforms and several file formats (something like 200 host/target/format combinations currently), whereas gold is elf only and only a handful of free targets (Linux, *BSD, (HURD?), etc.), on x86 and x86_64.
Gold's biggest contribution is considerably faster link time, hence the suggestion earlier to use it in larger C++ programs where you are pulling in tons of libs. The author said up to 5 times as fast inside Google (for whatever that is worth), but even 1.1x at link time for larger builds would be worth taking a look at if you are using it a lot. You can read more about gold (and linkers in general) from the author's blog starting at
http://www.airs.com/blog/archives/38 and ending at http://www.airs.com/blog/archives/57 It's long, but certainly worth the read if you haven't already. -- DJ -- http://lists.linuxfromscratch.org/listinfo/lfs-dev FAQ: http://www.linuxfromscratch.org/faq/ Unsubscribe: See the above information page
