[06/14] doc, Solaris: Clean up documentation of Solaris 2 options [PR122243]

Message ID 20260108193836.2203905-7-sloosemore@baylibre.com
State New
Headers
Series Clean up documentation of target-specific options, part N |

Commit Message

Sandra Loosemore Jan. 8, 2026, 7:38 p.m. UTC
  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.
---
 gcc/doc/invoke.texi | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
  

Comments

Rainer Orth Jan. 11, 2026, 11:23 p.m. UTC | #1
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.

	Rainer
  
Sandra Loosemore Jan. 17, 2026, 8:56 p.m. UTC | #2
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
  

Patch

diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index f85374ad93b..3f78615b96d 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -34762,18 +34762,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
@@ -34786,20 +34790,16 @@  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 pthreads
 @item -pthreads
-This is a synonym for @option{-pthread}.
+This is a synonym for the linker option @option{-pthread}.
 @end table
 
 @node SPARC Options