Questions tagged [gold-linker]

`gold` is the name of a ELF linker included in binutils

gold is an linker included in binutils as a faster, ELF-only, alternative to the traditional linker known as ld or ld.bfd.

Is considered in beta. (as of February, 2013, binutils release 2.23-1)

It was started on Google and then release as open source and added to binutils.

50 questions
93
votes
8 answers

Replacing ld with gold - any experience?

Has anyone tried to use gold instead of ld? gold promises to be much faster than ld, so it may help speeding up test cycles for large C++ applications, but can it be used as drop-in replacement for ld? Can gcc/g++ directly call gold.? Are there any…
IanH
  • 3,968
  • 2
  • 23
  • 26
53
votes
2 answers

What's the difference between `-rpath-link` and `-L`?

The man for gold states: -L DIR, --library-path DIR Add directory to search path --rpath-link DIR Add DIR to link time shared library search path The man for bfd ld makes it sort of sound like -rpath-link is used for…
lanza
  • 1,512
  • 2
  • 13
  • 26
37
votes
1 answer

How to link with the GNU gold linker instead of ld in Haskell

My Haskell project spends lots of time in Linking dist/build/myapp/myapp ... and also in loading shared libraries when executing TemplateHaskell code. I suspect this is because ld is slow. How can I improve link times by switching to the gold…
nh2
  • 24,526
  • 11
  • 79
  • 128
28
votes
3 answers

Is the lld linker a drop-in replacement for ld and gold?

The linker from the LLVM project lld is currently developed with new features added week by week. Its developers promise that lld is faster than ld. How does it compete compared to gold? Is lld a drop-in replacement for ld? With gold there are some…
usr1234567
  • 21,601
  • 16
  • 108
  • 128
17
votes
1 answer

-fsanitize not using gold linker in GCC-6.1

Update (30-Sept-2016) The Ubuntu build of gcc-6.2 ((Ubuntu 6.2.0-3ubuntu11~16.04) 6.2.0 20160901) no longer has this issue. I'm using the Ubuntu build of gcc-6.1[1] ((Ubuntu 6.1.1-3ubuntu11~14.04.1) 6.1.1 20160511), GNU binutils 2.24, and libstdc++…
Tim
  • 1,517
  • 1
  • 9
  • 15
16
votes
1 answer

Requirements to use flto

If I want to compile my project with -flto is it enough to have built gcc with --enable-gold or do I also need to build gold and replace ld with it? And do I need any other flags? Ie I'm doing this gcc -flto one.c two.c
chew socks
  • 1,406
  • 2
  • 17
  • 37
7
votes
1 answer

Cabal install error /usr/bin/ld: --hash-size=31: unknown option

When trying to install any package on my computer using a command like cabal install http-conduit the installation aborts with the following error: /usr/bin/ld: --hash-size=31: unknown option How can I resolve this? Note: This question…
Uli Köhler
  • 13,012
  • 16
  • 70
  • 120
6
votes
1 answer

Is it possible to compile & link Clang/LLVM using the gold linker?

I'm writing a custom pass for LLVM/Clang, and recompiling tends to take a while and use a lot of memory. I've heard that the gold linker (1) takes less time and (2) uses less memory than the standard ld linker. Is there a way to pass flags into the…
tonysdg
  • 1,335
  • 11
  • 32
6
votes
1 answer

Gold linker ld.gold -plugin : unknown option

I'm trying to build Google's ligjingle following the Getting started steps, and I've reached the "Building" section. When I issue either ninja -C out/Debug or ninja -C out/Release I get the following error : I posted the output in pastebin too,…
nschoe
  • 1,967
  • 1
  • 19
  • 26
5
votes
0 answers

Clang build is extremely slow and hangs up in the middle

I am getting started with writing my own clang tools. These are the steps I have followed so far: Checked out llvm 7.0 release build Checked out clang 7.0 release build Built clang and llvm using ninja with following flags (It was hanging up on me…
Tehreem
  • 939
  • 2
  • 14
  • 31
5
votes
1 answer

Building gold linker with MinGW on Windows, FLEX/bison 'YYSTYPE' was not declared in this scope

I'm trying to build the gold linker included with GNU binutils using mingw. The steps I have taken- Install mingw with all packages using the installer. Install the windows version of FLEX to the default location using the windows installer. Run…
user2380227
  • 267
  • 4
  • 14
4
votes
1 answer

Linking error: construction vtable defined in a discarded section

The original issue is spread across hundreds of thousands LoC from different projects. It contains a lot of ingredients: in-line assembly, virtual inheritance, levels of indirection, different compilers and compiler options. (It's like a thriller.)…
Cassio Neri
  • 19,583
  • 7
  • 46
  • 68
4
votes
1 answer

undefined behavior in shared lib using libpthread, but not having it in ELF as dependency

When linked "properly" (explained further), both function calls below block indefinitely on pthread calls implementing cv.notify_one and cv.wait_for: // let's call it odr.cpp, which forms libodr.so std::mutex mtx; std::condition_variable cv; bool…
aurzenligl
  • 181
  • 1
  • 7
4
votes
2 answers

Gold fails to make a relocatable object file from a static library

Let me preface this by saying that I'm a noob in things related to linkers. If something I say seems like it makes no sense, it probably doesn't - please call me out on it. I've got the following files: bar.rs #[no_mangle] pub extern fn bar(x:…
Alec
  • 31,829
  • 7
  • 67
  • 114
4
votes
1 answer

Purpose of --enable-gold when configuring gcc

When building gcc 5.1 from source, the configure script lists the following option: --enable-gold[=ARG] build gold [ARG={default,yes,no}] What does this mean? Is it telling gcc to use gold as the linker if gold is installed on the box ? If so,…
MK.
  • 3,907
  • 5
  • 34
  • 46
1
2 3 4