Search code examples
c++linkercygwingold-linker

Does Cygwin support the Gold linker?


I'm performing a release test cycle. One of the tests for GNU Linux is integration with the Gold linker:

export LD=ld.gold
make

The makefile has the following logic to recognize the Gold linker:

# LD gold linker testing
ifeq ($(findstring ld.gold,$(LD)),ld.gold)
GOLD_OPTION = -Wl,-fuse-ld=gold
endif # Gold

Then a recipe that utilizes it:

cryptest.exe: libcryptopp.a $(TESTOBJS)
    $(CXX) -o $@ $(CXXFLAGS) $(TESTOBJS) ./libcryptopp.a $(LDFLAGS) $(GOLD_OPTION) $(LDLIBS)

However, when running against Cygwin:

g++ -o cryptest.exe -DNDEBUG -g3 -O3 -march=native -pipe bench.o bench2.o test.o \
  validat1.o validat2.o validat3.o adhoc.o datatest.o regtest.o fipsalgt.o dlltest.o \
  ./libcryptopp.a -Wl,-fuse-ld=gold
collect2: fatal error: cannot find 'ld'

I checked the Cygwin FAQ, but it does not mention Gold. However, it does call out Binutils, which Gold is a part of. And the port does not reject -fuse-ld=gold.

Does Cygwin support the Gold linker? If so, what should I be doing?


(Cygwin appears it could benefit from Gold since linking takes so long. On this test system, it takes about 15 to 20 seconds to link cryptest.exe. So this is a personal goal, too).


Solution

  • No. Per the wiki page you linked, gold is limited to the ELF format only. Windows uses the PE format.