From unknown Mon Aug 18 11:11:21 2025 X-Loop: help-debbugs@gnu.org Subject: bug#34076: Patch to libtool for solaris 11.4 link-editor which rejects -pthread option Resent-From: "Stacey Marshall" Original-Sender: "Debbugs-submit" Resent-CC: bug-libtool@gnu.org Resent-Date: Mon, 14 Jan 2019 15:02:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 34076 X-GNU-PR-Package: libtool X-GNU-PR-Keywords: To: 34076@debbugs.gnu.org X-Debbugs-Original-To: bug-libtool@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.154747809924404 (code B ref -1); Mon, 14 Jan 2019 15:02:02 +0000 Received: (at submit) by debbugs.gnu.org; 14 Jan 2019 15:01:39 +0000 Received: from localhost ([127.0.0.1]:59197 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gj3kA-0006LX-4W for submit@debbugs.gnu.org; Mon, 14 Jan 2019 10:01:39 -0500 Received: from eggs.gnu.org ([209.51.188.92]:47124) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gj3LM-0005W6-Vu for submit@debbugs.gnu.org; Mon, 14 Jan 2019 09:36:02 -0500 Received: from lists.gnu.org ([209.51.188.17]:37832) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gj3LH-0006iF-OB for submit@debbugs.gnu.org; Mon, 14 Jan 2019 09:35:55 -0500 Received: from eggs.gnu.org ([209.51.188.92]:57313) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gj3LG-0001X9-Aw for bug-libtool@gnu.org; Mon, 14 Jan 2019 09:35:55 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_50,HTML_MESSAGE, RCVD_IN_DNSWL_MED autolearn=disabled version=3.3.2 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gj3LF-0006ek-0H for bug-libtool@gnu.org; Mon, 14 Jan 2019 09:35:54 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:52906) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gj3LE-0006WN-Mx for bug-libtool@gnu.org; Mon, 14 Jan 2019 09:35:52 -0500 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id x0EEYHQm115982 for ; Mon, 14 Jan 2019 14:35:49 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : mime-version : content-type; s=corp-2018-07-02; bh=jHiFUH9Hih6IhAYUJ59epRYBzn/4oM0TG3815rY2yiU=; b=dyR3m0pI5xLZkEKSZaJ5pq+oL8NadhcWSDtMA5v+kUBlKV5afQKnuAG+MAIsplVQ+qkx D3+FGyPEnf1IZVs8hYy44+i8uHYnpYqa6nvbKkuMF3NoQa3UvNGx7AdBY3PdrAly79qf uzYV1NZOhv0Yto8bce+vpY5LYtVvOadBX/yKJP1JD79yPSgPpNXO8ygE3J97p9UYgVvH uVuigIx5KrCeouI1EW9/0rB1IoBbIgSAHW5uQcXOh2bIti4a2anPxq3S+EzeazjyPN3j wCwn4j+7AXUU+6IFsccFlAY50h8mUWCWUoD2lyMpwPoiiTkxKQ2oJM5OnzG61BQurMA8 Gg== Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by userp2120.oracle.com with ESMTP id 2pybjrwssh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 14 Jan 2019 14:35:48 +0000 Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id x0EEZlkw010040 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 14 Jan 2019 14:35:48 GMT Received: from abhmp0004.oracle.com (abhmp0004.oracle.com [141.146.116.10]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x0EEZlt1028347 for ; Mon, 14 Jan 2019 14:35:47 GMT Received: from [10.175.168.173] (/10.175.168.173) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 14 Jan 2019 06:35:46 -0800 From: "Stacey Marshall" Date: Mon, 14 Jan 2019 14:35:44 +0000 X-Mailer: MailMate (1.12.3r5579) Message-ID: <9BCD209C-EB5D-4E1D-B8F9-0A20D8991D79@oracle.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="=_MailMate_436AD6D0-D11D-4D3E-ADEE-414BE32F2109_=" X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9135 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=1 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1901140121 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 156.151.31.85 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Spam-Score: 1.0 (+) X-Mailman-Approved-At: Mon, 14 Jan 2019 10:01:36 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) --=_MailMate_436AD6D0-D11D-4D3E-ADEE-414BE32F2109_= Content-Type: text/plain; format=flowed; markup=markdown 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@oracle.com --=_MailMate_436AD6D0-D11D-4D3E-ADEE-414BE32F2109_= Content-Type: text/html Content-Transfer-Encoding: quoted-printable

Solaris 11.4 link-editor, ld(1), has been updated to reje= ct options '-thread' and '-pthread'.

Details from Oracle Bug 22985199

The GNU configuration process has been known to pass the<= br> 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,<= br> 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 shar= ed
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 au= ditor.
Again, probably not what the user wanted.

The Studio compilers can behave slightly differently in t= hat
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 helpf= ul
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-edit=
or.
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=3D*)
    func_append compiler_flags " $arg"
    func_append compile_command " $arg"

Mr. Stacey Marshall - Principal Software Engineer - Oracl= e UK
Oracle Systems, SPARC & Solaris System Software Engineering.
stacey.marshall@oracle.com<= /a>

--=_MailMate_436AD6D0-D11D-4D3E-ADEE-414BE32F2109_=-- From unknown Mon Aug 18 11:11:21 2025 X-Loop: help-debbugs@gnu.org Subject: bug#34076: Patch to libtool for solaris 11.4 link-editor which rejects -pthread option References: <9BCD209C-EB5D-4E1D-B8F9-0A20D8991D79@oracle.com> In-Reply-To: <9BCD209C-EB5D-4E1D-B8F9-0A20D8991D79@oracle.com> Resent-From: Ozkan Sezer Original-Sender: "Debbugs-submit" Resent-CC: bug-libtool@gnu.org Resent-Date: Fri, 08 Jan 2021 23:57:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 34076 X-GNU-PR-Package: libtool X-GNU-PR-Keywords: To: 34076@debbugs.gnu.org Received: via spool by 34076-submit@debbugs.gnu.org id=B34076.161015016832167 (code B ref 34076); Fri, 08 Jan 2021 23:57:01 +0000 Received: (at 34076) by debbugs.gnu.org; 8 Jan 2021 23:56:08 +0000 Received: from localhost ([127.0.0.1]:50941 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ky1c0-0008Ml-7B for submit@debbugs.gnu.org; Fri, 08 Jan 2021 18:56:08 -0500 Received: from mail-ot1-f45.google.com ([209.85.210.45]:42126) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ky1bx-0008MH-Na for 34076@debbugs.gnu.org; Fri, 08 Jan 2021 18:56:06 -0500 Received: by mail-ot1-f45.google.com with SMTP id 11so11374090oty.9 for <34076@debbugs.gnu.org>; Fri, 08 Jan 2021 15:56:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=TwU3MfjLRfh1h5sjKW5hj4zD724riE4pOqW227yTDzk=; b=aVWere9lEofbLpCuOnDbamaDjiTVW20ZD/vrtf2PJduI1JnVty3FcbBcBgxgnKBbU4 7z0WmeupiDIMbW4sdxo0Z7708rI9f/6GBLQ7KDpakBApblnb0x4SPshnIQI2AdGPuLNY U80h+h4lmb/YWNl3o4cCE5dp1Eyl20o9xEJXnwH9aScpEl9bXOaZviHnAsonqXqFmwpp lWPyCHqmO/HJ8D1j51h1ckYbJaQ9m7PrJKJp4Z8HF1db2mMoNg87eveSIL/IdT6QgUOw 7K3eGQMiWanRtD5GiSXpTw9nS3Iqon16loXVzwl2YalYaI9sKRJb3aW0dkjeylH4fv41 p+sA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=TwU3MfjLRfh1h5sjKW5hj4zD724riE4pOqW227yTDzk=; b=qo0UfNkCfxeOqPjegWZNkfBQ0K4TZA/NmukjkutxLTbveXvfL35fb8k5VxYlOdEt5n U/WUc4oXcpUw5YybJ48LdQzCJBUdbS6pZ/oRLcuiSMfyx1eq1hfWarzPRwzi1xVwAa4h aZwQRR15Z2C2J+3AdOdL5VzDhkgp1PDhYEARwm5wJiJTFhRrIlNZSgM2WssqffeE+xAj SPrXinFECHgTHz/g+kW/tgFePJwGren2zjhdQPjWtGV/pr+BZsVt0Q/7hGCVMEaocIKv k/ZM3Smmk+p6jX1jaLKwyPGMty636VyMsEeVzoaTVfreoUwR94P/ib/1Z66ieq8UfX2V bD0Q== X-Gm-Message-State: AOAM5304hvQ1NyP3u2JUJYKTaFEtZd+jJdcboBI6NYyGVLG0aKgadCcS IqdJay+00uwXFH29hPxLgp1dazM5JiQdAa7ad72taBOG X-Google-Smtp-Source: ABdhPJy4iQzXKbrdCZhMAIgMXqm10Be+GygXmjDEHzypntQIYeKP+TMWqptV2hvZItUhHzjrzpqLAUZOE9VPgFxholU= X-Received: by 2002:a9d:7ac1:: with SMTP id m1mr4264466otn.186.1610150159676; Fri, 08 Jan 2021 15:55:59 -0800 (PST) MIME-Version: 1.0 Received: by 2002:a4a:5253:0:0:0:0:0 with HTTP; Fri, 8 Jan 2021 15:55:59 -0800 (PST) From: Ozkan Sezer Date: Sat, 9 Jan 2021 02:55:59 +0300 Message-ID: Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Has this patch ever been reviewed? Any intentions to merge in mainstream?