[gcc r16-5408] Fix typo in sol2.h
Rainer Orth
ro@gcc.gnu.org
Wed Nov 19 08:19:49 GMT 2025
https://gcc.gnu.org/g:f2e3eb726be5b386c4c5738c67f0e39fec983d38
commit r16-5408-gf2e3eb726be5b386c4c5738c67f0e39fec983d38
Author: Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
Date: Wed Nov 19 09:19:10 2025 +0100
Fix typo in sol2.h
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.
Diff:
---
gcc/config/sol2.h | 2 +-
gcc/testsuite/c-c++-common/asan/pr59063-2.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/gcc/config/sol2.h b/gcc/config/sol2.h
index 15ab5d0c455c..36337dbf98d0 100644
--- a/gcc/config/sol2.h
+++ b/gcc/config/sol2.h
@@ -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
diff --git a/gcc/testsuite/c-c++-common/asan/pr59063-2.c b/gcc/testsuite/c-c++-common/asan/pr59063-2.c
index 63a547f033f2..6458ea730232 100644
--- a/gcc/testsuite/c-c++-common/asan/pr59063-2.c
+++ b/gcc/testsuite/c-c++-common/asan/pr59063-2.c
@@ -1,4 +1,4 @@
-/* { dg-do run { target { *-*-linux* *-*-freebsd* } } } */
+/* { dg-do run { target { *-*-linux* *-*-freebsd* *-*-solaris2* } } } */
/* { dg-options "-static-libasan" } */
#include <time.h>
More information about the Gcc-cvs
mailing list