bug-libtool
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#34076: Patch to libtool for solaris 11.4 link-editor which rejects -


From: Stacey Marshall
Subject: bug#34076: Patch to libtool for solaris 11.4 link-editor which rejects -pthread option
Date: Mon, 14 Jan 2019 14:35:44 +0000

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.
address@hidden


reply via email to

[Prev in Thread] Current Thread [Next in Thread]