Rufus
Rufus

Reputation: 5566

When would you not want to compile with -fPIC?

As mentioned here, compiling without -fPIC removes the ability for the code to be included in a library. Why would someone want to do this? Are there other reasons to compile without -fPIC?

Upvotes: 1

Views: 152

Answers (1)

JDługosz
JDługosz

Reputation: 5642

Because it is faster/smaller? On some architectures, this can be significant.

Maybe you're building a firmware image that will be burned into ROM and thus fixed to a known address; so there is no reason to make it position independent.

Upvotes: 3

Related Questions