GNU bug report logs - #34076
Patch to libtool for solaris 11.4 link-editor which rejects -pthread option

Previous Next

Package: libtool;

Reported by: "Stacey Marshall" <stacey.marshall <at> oracle.com>

Date: Mon, 14 Jan 2019 15:02:02 UTC

Severity: normal

To reply to this bug, email your comments to 34076 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-libtool <at> gnu.org:
bug#34076; Package libtool. (Mon, 14 Jan 2019 15:02:04 GMT) Full text and rfc822 format available.

Acknowledgement sent to "Stacey Marshall" <stacey.marshall <at> oracle.com>:
New bug report received and forwarded. Copy sent to bug-libtool <at> gnu.org. (Mon, 14 Jan 2019 15:02:04 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: "Stacey Marshall" <stacey.marshall <at> oracle.com>
To: bug-libtool <at> gnu.org
Subject: Patch to libtool for solaris 11.4 link-editor which rejects -pthread
 option
Date: Mon, 14 Jan 2019 14:35:44 +0000
[Message part 1 (text/plain, inline)]
Solaris 11.4 link-editor, ld(1), has been updated to reject options 
'-thread' and '-pthread'.

Details from Oracle Bug 22985199

> The GNU configuration process has been known to pass the
> options -thread and -pthread to ld(1), or to the compiler
> driver which will try and pass them to ld(1).
>
> ld(1) uses getopt(3c) processing.  The compilers take the
> options they know about and pass the others to ld(1).
>
> These options, which are specific to gcc, can result in
> silent errors:
>
> % ld -o null.so -G -thread null.o
> % elfdump -d null.so | fgrep SONAME
>     [0]  SONAME          0x5c    read
>
> The -t option is peeled off, being a valid ld(1) option,
> and the rest, '-h read' gets interpreted as an SONAME, which
> is probably not what the user expected.  If you tried to
> create an executable, you'd get an error, but it's not
> immediately obvious where the -h came from:
>
> % ld -o main -thread null.o
> ld: fatal: option '-h read' is incompatible with building \\
>     a dynamic executable
>
> With -pthread we get the same result when building a shared
> object or an executable:
>
> % ld -o null.so -G -pthread null.o
> % elfdump -d null.so | fgrep AUDIT
>      [0]  AUDIT           0x5c    thread
>
> The -p is peeled off, and its optarg used to define an auditor.
> Again, probably not what the user wanted.
>
> The Studio compilers can behave slightly differently in that
> they can affect the options passed to ld(1):  For example
>
> % cc -o null.so -G -thread null.o
>
> results in ld(1) seeing distinct options '-t -hread'.
>
> Given these are "bad" options to ld(1), it would be helpful
> to our Userland developers if ld(1) could recognize them
> rather than falling through to getopt() processing, where the
> options are mis-interpreted and "might" result in an error
> depending on the output file being produced.

Following patch prevents '-pthread' from being passed to ld on solaris2 
hosts.

    libtool should not pass option '-pthread' to Solaris link-editor.
    diff --git a/build-aux/ltmain.sh b/build-aux/ltmain.sh
    index 0f0a2da3f9..7c8bcfd9d2 100644
    --- a/build-aux/ltmain.sh
    +++ b/build-aux/ltmain.sh
    @@ -7070,7 +7070,21 @@ func_mode_link ()
    	continue
    	;;

    -      
-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
    +      # Solaris ld rejects as of 11.4.  Refer to Oracle bug 
22985199.
    +      -pthread)
    +	  case $host in
    +              *solaris2*) ;;
    +              *)
    +		  case "$new_inherited_linker_flags " in
    +                      *" $arg "*) ;;
    +                      * ) func_append new_inherited_linker_flags " 
$arg" ;;
    +		  esac
    + 		  ;;
    +	  esac
    + 	  continue
    +	  ;;
    +
    +      -mt|-mthreads|-kthread|-Kthread|-pthreads|--thread-safe \
           |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
    	func_append compiler_flags " $arg"
    	func_append compile_command " $arg"



Mr. Stacey Marshall - Principal Software Engineer - Oracle UK
Oracle Systems, SPARC & Solaris System Software Engineering.
stacey.marshall <at> oracle.com

[Message part 2 (text/html, inline)]

Information forwarded to bug-libtool <at> gnu.org:
bug#34076; Package libtool. (Fri, 08 Jan 2021 23:57:01 GMT) Full text and rfc822 format available.

Message #8 received at 34076 <at> debbugs.gnu.org (full text, mbox):

From: Ozkan Sezer <sezeroz <at> gmail.com>
To: 34076 <at> debbugs.gnu.org
Subject: Re: Patch to libtool for solaris 11.4 link-editor which rejects
 -pthread option
Date: Sat, 9 Jan 2021 02:55:59 +0300
Has this patch ever been reviewed?
Any intentions to merge in mainstream?




This bug report was last modified 4 years and 222 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.