Source: ghc
Version: 9.4.7-5
Severity: important
Tags: patch
User: debian-powe...@lists.debian.org
Usertags: powerpc
X-Debbugs-Cc: debian-powe...@lists.debian.org

Hi,

after debugging the segmentation faults with the unregisterised GHC on powerpc
for a long time, I finally found the culprit which is the fact that GHC is built
to default to the gold linker by default.

The gold linker is known to be broken on some architectures which is unlikely to
change in the future as the project has been abandoned by Google [1], so it has
been long disabled for several architectures in debian/rules by passing the flag
--disable-ld-override in EXTRA_CONFIGURE_FLAGS.

However, as I learnt today, this only affects the linker choice when building 
GHC
but not the default linker for the actual binary packages which still defaulted
to gold in /usr/lib/ghc/lib/settings.

As one of the upstream developers explained to me today [2], it's necessary to
pass --disable-ld-override in EXTRA_INSTALL_CONFIGURE_FLAGS as well in order to
disable gold for the binary distribution, i.e. what will end up in the Debian
package.

Thus, please modify debian/rules to also include the flag --disable-ld-override
in EXTRA_INSTALL_CONFIGURE_FLAGS:

--- debian/rules.orig   2024-06-13 11:01:23.450199875 -0700
+++ debian/rules        2024-06-13 11:01:26.318242288 -0700
@@ -76,6 +76,7 @@
 # See also https://bugs.debian.org/1056636
 ifneq (,$(filter mips mipsel powerpc powerpcspe sparc64, $(DEB_HOST_ARCH)))
   EXTRA_CONFIGURE_FLAGS += --disable-ld-override
+  EXTRA_INSTALL_CONFIGURE_FLAGS += --disable-ld-override
 endif
 
 ifneq (,$(filter armhf, $(DEB_HOST_ARCH)))

Also attaching a patch.

Thanks,
Adrian

> [1] https://en.wikipedia.org/wiki/Gold_(linker)
> [2] https://gitlab.haskell.org/ghc/ghc/-/issues/24986#note_570504

--
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer
`. `'   Physicist
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913
--- debian/rules.orig   2024-06-13 11:01:23.450199875 -0700
+++ debian/rules        2024-06-13 11:01:26.318242288 -0700
@@ -76,6 +76,7 @@
 # See also https://bugs.debian.org/1056636
 ifneq (,$(filter mips mipsel powerpc powerpcspe sparc64, $(DEB_HOST_ARCH)))
   EXTRA_CONFIGURE_FLAGS += --disable-ld-override
+  EXTRA_INSTALL_CONFIGURE_FLAGS += --disable-ld-override
 endif
 
 ifneq (,$(filter armhf, $(DEB_HOST_ARCH)))

Reply via email to