From: Simon Schubert Date: Sun, 20 Jan 2008 19:14:09 +0000 (+0000) Subject: Don't link to any threading lib as libc already exports weak symbols. X-Git-Tag: v2.0.1~1300 X-Git-Url: https://gitweb.dragonflybsd.org/dragonfly.git/commitdiff_plain/a4bded30d1c35ce9d4d52132f610a17dd3604224?hp=842eea5bb0febda8ba0a47b3c29d13e0966e9d58 Don't link to any threading lib as libc already exports weak symbols. Linking to any threading lib could lead to overly intelligent build scripts to pick up this particular threading lib and to link to it directly instead of linking just to libpthread. DragonFly-bug: --- diff --git a/lib/libpthread/Makefile b/lib/libpthread/Makefile index f319cd8f6c..541a28c14c 100644 --- a/lib/libpthread/Makefile +++ b/lib/libpthread/Makefile @@ -1,11 +1,9 @@ -# $DragonFly: src/lib/libpthread/Makefile,v 1.5 2007/12/23 02:46:40 sephe Exp $ +# $DragonFly: src/lib/libpthread/Makefile,v 1.6 2008/01/20 19:14:09 corecode Exp $ LIBNAME= libpthread SHLIB_MAJOR= 0 SHLIB_NAME= ${LIBNAME}.so SONAME= ${SHLIB_NAME}.${SHLIB_MAJOR} -DPADD= ${LIBTHREAD} -LDADD= -l${THREAD_LIB} # or any lib defining the pthread interface SRCS= dummy.c diff --git a/lib/libpthread/README b/lib/libpthread/README index 709cadb199..76af2f5e02 100644 --- a/lib/libpthread/README +++ b/lib/libpthread/README @@ -1,4 +1,4 @@ -$DragonFly: src/lib/libpthread/README,v 1.1 2007/04/17 12:34:07 corecode Exp $ +$DragonFly: src/lib/libpthread/README,v 1.2 2008/01/20 19:14:09 corecode Exp $ Proxy libpthread ================ @@ -7,13 +7,8 @@ We want to be able to switch between threading libraries at execution time. This problem is solved by this proxy libpthread. Its operation is as follows. -During link time a library is needed which defines all necessary pthread -functions. By linking libpthread.so to any threading lib (default is -libc_r.so), this requirement is (indirectly) met. - -Unfortuately ld wants to link in also recursively DT_NEEDED libs if any -specified object needs a symbol from these libs. We cheat by doing the -following: libc.so anyways defines all pthread functions as weak symbols +The operation at link time is as follows. +libc.so anyways defines all pthread functions as weak symbols except for pthread_create. libpthread.so now also defines a dummy pthread_create as weak symbol and ld is satisfied. At execution time later rtld will resolve all these references to the strong symbols in the