Re: [sr #110542] Patch to libtool for solaris 11.4 link-editor which rejects -pthread option

Robert Boehne <[email protected]>
Newsgroups gmane.comp.gnu.libtool.general
Message-ID <CAADOFPFrDP3by28LJ_qFptXr0SH1Mh45ax_Y-=yhW7dWP=vs9w@mail.gmail.com>
Wouldn't this patch break Solaris 11.3 and earlier?

On Mon, Sep 20, 2021 at 5:24 AM Stacey Marshall <[email protected]>
wrote:

> URL:
>   <https://savannah.gnu.org/support/?110542>
>
>                  Summary: Patch to libtool for solaris 11.4 link-editor
> which
> rejects -pthread option
>                  Project: GNU Libtool
>             Submitted by: staceym
>             Submitted on: Mon 20 Sep 2021 10:24:04 AM UTC
>                 Category: None
>                 Priority: 5 - Normal
>                 Severity: 3 - Normal
>                   Status: None
>                  Privacy: Public
>              Assigned to: None
>         Originator Email:
>              Open/Closed: Open
>          Discussion Lock: Any
>         Operating System: Solaris
>
>     _______________________________________________________
>
> Details:
>
> Solaris 11.4 link-editor, ld(1), has been updated to reject options
> '-thread'
> and '-pthread'.
>
> Details from Oracle Bug 22985199 ld(1) should weed out invalid options
> -thread
> and -pthread
>
> > 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.
>
> The attached patch (libtool-Solaris-ld.patch) prevents '-pthread' from
> being
> passed to ld on solaris2 hosts.
>
>
> _Originally posted to_ https://debbugs.gnu.org/cgi/bugreport.cgi?bug=34076
>
>
>
>
>     _______________________________________________________
>
> File Attachments:
>
>
> -------------------------------------------------------
> Date: Mon 20 Sep 2021 10:24:04 AM UTC  Name: libtool-Solaris-ld.patch
> Size:
> 902B   By: staceym
> Patch file
> <http://savannah.gnu.org/support/download.php?file_id=51948>
>
>     _______________________________________________________
>
> Reply to this item at:
>
>   <https://savannah.gnu.org/support/?110542>
>
> _______________________________________________
>   Message sent via Savannah
>   https://savannah.gnu.org/
>
>
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.