Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CONFIGURE: Don't use the Gold linker on i386/ppc (unless using --enable-gold) #6285

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dwatteau
Copy link
Contributor

@dwatteau dwatteau commented Dec 3, 2024

Debian and Fedora have been building their official ScummVM packages with --disable-gold for a while, because of build failures on (at least) i386: [1], [2].

I saw a similar issue with Gold and the ppc32 QEMU VM myself (internal error in relocate, at ../../gold/powerpc.cc:6773 when doing a full build with all engines), and both Gentoo and Fedora think of Gold as a deprecated linker nowadays, anyway: [1], [2], [3].

So this PR disables the Gold linker on i386 and ppc. People really wanting to use it there can still use it with an explicit --enable-gold.

Alternative linkers exist (mold, lld...) and are already supported, and otherwise ld.bfd often is a safe default (and AFAICS it's not as slow at it used to be).

Any objection to this? The idea is to take care, by default, of the build issues that Fedora and Debian have been having with Gold. It looks like (at least) the master-debian-i686 buildbot will be impacted by this change. (By the way, since it appears that this buildbot target never had an issue wild Gold, maybe we could disable its usage for older Gold releases only. But I can't say where to draw the line. Fedora/Debian hit the bug in 2020/2021, and Gold didn't receive many commits since then.)

EDIT: the issue was also present in early 2021 Slackware: [1]

…le-gold

Debian and Fedora have been building their official ScummVM packages with
--disable-gold for a while, because of build failures on (at least) i386:

https://salsa.debian.org/games-team/scummvm/-/commit/a6afd58cf8cb8bb39ee1b1fd764ff1721b1001f4
https://src.fedoraproject.org/rpms/scummvm/c/e737fe0c41f2c9cff8400defaab10908b553db18?branch=rawhide

I saw a similar issue on Linux ppc32 myself (linker internal error when
doing a full build with all engines), and both Gentoo and Fedora think of
Gold as a deprecated linker nowadays, anyway.

Alternative linkers exist (mold, lld...), and ld.bfd often is a safe
default (and AFAICS it's not as slow at it used to be).

People really wanting to use Gold on i386/ppc can still ask for it with
--enable-gold.
@bluegr
Copy link
Member

bluegr commented Dec 3, 2024

Thanks! Both Debian and Fedora use bfd instead of gold, but we opt for mold instead. Perhaps we should also use bfd as well, when disabling gold in these cases? Or just simply replace gold with bfd altogether?

@lephilousophe
Copy link
Member

Mold is not a linker installed everywhere, bfd is a good default.

@dwatteau
Copy link
Contributor Author

dwatteau commented Dec 3, 2024

Thanks! Both Debian and Fedora use bfd instead of gold, but we opt for mold instead. Perhaps we should also use bfd as well, when disabling gold in these cases? Or just simply replace gold with bfd altogether?

Yes, bfd often already is the default ld binary on ELF systems.

@bluegr
Copy link
Member

bluegr commented Dec 3, 2024

Thanks! Both Debian and Fedora use bfd instead of gold, but we opt for mold instead. Perhaps we should also use bfd as well, when disabling gold in these cases? Or just simply replace gold with bfd altogether?

Yes, bfd often already is the default ld binary on ELF systems.

Yeah, but for some reason, they've hardcoded bfd in the Fedora patch. We could assume that bfd is always available on Fedora, but if this is true, why would they hardcode it in their patch?

Here's the Fedora patch, for reference:

+# used bdf linker on x86 as FTBFS workaround            
+if test "$_have_x86" = yes ; then            
+    set_var LDFLAGS "-fuse-ld=bfd"            
+fi

@dwatteau
Copy link
Contributor Author

dwatteau commented Dec 3, 2024

Yeah, but for some reason, they've hardcoded bfd in the Fedora patch. We could assume that bfd is always available on Fedora, but if this is true, why would they hardcode it in their patch?

Here's the Fedora patch, for reference:

+# used bdf linker on x86 as FTBFS workaround            
+if test "$_have_x86" = yes ; then            
+    set_var LDFLAGS "-fuse-ld=bfd"            
+fi

Yes, as discussed on Discord, I thought that they did that just because, in their case, such a big override was always guaranteed to work (instead of analyzing what we're doing with the _gold variable in the configure script, and so on).

We can't just hardcode -fuse-ld=bfd as they do, because the linker on macOS isn't bfd for example.

I'll put the PR on hold until I'm done with some tests on Fedora, to be sure. Maybe they did set up gold as the default ld in some releases, and then yes, this diff would have to be done differently.

@dwatteau dwatteau marked this pull request as draft December 3, 2024 19:18
@lephilousophe
Copy link
Member

The patch was added by Fedora in 2020.
The last movements about Gold for Fedora are circa 2010 (https://fedoraproject.org/wiki/Features/GoldLinkerDefault).
So I would say this is quite safe although I am not even sure the bug is still around.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants