Package: ghc
Version: 9.10.3-1
Severity: normal
X-Debbugs-Cc: [email protected]

Dear Maintainer,

On Loong64, NCG is currently not supported in 9.10, while Llvm backend
incompatible with tables-next-to-code, which will generate PLT for non-
function symbols.

Only lld can correctly link it.
Specifics can be seen: https://gitlab.haskell.org/ghc/ghc/-/issues/25531


And the 0005-* patch is also required for C files.

-- System Information:
Debian Release: forky/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: loong64 (loongarch64)

Kernel: Linux 6.6.34-9.2.loongarch64 (SMP w/32 CPU threads)
Kernel taint flags: TAINT_UNSIGNED_MODULE
Locale: LANG=C, LC_CTYPE=C.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: unable to detect

Versions of packages ghc depends on:
ii  dpkg            1.22.21
ii  gcc             4:15.2.0-4
ii  libbsd-dev      0.12.2-2
ii  libc6           2.41-12
ii  libc6-dev       2.41-12
ii  libffi-dev      3.5.2-2
ii  libffi8         3.5.2-2
ii  libgmp-dev      2:6.3.0+dfsg-5
ii  libgmp10        2:6.3.0+dfsg-5
ii  libncurses-dev  6.5+20250216-2
ii  libnuma-dev     2.0.19-1
ii  libnuma1        2.0.19-1
ii  libtinfo6       6.5+20250216-2
ii  llvm-18         1:18.1.8-18+b2

Versions of packages ghc recommends:
ii  libstdc++-14-dev  14.3.0-8

Versions of packages ghc suggests:
pn  ghc-doc   <none>
pn  ghc-prof  <none>
ii  perl      5.40.1-6

-- no debconf information
diff --git a/debian/control b/debian/control
index 77953ea..7156175 100644
--- a/debian/control
+++ b/debian/control
@@ -19,6 +19,8 @@ Build-Depends:
   hadrian:native (<< 9.10.4~) <!pkg.ghc.nohadrian>,
   llvm-21 (>= 1:21.1.6) [armel armhf s390x riscv64 loong64],
   clang-21 [armel armhf s390x riscv64 loong64],
+  lld-21 [loong64],
+  lld [loong64],
   libgmp-dev,
   libffi-dev,
   libncurses-dev,
diff --git a/debian/patches/series b/debian/patches/series
index 6ee5568..6c5d885 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -16,7 +16,7 @@ time_t-time
 llvm-newer-version
 alpha-fix-ieee_set_fp_control-invocation.patch
 # 0004-llvmGen-Pass-mcmodel-medium-option-to-LLVM-backend-on-LoongArch.patch
-# 0005-Pass-the-mcmodel-medium-parameter-to-CC-via-GHC.patch
+0005-Pass-the-mcmodel-medium-parameter-to-CC-via-GHC.patch
 hadrian-bootstrap-plan
 hadrian-unreg-template-haskell
 gnu-hurd
diff --git a/debian/rules b/debian/rules
index 5f69aae..cc83476 100755
--- a/debian/rules
+++ b/debian/rules
@@ -106,9 +106,10 @@ ifneq (,$(filter noopt, $(DEB_BUILD_OPTIONS)))
 endif
 
 ifneq (,$(filter loong64, $(DEB_HOST_ARCH)))
-  EXTRA_HADRIAN_FLAGS += "*.*.ghc.c.opts += -optc-mcmodel=medium"
-  EXTRA_HADRIAN_FLAGS += "*.*.ghc.hs.opts += -optc-mcmodel=medium"
-  EXTRA_HADRIAN_FLAGS += "*.*.cc.c.opts += -optc-mcmodel=medium"
+# See https://gitlab.haskell.org/ghc/ghc/-/issues/25531
+# Llvm backend is not compatible with PLT, ld will generate wrong relocs.
+  EXTRA_CONFIGURE_FLAGS += --enable-ld-override
+  EXTRA_INSTALL_CONFIGURE_FLAGS += --enable-ld-override
 endif
 
 ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))

Reply via email to