PIC without shared libraries

Philip Blundell pb@nexus.co.uk
Tue May 25 03:00:00 GMT 1999


Hi,

I'm currently working on a port of libc to an embedded system.  We are using 
ELF binaries and all user code (libraries and applications) is compiled with 
-fPIC.  However, we don't wish to use shared libraries or dynamic linking so I 
have configured with --disable-shared --enable-static-nss. 

The libc configure script detects that -fPIC is default and adds `-DPIC' to 
the CPPFLAGS.  Unfortunately, it seems that in many cases the code is actually 
using "#ifdef PIC" as a test for "is this a shared object", not for PIC per 
se, and this causes things to go somewhat wrong.

I think we should either introduce a new macro that can be tested (say SHARED) 
and use it instead of testing for PIC, or take out the configure clause that 
defines PIC whenever -fPIC is in use.  I'm not sure which of these is the 
right thing to do; does anybody have any comments?

p.




More information about the Libc-hacker mailing list