On 1/11/26 16:23, Rainer Orth wrote:
Hi Sandra,
thanks for doing this.
gcc/ChangeLog
PR other/122243
* doc/invoke.texi (Option Summary) <Solaris 2 Options>:
Remove redundant negative option forms from list.
(Solaris 2 Options): Index and list the negative forms here.
Combine the two @table environments.
This is ok with one exception:
@opindex pthreads
@item -pthreads
-This is a synonym for @option{-pthread}.
+This is a synonym for the linker option @option{-pthread}.
@end table
This is wrong: -pthreads isn't a linker option at all on Solaris.
Instead it causes two macros to be defined:
gcc/config/sol2.h:
%{pthreads|pthread:-D_REENTRANT -D_PTHREADS}"
Even those are no longer necessary: various man pages state,
e.g. tmpnam(3c):
Solaris 11.4.0 also removed the requirement to define _REENTRANT
before including the header to expose the tempnam_r definition.
In fact, they are no longer referenced in any system header.
The only possible caveat might be that user code uses either of them for
their own purposes.
Only on Linux and the BSDs does it cause linking with -lpthread, which
is unnecessary on Solaris since libpthread has been folded into libc.
Thanks for the corrections. I've pushed the revised version of the
patch, attached.
-Sandra
From b91f2cc0f7c8f295f94704011fb9c8596ed867db Mon Sep 17 00:00:00 2001
From: Sandra Loosemore <[email protected]>
Date: Sun, 4 Jan 2026 23:03:46 +0000
Subject: [PATCH 06/16] doc, Solaris: Clean up documentation of Solaris 2
options [PR122243]
gcc/ChangeLog
PR other/122243
* doc/invoke.texi (Option Summary) <Solaris 2 Options>:
Remove redundant negative option forms from list. List both
-pthread and -pthreads.
(Solaris 2 Options): Index and list the negative forms here.
Combine the two @table environments. Document both -pthread
and -pthreads.
---
gcc/doc/invoke.texi | 25 ++++++++++++++++---------
1 file changed, 16 insertions(+), 9 deletions(-)
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 613b36b0f43..0bdabf34517 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -1449,7 +1449,7 @@ See RS/6000 and PowerPC Options.
@emph{Solaris 2 Options} (@ref{Solaris 2 Options})
@gccoptlist{-mclear-hwcap -mno-clear-hwcap -mimpure-text -mno-impure-text
--gsctf -pthreads}
+-gsctf -pthread -pthreads}
@emph{SPARC Options} (@ref{SPARC Options})
@gccoptlist{-mcpu=@var{cpu-type}
@@ -34795,18 +34795,22 @@ allocator is used.
@subsection Solaris 2 Options
@cindex Solaris 2 options
-These @samp{-m} options are supported on Solaris 2:
+These options are supported on Solaris 2:
@table @gcctabopt
@opindex mclear-hwcap
+@opindex mno-clear-hwcap
@item -mclear-hwcap
+@itemx -mno-clear-hwcap
@option{-mclear-hwcap} tells the compiler to remove the hardware
capabilities generated by the Solaris assembler. This is only necessary
when object files use ISA extensions not supported by the current
machine, but check at runtime whether or not to use them.
@opindex mimpure-text
+@opindex mno-impure-text
@item -mimpure-text
+@itemx -mno-impure-text
@option{-mimpure-text}, used in addition to @option{-shared}, tells
the compiler to not pass @option{-z text} to the linker when linking a
shared object. Using this option, you can link position-dependent
@@ -34819,20 +34823,23 @@ shared object is not actually shared across processes. Instead of
using @option{-mimpure-text}, you should compile all source code with
@option{-fpic} or @option{-fPIC}.
-@end table
-
-These switches are supported in addition to the above on Solaris 2:
-
-@table @gcctabopt
@opindex gsctf
@item -gsctf
Generate Solaris CTF. Needs to be used both for compilation and
linking. See @command{ctf(7)} for more information. This is only
supported since Solaris 11.4 SRU 84 where the necessary toolchain
support was added.
+
+@opindex pthread
@opindex pthreads
-@item -pthreads
-This is a synonym for @option{-pthread}.
+@item -pthread
+@itemx -pthreads
+On Solaris targets, these both options define the preprocessor symbols
+@code{_REENTRANT} and @code{_PTHREADS}. In modern versions of Solaris
+these symbols are no longer used in system headers and these options are
+unnecessary unless user code references them. Additionally, since
+POSIX thread support is provided directly by the Solaris C library, it is
+not necessary to use @option{-pthread} for linking.
@end table
@node SPARC Options
--
2.39.5