]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Fix typo in sol2.h
authorRainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
Wed, 19 Nov 2025 08:19:10 +0000 (09:19 +0100)
committerRainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
Wed, 19 Nov 2025 08:19:10 +0000 (09:19 +0100)
I noticed that gcc/config/sol2.h uses USE_GNU_LD as a guard in one
place only.  This is a cross of USE_GLD and HAVE_GNU_LD which doesn't
exist so the gld variant is never used.

This went unnoticed since the wrong versions of LD_WHOLE_ARCHIVE_OPTION
and LD_NO_WHOLE_ARCHIVE_OPTION are only ever used in LIBASAN_EARLY_SPEC
and only effective when -static-libasan is used.  gld would only warn
about the unsupported -z options here.

The issue wasn't noticed before since the only testcase using
-static-libasan isn't run on Solaris, which this patch also corrects.

Bootstrapped without regressions on i386-pc-solaris2.11 and
sparc-sun-solaris2.11 (both as/ld and gas/gld).

2025-11-18  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

gcc:
* config/sol2.h: Check USE_GLD instead of USE_GNU_LD.

gcc/testsuite:
* c-c++-common/asan/pr59063-2.c: Enable on Solaris.

gcc/config/sol2.h
gcc/testsuite/c-c++-common/asan/pr59063-2.c

index 15ab5d0c455ce03e6ef4dcdd803d922fa8c7d2d8..36337dbf98d0753984060b207876ed720d740e91 100644 (file)
@@ -224,7 +224,7 @@ along with GCC; see the file COPYING3.  If not see
    in that case, and for executable link with --{,no-}whole-archive around
    it to force everything into the executable.  */
 
-#ifndef USE_GNU_LD
+#ifndef USE_GLD
 #define LD_WHOLE_ARCHIVE_OPTION "-z allextract"
 #define LD_NO_WHOLE_ARCHIVE_OPTION "-z defaultextract"
 #else
index 63a547f033f255204452d5f49c91e4a3d5b33068..6458ea7302322a0c4568fde4f63d42f79d2abe9e 100644 (file)
@@ -1,4 +1,4 @@
-/* { dg-do run { target { *-*-linux* *-*-freebsd* } } } */
+/* { dg-do run { target { *-*-linux* *-*-freebsd* *-*-solaris2* } } } */
 /* { dg-options "-static-libasan" } */
 
 #include <time.h>