FS#12230 - Enable/build Gold in binutils

Attached to Project: Arch Linux
Opened by Martin Sandsmark (sandsmark) - Monday, 24 November 2008, 20:32 GMT
Last edited by Allan McRae (Allan) - Saturday, 28 March 2009, 04:04 GMT
Task Type Feature Request
Category Packages: Core
Status Closed
Assigned To Andreas Radke (AndyRTR)
Allan McRae (Allan)
Architecture All
Severity Low
Priority Normal
Reported Version None
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Gold is a new linker, written as a drop-in replacement for gnu ld, by Google.
It can be built by passing --enable-gold to the binutils configuration script. It should have no adverse effects, but should make the new gold linker be built. Which is awesome and fast.

Then you can replace your /bin/ld with this tiny c-program, and make the proper arrengements, and voila, easy to switch between gold and plain gnu ld:
#include <stdlib.h>
#include <stdio.h>

int main(int argc, char *argv[])
{
// C at what it does best :)

const char *ld_env_var = getenv("USE_GOLD_LINKER"); // "USE_GOLD_LINKER" kids, mmmkay?
const char *linker_name = 0;
if (ld_env_var && ld_env_var[0] != '\0' ) {
// OK, the environment variable exists and it has nonzero length...
argv[0] = "/usr/bin/ld-new";
linker_name = "gold";
} else {
argv[0] = "/usr/bin/ld-old";
linker_name = "GNU ld";
}

if (execvp(*argv, argv) < 0) {
fprintf(stderr, "** exec failed. Probably the %s executable %s was not found.\n", linker_name, argv[0]);
return -1;
}

//unreachable
fprintf(stderr, "Gamma ray burst registered.\n");
return -1;
}
This task depends upon

Closed by  Allan McRae (Allan)
Saturday, 28 March 2009, 04:04 GMT
Reason for closing:  Deferred
Comment by Andreas Radke (AndyRTR) - Wednesday, 26 November 2008, 17:01 GMT
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gold/README?rev=1.2&content-type=text/x-cvsweb-markup&cvsroot=src

the gold linker is still in experimental state and lacking features. so far i don't know one distribution using it in their repositories. sure we should follow how things will improve. one day you prove all our packages in core+extra can be built with it we might switch over for a complete replacement. i dislike your handling with USE_GOLD_LINKER var. for now i think AUR would be a nice place for a binutils-gold pkg replacing the one from core with either only gold or with a hacky solution you show here.

maybe you should better raise the question if gold can be build along the gnu ld on the binutils mailing list? i'm subscribed to it.

Comment by Martin Sandsmark (sandsmark) - Thursday, 27 November 2008, 15:40 GMT
Ah, I was under the impression that --enable-gold merely built gold, not that it changed the default ld.

FWIW, KDE builds just fine with gold already (that's why I want it =). I'll experiment a bit more, and probably just put a package in AUR/kdemod playground.

What exactly are your concerns regarding the USE_GOLD_LINKER env variable?
Comment by Allan McRae (Allan) - Saturday, 28 March 2009, 04:03 GMT
This is going to be closed as "deferred". I still do not think gold is bug free enough to be used as the primary system linker. And there appears to be no demand to use this as no package made its way to the AUR...

Loading...