-pthread inconsistency on some arches
Hi!
It looks like gcc behavior with regard to whether -pthread implies
-lpthread, when -shared is specified, is inconsistent across
architectures.
For example (gcc-3.3) gcc/config/sparc/linux.h has:
#define LIB_SPEC \
"%{pthread:-lpthread} \
%{shared:-lc} \
%{!shared:%{mieee-fp:-lieee} %{profile:-lc_p}%{!profile:-lc}}"
Which seems fine. However gcc/config/mips/linux.h has:
#define LIB_SPEC "\
%{shared: -lc} \
%{!static:-rpath-link %R/lib:%R/usr/lib} \
%{!shared: %{pthread:-lpthread} \
%{profile:-lc_p} %{!profile: -lc}}"
Which, if I read it correctly, makes -pthread a no-op when -shared is
specified.
This behavior causes bugs like http://bugs.debian.org/273671
Thiemo Seufer said in that bug report that changing that behavior on mipsel
would probably cause backward incompatibility. If that is really the case, then
I could add some workaround to ekg source, but would like someone to confirm
that, since it seems odd to me, all the more that a very similar (if not
identical) bug was fixed last year by Daniel Jacobowitz for powerpc
http://lists.debian.org/debian-gcc/2003/09/msg00145.html
His two changes to gcc/config/rs6000/sysv4.h basically moved
%{pthread:-lpthread} from within %{!shared:}, so that it took action for the
cases when -shared was specified as well.
regards,
Marcin
--
Marcin Owsiany <porridge@debian.org> http://marcin.owsiany.pl/
GnuPG: 1024D/60F41216 FE67 DA2D 0ACA FC5E 3F75 D6F6 3A0D 8AA0 60F4 1216
Reply to: