If I don't use -fPIC flag while compiling a shared library, will it really matter? Will it affect the way loader loads it into process's address space?
Asked
Active
Viewed 3,366 times
3
-
1http://stackoverflow.com/questions/5311515/gcc-fpic-option – Oleg Olivson Sep 20 '13 at 09:52
-
@oleg Thanks. From the link it looks like, it will create a problem only when i have multiple shared libraries which is the case most of the times. – Jack Sep 20 '13 at 10:07
-
2If you compile without -fPIC flag, you'll probably have a lot of broken adresses (pointing out of library memory space) in library. So all adresses have to be relative (with -fPIC flag). – Oleg Olivson Sep 20 '13 at 10:12
-
1http://www.agner.org/optimize/optimizing_cpp.pdf, p.151. -- 14.12 Position-independent code. It contains a discussion about PIC, PLT, GOT – Konstantin Burlachenko Sep 06 '17 at 17:00