Alex Rivera | Logout

Why isn't all code compiled position independent?

Asked 2009-05-02T01:59:27.603
106

When compiling shared libraries in gcc the -fPIC option compiles the code as position independent. Is there any reason (performance or otherwise) why you would not compile all code position independent?

Edit
Report

1 Answer

1

Also, virtual memory hardware in most modern processors (used by most modern OSes) means that lots of code (all user space apps, barring quirky use of mmap or the like) doesn't need to be position independent. Every program gets its own address space which it thinks starts at zero.

answered 2009-05-02T02:20:15.587

Your Answer