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
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
|
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
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.
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?