trylink: include LDFLAGS when checking linkage
authorMike Frysinger <vapier@gentoo.org>
Tue, 1 Dec 2015 16:25:10 +0000 (11:25 -0500)
committerMike Frysinger <vapier@gentoo.org>
Tue, 1 Dec 2015 16:25:10 +0000 (11:25 -0500)
The user might be including options in their LDFLAGS (like -fuse-ld=gold)
that change the behavior of the linker and thus change the results of the
flag tests.  Make sure we include the user's LDFLAGS when running these
tests so we filter out flags that will fail when used later on.

URL: https://bugs.gentoo.org/499712
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
scripts/trylink

index 6e1187ed091e54c90cf274f5ca92c8141d240345..3c431edc36b9da4fa755292c6698afbd09a7748d 100755 (executable)
@@ -54,7 +54,7 @@ check_cc() {
     # "eval" may be needed if CFLAGS can contain
     # '... -D"BB_VER=KBUILD_STR(1.N.M)" ...'
     # and we need shell to process quotes!
-    $CC $CFLAGS $1 "$tempname".c -o "$tempname" >/dev/null 2>&1
+    $CC $CFLAGS $LDFLAGS $1 "$tempname".c -o "$tempname" >/dev/null 2>&1
     r=$?
     rm -f "$tempname" "$tempname".c "$tempname".o
     return $r