Page 1 of 1

ld, mold work. lld, gold don't

Posted: Sat Dec 27, 2025 2:46 am
by mcarans
I have tested various linkers. The Flatpak runtime default linker is gold - it doesn't link with the Oolite deployment build.

lld 20 and 21 both cause a segmentation fault when the game starts. I have created an issue with the LLVM Project and with libobjc2 in case the problem somehow is there which seems unlikely.

ld (bfd) the standard linker works in all cases including flatpak. I also tested mold and it works on Ubuntu and flatpak.

Re: ld, mold work. lld, gold don't

Posted: Sun Dec 28, 2025 11:07 pm
by mcarans
I learnt something new. You can make a reproducible tar to recreate problems with linkers.

To do this in GNUmakefile set:

Code: Select all

    ADDITIONAL_LDFLAGS           = -fuse-ld=lld  
    ADDITIONAL_LDFLAGS           += -Wl,--reproduce=/tmp/rep.tar
Comment these link time optimisation lines in that file:

Code: Select all

    ifeq ($(lto),yes)
        ADDITIONAL_CFLAGS        += -flto
        ADDITIONAL_OBJCFLAGS     += -flto
        ADDITIONAL_CCFLAGS       += -flto
        ADDITIONAL_LDFLAGS       += -flto
    endif
Run make -f Makefile release-deployment then unpack the /tmp/rep.tar file produced.

Copy the Resources folder from an existing oolite.app to the unpacked rep.tar folder.

Then you can do ld.lld @response.txt to produce the oolite executable.

You can test different linkers eg. mold @response.txt or ld.bfd @response.txt for the gcc linker.

I've created a reproduce tar for the issue I raised with LLVM project: https://github.com/llvm/llvm-project/is ... 3695092366

Re: ld, mold work. lld, gold don't

Posted: Mon Dec 29, 2025 2:02 pm
by Lone_Wolf
binutils 2.44 release notes wrote:
Perhaps the most significant change is the absence of the "gold" linker, which is deprecated and about to disappear entirely. Gold appeared in 2008 with some fanfare as a faster linker, but it has suffered from a lack of maintenance in recent years.
see https://lwn.net/Articles/1007541/

Don't bother with gold linker.

Re: ld, mold work. lld, gold don't

Posted: Tue Dec 30, 2025 3:54 am
by mcarans
Lone_Wolf wrote: Mon Dec 29, 2025 2:02 pm
binutils 2.44 release notes wrote:
Perhaps the most significant change is the absence of the "gold" linker, which is deprecated and about to disappear entirely. Gold appeared in 2008 with some fanfare as a faster linker, but it has suffered from a lack of maintenance in recent years.
see https://lwn.net/Articles/1007541/

Don't bother with gold linker.
I wouldn't have bothered with gold, but surprisingly, it is still the standard linker in the flatpak runtime which prompted this investigation.