torne wrote:Is it possible to tell whether a library is PIC or not? Debian policy dictates that all shared libraries be PIC and all static libraries be non-PIC, which should be sufficient to allow setting NOELFRELOCS; however, it would be nice if there was some way to check.
a
readelf -d /path/to/library | grep TEXTREL will show you whether a given library (or any ELF file for that matter) needs text relocations (which is what matters for NOELFRELOCS and also implies that the library in question has been compiled with -fPIC). note that we have already run into weird things on non-i386 archs, like some normal executables having text relocations on alpha and others.
also check the
http://adamantix.org and
http://www.gentoo.org/proj/en/hardened/index.xml projects which have already converted their distro (more or less) to an ET_DYN userland and the grsecurity mailing list archives for more info on this topic.