[m-rev.] for review: Link thread library to libpar_gc.

Julien Fischer jfischer at opturion.com
Tue Feb 19 16:59:42 AEDT 2013


On Tue, Feb 19, 2013 at 4:56 PM, Peter Wang <novalazy at gmail.com> wrote:
> On Linux (and others) the threaded copy of Boehm GC that we build,
> libpar_gc.so, inadvertently did not link to the POSIX thread library.
> When producing an executable we link with both libpar_gc and libpthread
> but recent versions of gcc/GNU ld have different default behaviour,
> such that pthread symbol references in libpar_gc will NOT be resolved by
> passing -lpthread at the executable linking step.  libpar_gc itself
> needs to be linked to libpthread.  The error message looks like:
>
>         /usr/bin/ld: test: hidden symbol `pthread_atfork' in
>         /usr/lib/i386-linux-gnu/libpthread_nonshared.a(pthread_atfork.oS)
>         is referenced by DSO
>
> (Another workaround I found was to use the gcc -pthread option instead
> of linking using -lpthread.  I don't know why that works.)
>
> boehm_gc/Makefile.direct:
>         Make the Mercury project-specific rule that builds libpar_gc.so
>         link with $THREAD_LIBS that was set by configure.
>
>         Add a comment about NOT using the threadlibs.c helper program.

That looks fine.

Cheers,
Julien.



More information about the reviews mailing list