PIC default check
H.J. Lu
hjl@lucon.org
Sat Nov 7 21:43:00 GMT 1998
>
> I assume the change documented below has been added because I mentioned
> that PIC code is default on MIPS? Or is there another reason as well?
>
> 1997-11-06 06:13 H.J. Lu <hjl@gnu.ai.mit.edu>
>
> * config.make.in (build-pic-default): New, defined with
> pic_default.
>
> * configure.in (pic_default): New, set to yes if PIC is
> default.
>
> * Makeconfig (CPPFLAGS-.o, CPPFLAGS-.op, CPPFLAGS-.og,
> CPPFLAGS-.ob): Add -DPIC if $(build-pic-default) is yes.
>
> As things are, this change does alot more bad than good things for MIPS.
> Certain files like init-first.c now always get compiled the same no matter
> whether they're going into the static lib or a shared lib.
>
> What still needs to be done to make this change actually useful is trying
> to avoid multiple compilation where the same flags would have been used for
> .o and os object files. Furthermore, since the PIC code model and shared
> libs are related, but different things adding a second preprocessor define
> like SHARED (CPPFLAGS-.os += -DSHARED) that indicates compilation for a
> shared library would be helpful. The places where the difference between
> PIC and SHARED matters like in init-first.c, dl-close.c etc. can then be
> cleaned up. Does anybody see problems with that?
>
Yes, I did. I was too lazy to fix it :-(. The problem is glibc
assumes PIC means for shared library. But in fact, PIC can be defined
for static library. SHARED may be the solution.
--
H.J. Lu (hjl@gnu.org)
More information about the Libc-hacker
mailing list