lua-users home
lua-l archive

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


Jeff Pohlmeyer wrote:
On Sat, Feb 27, 2010 at 1:58 PM, Hisham wrote:

Does anyone have anything against LuaRocks adding -fPIC to CFLAGS on
every architecture?


I have no idea about any of this stuff, but I did find this page:

  http://lua-users.org/wiki/BuildingModules

It says:

"Avoid -fPIC since it comes with a big performance penalty on some
RISC architectures (Sparc in particular)."

So if -fPIC  should be used everywhere, maybe that sentence could use
some clarification.

- Jeff


This recent discussion prompted me to do some research about the subject. Found a very in-depth explanation of modern linkers and position dependent/independent code, along with relocators.

http://www.airs.com/blog/archives/41

I would call into question the claim: "Unfortunately -fpic comes with a *significant* performance loss on x86." (emphasis is mine) -> can anyone verify this on modern CPUs with some benchmarks?

Also, even if -fPIC is bad on only a small minority of systems, would not one want it for the default, and have it taken off only in those rare circumstances?

To me this whole premise (trying to avoid -fPIC like the flu in a build system) just seems like a very effective way to hit oneself on the head with a hammer. Sure, it might help keep you focused sometimes, but most of the time it is simply not a good idea...