#9 Static Library PIC
Closed: Invalid None Opened 13 years ago by spot.


I'm going to try to determine if it is possible to figure out if a static library is PIC.

Okay, so here's what I've discovered:

The reason that Ajax wrote his original draft was because he was trying to avoid the situation where Fedora has static libraries with text relocations. The simplest way to avoid this in most libraries is to compile with PIC, hence, the draft.

Checking for PIC is hard, but checking for text relocations is a little simpler.

Step 1: ld -o foo.so --whole-archive foo.a
Step 2: eu-findtextrel foo.so

If it comes up clean, you're good. If not, well, you either didn't use PIC or your static library has textrels and is gonna cause problems.

So, it seems that this comes down to deciding whether we still want to go with "must build PIC". I can work the check into the proposal.

Note that PIC isn't strictly required on x86_32. In fact, using it has an impact on performance of the compiled code.

Yes, in the general case. However, there should be an option to request an exception due to performance penalties associated with an extra register being unavailable and the need to access symbols through an additional level of indirection in the PIC case.

I'm not sure I see the point. There is always an option to request an exemption from any guideline.

Please update this ticket regarding its continued relevance, providing any information requested. If this is not done within the next two weeks, this ticket may be closed due to inactivity. Thank you!

This ticket is being closed due to inactivity. If the issue referenced has
not been resolved, please reopen the ticket and provide the information
requested. Thank you!

Login to comment on this ticket.

Metadata