libtool-patches
[Top][All Lists]
Advanced

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

linking a shared library with -pthread omits -pthread on the link line.


From: Sebastian Wilhelmi
Subject: linking a shared library with -pthread omits -pthread on the link line.
Date: 10 Dec 2002 13:49:01 +0100

Hi,

If you're using the following command line

libtool --mode=link gcc  -o libtest.la -rpath /usr/lib test.lo -pthread

the following link line is generated:

gcc -shared  test.lo   -Wl,-soname -Wl,libtest.so.0 -o \
  .libs/libtest.so.0.0.0

instead of

gcc -shared  test.lo   -Wl,-soname -Wl,libtest.so.0 -o \
  .libs/libtest.so.0.0.0 -posix

Please have a look at the GLib bug      
        
        http://bugzilla.gnome.org/show_bug.cgi?id=100697 

as to why we need that.

Quoting from the corresponding GLib bug report about the reasons, that
-pthread has to be on the linking line also for shared libs:

- prelink; in order for prelink to preresolve relocations
   for a library must not have undefined symbols; any 
   undefined symbols will always have to handled at run 
   time.

- Symbol versioning; the binding of symbols to particular 
   versions happens when the library is linked. If -lpthread
   not on the link line, then the symbol will get the base 
   version at run time, not the correct newer one. 

Also see the corresponding gcc bug report, as gcc ignores -pthread for 
shared libraries so far. Should the gcc people decide, that this is a
feature, not a bug, then of course this bug report would become
superfluous.

The URL to the gcc bug:

        
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?database=gcc&cmd=view+audit-trail&pr=8888

Attached is a patch for libtool, which solves this issue for the options
-pthread, -pthreads, -threads, -mt, -mthreads and -Kthread.

Thanks,
Sebastian
-- 
Sebastian Wilhelmi                 |            här ovanför alla molnen
mailto:address@hidden              |     är himmlen så förunderligt blå
http://seppi.de                    |

Attachment: libtool.diff
Description: Text Data


reply via email to

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