[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Quick question: reliable PIC/non-PIC detection in ELF objects?



On Wed, Jul 07, 2004 at 06:24:12PM +0200, Jeroen van Wolffelaar wrote:
> I hope you have time to give me some advice on ELF/PIC issues, it's for
> lintian, there is a check for wrong pic usage since ages, but it doesn't
> work good currently, and since pic-errors are often made, I'd like to
> fix it.
> 
> What's a reliable way to detect whether or not an ELF object is compiled
> with PIC or not, using the output of 'objdump --headers
> --private-headers -T'?
> 
> Currently, lintian greps for TEXTREL, and takes it as evidence of
> non-pic code. According to asuffield, that should work mostly, but can
> be off sometimes.
> 
> It used to grep for .rel.text and .rela.text, but that reportedly didn't
> work.
> 
> The main problem is, I cannot build myself a super-small testlibrary...
> My current attempt is http://www.wolffelaar.nl/~jeroen/libbaz.tar.gz,
> but it doesn't seem to work, at least, it doesn't seem to provoke any
> lintian warning.
> 
> Do you have any idea how to solve this?

TEXTREL is generally the flag that there is a problem.  You can build
non-PIC libraries that won't get TEXTREL - but they won't be a problem
at load time, either!

-- 
Daniel Jacobowitz



Reply to: