Why isn't all code compiled position independent?

前端 未结 9 2499
感情败类
感情败类 2020-12-04 10:46

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

9条回答
  •  北海茫月
    2020-12-04 11:07

    position-independent code has a performance overhead on most architecture, because it requires an extra register.

    So, this is for performance purpose.

提交回复
热议问题