Bug#1125455: ghc: enable ld override for loong64

fanpeng fanpeng at loongson.cn
Tue Feb 10 03:04:41 GMT 2026


On Tue, 10 Feb 2026 10:34:34 +0800 fanpeng wrote:

Re-generate the 0004-* patch based on the latest code.


 > Yes, It‘s also possible to use only the parameters in 
EXTRA_HADRIAN_FLAGS.
 >
 > In addition, I notice that the content of this patch 0004-* patch will
 > conflict, but this modification for Loong64 is necessary if the LLvm
 > backend is used.
 >
 >
 > diff --git a/compiler/GHC/CmmToLlvm.hs b/compiler/GHC/CmmToLlvm.hs
 > index de5d84c..ac52827 100644
 > --- a/compiler/GHC/CmmToLlvm.hs
 > +++ b/compiler/GHC/CmmToLlvm.hs
 > @@ -219,7 +219,13 @@ cmmMetaLlvmPrelude = do
 >              ArchX86_64 | llvmCgAvxEnabled cfg -> 
[mkStackAlignmentMeta 32]
 >              _                                 -> []
 >    module_flags_metas <- mkModuleFlagsMeta stack_alignment_metas
 > -  let metas = tbaa_metas ++ module_flags_metas
 > +  let code_model_metas =
 > +          case platformArch platform of
 > +            -- FIXME: We should not rely on LLVM
 > +            ArchLoongArch64 -> [mkCodeModelMeta CMMedium]
 > +            _                                 -> []
 > +  mcmodel_flags_metas <- mkModuleFlagsMeta code_model_metas
 > +  let metas = tbaa_metas ++ module_flags_metas ++ mcmodel_flags_metas
 >    cfg <- getConfig
 >    renderLlvm (ppLlvmMetas cfg metas)
 >               (ppLlvmMetas cfg metas)
 > @@ -241,6 +247,15 @@ mkStackAlignmentMeta :: Integer -> ModuleFlag
 >  mkStackAlignmentMeta alignment =
 >      ModuleFlag MFBError "override-stack-alignment" (MetaLit $ LMIntLit
 > alignment i32)
 >
 > +-- LLVM's @LLVM::CodeModel::Model@ enumeration
 > +data CodeModel = CMMedium
 > +
 > +-- Pass -mcmodel=medium option to LLVM on LoongArch64
 > +mkCodeModelMeta :: CodeModel -> ModuleFlag
 > +mkCodeModelMeta codemodel =
 > +    ModuleFlag MFBError "Code Model" (MetaLit $ LMIntLit n i32)
 > +  where
 > +    n = case codemodel of CMMedium -> 3 -- as of LLVM 8
 >
 >  --
 > 
-----------------------------------------------------------------------------
 >  -- | Marks variables as used where necessary
 >
 >
 > On Sun, 25 Jan 2026 09:53:36 +0100 John Paul Adrian Glaubitz wrote:
 >
 > > Hi fanpeng,
 > >
 > > On Wed, 2026-01-14 at 06:32 +0000, fanpeng wrote:
 > > > And the 0005-* patch is also required for C files.
 > >
 > > Did you forget this particular patch? I'm not seeing it here.
 > >
 > > Why not just keep the parameters in EXTRA_HADRIAN_FLAGS?
 > >
 > > Adrian
 > >
 > >

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-haskell-maintainers/attachments/20260210/de4d713c/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0004-llvmGen-Pass-mcmodel-medium-option-to-LLVM-backend-on-LoongArch.patch
Type: text/x-patch
Size: 1800 bytes
Desc: not available
URL: <http://alioth-lists.debian.net/pipermail/pkg-haskell-maintainers/attachments/20260210/de4d713c/attachment.bin>


More information about the Pkg-haskell-maintainers mailing list