Build fails with LLD 10
GHC 8.6.5 and 8.8.3 (as well as master, I suspect) fails to build with LLD 10 as linker with following error:
HC [stage 1] utils/iserv/stage2_p/build/Main.p_o cc: warning: argument unused during compilation: '-pthread' [-Wunused-command-line-argument] ld: error: -r and --export-dynamic may not be used together cc: error: linker command failed with exit code 1 (use -v to see invocation) `cc' failed in phase `Linker'. (Exit code: 1)
The following patch is proposed for the fix:
--- utils/iserv/ghc.mk.orig 2020-03-23 22:25:01 UTC +++ utils/iserv/ghc.mk @@ -31,7 +31,7 @@ endif # of overhead to startup and increases the binary sizes) but if you # need it there's no alternative. ifeq "$(TargetElf)" "YES" -ifneq "$(TargetOS_CPP)" "solaris2" +ifeq "$(findstring $(TargetOS_CPP), solaris2 freebsd)" "" # The Solaris linker does not support --export-dynamic option. It also # does not need it since it exports all dynamic symbols by default utils/iserv_stage2_MORE_HC_OPTS += -optl-Wl,--export-dynamic
But I'm not sure if it is a proper fix, or a workaround.
Steps to reproduce
Get a recent FreeBSD 13-CURRENT and just run
make -C /usr/ports/lang/ghc.