printing exceptions?
Jeff Sturm
jsturm@one-point.com
Wed Mar 6 10:51:00 GMT 2002
On 6 Mar 2002, Adam Megacz wrote:
> > You must never link -lc ahead of -lpthread. The latter often overrides
> > symbols in the former (e.g. wait).
>
> BTW, why does the order of -l arguments matter?
The runtime linker resolves symbols by searching libraries in link order.
The order is only important if symbols are duplicated, as in
libpthread.so:
[jsturm@suzy jsturm]$ readelf -s /lib/libpthread.so.0 | grep fork
218: 00008650 198 FUNC WEAK DEFAULT 12 fork@@GLIBC_2.0
[jsturm@suzy jsturm]$ readelf -s /lib/libc.so.6 | grep fork
1241: 000bb160 50 FUNC WEAK DEFAULT 11 fork@@GLIBC_2.0
(output trimmed for clarity.)
By placing -lc first, you will bind to the wrong implementation of fork().
Jeff
More information about the Java
mailing list