ld, mold work. lld, gold don't

For discussion of ports to POSIX based systems, especially using GNUStep.

Moderators: another_commander, winston, Getafix

Post Reply
User avatar
mcarans
---- E L I T E ----
---- E L I T E ----
Posts: 710
Joined: Sun Jun 20, 2010 6:00 pm

ld, mold work. lld, gold don't

Post 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.
User avatar
mcarans
---- E L I T E ----
---- E L I T E ----
Posts: 710
Joined: Sun Jun 20, 2010 6:00 pm

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

Post 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
User avatar
Lone_Wolf
---- E L I T E ----
---- E L I T E ----
Posts: 794
Joined: Wed Aug 08, 2007 10:59 pm
Location: Netherlands

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

Post 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.
OS : Arch Linux 64-bit - rolling release

From: The Netherlands, Europe

OXPs : My user page (needs updating)

Retired, occasionally active
User avatar
mcarans
---- E L I T E ----
---- E L I T E ----
Posts: 710
Joined: Sun Jun 20, 2010 6:00 pm

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

Post 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.
Post Reply