Linker broken on M2 Mac in ghc-9.8.1-rc1 for me: ld: unknown options: --gc-sections
Summary
ghc hello.hs\
\[1 of 2\] Compiling Main ( hello.hs, hello.o )\
\[2 of 2\] Linking hello\
ld: unknown options: --gc-sections\
clang: error: linker command failed with exit code 1 (use -v to see invocation)\
ghc-9.8.0.20230929: \`gcc' failed in phase \`Linker'. (Exit code: 1)
\\>cat hello.hs
`main = putStrLn "Hello, world!"`
This is the same issue as #21570 (closed) (closed)
Steps to reproduce
see above
What do you expect the reproducer described above to do?
I expect it to compile without errors.
Environment
- GHC version used: ghc-9.8.0.20230929 (ghc 9.8.1-rc1)
Optional:
- Operating System: MacOS Sonoma
- System Architecture: arm
./configure
reported
checking for -ld.lld... no\
checking for ld.lld... ld.lld\
checking whether C compiler supports -fuse-ld=lld... yes
\\>echo $PATH\
/Users/avie/.cabal/bin:/usr/<wbr>local/opt/llvm/bin:/usr/local/<wbr>bin:/usr/local/sbin:/usr/<wbr>local/bin:/System/Cryptexes/<wbr>App/usr/bin:/usr/bin:/bin:/<wbr>usr/sbin:/sbin:/var/run/com.<wbr>apple.security.cryptexd/codex.<wbr>system/bootstrap/usr/local/<wbr>bin:/var/run/com.apple.<wbr>security.cryptexd/codex.<wbr>system/bootstrap/usr/bin:/var/<wbr>run/com.apple.security.<wbr>cryptexd/codex.system/<wbr>bootstrap/usr/appleinternal/<wbr>bin:/usr/bin:/bin:/usr/sbin:/<wbr>sbin:/usr/texbin:/Library/TeX/<wbr>texbin
\\> ghc --info
ghc --info\
\[("Project name","The Glorious Glasgow Haskell Compilation System")\
,("C compiler command","gcc")\
,("C compiler flags","--target=arm64-apple-<wbr>darwin -Qunused-arguments")\
,("C++ compiler command","g++")\
,("C++ compiler flags","--target=arm64-apple-<wbr>darwin ")\
,("C compiler link flags","-Wl,-no_fixup_chains")\
,("C compiler supports -no-pie","NO")\
,("Haskell CPP command","gcc")\
,("Haskell CPP flags","-E -undef -traditional -Wno-invalid-pp-token -Wno-unicode -Wno-trigraphs")\
,("ld command","ld.lld")\
,("ld flags","")\
,("ld supports compact unwind","NO")\
,("ld supports filelist","NO")\
,("ld supports response files","NO")\
,("ld is GNU ld","YES")\
,("Merge objects command","ld.lld")\
,("Merge objects flags","-r")\
,("ar command","ar")\
,("ar flags","qcls")\
,("ar supports at file","NO")\
,("ar supports -L","NO")\
,("ranlib command","ranlib")\
,("otool command","otool")\
,("install_name_tool command","install_name_tool")\
,("touch command","touch")\
,("dllwrap command","/bin/false")\
,("windres command","/bin/false")\
,("unlit command","/usr/local/lib/ghc-<wbr>9\.8.0.20230929/lib/bin/unlit")\
,("cross compiling","NO")\
,("target platform string","aarch64-apple-darwin"<wbr>)\
,("target os","OSDarwin")\
,("target arch","ArchAArch64")\
,("target word size","8")\
,("target word big endian","NO")\
,("target has GNU nonexec stack","NO")\
,("target has .ident directive","YES")\
,("target has subsections via symbols","NO")\
,("target has libm","YES")\
,("Unregisterised","NO")\
,("LLVM target","arm64-apple-darwin")\
,("LLVM llc command","llc")\
,("LLVM opt command","opt")\
,("LLVM clang command","clang")\
,("Use inplace MinGW toolchain","NO")\
,("Use interpreter","YES")\
,("Support SMP","YES")\
,("RTS ways","debug thr thr_debug thr_p dyn debug_dyn thr_dyn thr_debug_dyn thr_debug_p debug_p")\
,("Tables next to code","YES")\
,("Leading underscore","YES")\
,("Use LibFFI","YES")\
,("RTS expects libdw","NO")\
,("Project version","9.8.0.20230929")\
,("Project Git commit id","<wbr>86c1bdc48a6d4bc059c3fffb5c27d4<wbr>fd69fc81bc")\
,("Project Version Int","908")\
,("Project Patch Level","020230929")\
,("Project Patch Level1","0")\
,("Project Patch Level2","20230929")\
,("Project Unit Id","ghc-9.8.0.20230929-66a6")\
,("Booter version","9.4.4")\
,("Stage","2")\
,("Build platform","aarch64-apple-<wbr>darwin")\
,("Host platform","aarch64-apple-<wbr>darwin")\
,("Target platform","aarch64-apple-<wbr>darwin")\
,("Have interpreter","YES")\
,("Object splitting supported","NO")\
,("Have native code generator","YES")\
,("target has RTS linker","YES")\
,("Target default backend","native code generator")\
,("Support dynamic-too","YES")\
,("Support parallel --make","YES")\
,("Support reexported-modules","YES")\
,("Support thinning and renaming package flags","YES")\
,("Support Backpack","YES")\
,("Requires unified installed package IDs","YES")\
,("Uses package keys","YES")\
,("Uses unit IDs","YES")\
,("GHC Dynamic","YES")\
,("GHC Profiled","NO")\
,("Debug on","NO")\
,("LibDir","/usr/local/lib/<wbr>ghc-9.8.0.20230929/lib")\
,("Global Package DB","/usr/local/lib/ghc-9.8.0.<wbr>20230929/lib/package.conf.d")\
\]
Edited by Ben Gamari