[Git][ghc/ghc][master] configure: Use LDFLAGS when trying linkers

Marge Bot (@marge-bot) gitlab at gitlab.haskell.org
Wed Mar 27 01:16:38 UTC 2024



Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC


Commits:
32a8103f by Rodrigo Mesquita at 2024-03-26T21:16:12-04:00
configure: Use LDFLAGS when trying linkers

A user may configure `LDFLAGS` but not `LD`. When choosing a linker, we
will prefer `ldd`, then `ld.gold`, then `ld.bfd` -- however, we have to
check for a working linker. If either of these fail, we try the next in
line.

However, we were not considering the `$LDFLAGS` when checking if these
linkers worked. So we would pick a linker that does not support the
current $LDFLAGS and fail further down the line when we used that linker
with those flags.

Fixes #24565, where `LDFLAGS=-Wl,-z,pack-relative-relocs` is not
supported by `ld.gold` but that was being picked still.

- - - - -


1 changed file:

- m4/fp_cc_linker_flag_try.m4


Changes:

=====================================
m4/fp_cc_linker_flag_try.m4
=====================================
@@ -9,7 +9,7 @@
 AC_DEFUN([FP_CC_LINKER_FLAG_TRY], [
     AC_MSG_CHECKING([whether C compiler supports -fuse-ld=$1])
     echo 'int main(void) {return 0;}' > conftest.c
-    if $CC -o conftest.o -fuse-ld=$1 conftest.c > /dev/null 2>&1
+    if $CC -o conftest.o -fuse-ld=$1 $LDFLAGS conftest.c > /dev/null 2>&1
     then
         $2="-fuse-ld=$1"
         AC_MSG_RESULT([yes])



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/32a8103f3b3e22907fdd67b69c919c5251d8cc20

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/32a8103f3b3e22907fdd67b69c919c5251d8cc20
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20240326/c4973194/attachment.html>


More information about the ghc-commits mailing list