Is all MIPS code on Linux supposed to be PIC?

2019-02-27 16:52发布

In Linux on MIPS CPUs (MIPSEL32 to be precise), is it true that all userland SO's are supposed be position independent (PIC)? A cite from an authoritative source would be the the best.

How about Android?

My interest stems from this.

1条回答
霸刀☆藐视天下
2楼-- · 2019-02-27 17:17

The situation with PIC code on Linux appears to be somewhat interesting. In the past (pre EGLIBC-2.9) all binaries on MIPS where supposed to be PIC (both applications and shared libraries). However, to reduce the size of applications, the ABI extension was developed to allow for non-PIC executables (but shared objects stay PIC, as before):

At this time we do not propose any change to the position-independent addressing conventions used by shared objects. Similarly, position-independent executables compiled with '-fpie' -- as required for address space randomisation in "hardened" Linux distributions -- shall continue to use the existing psABI addressing and calling mechanisms.

http://gcc.gnu.org/ml/gcc/2008-07/txt00000.txt

The wiki page on linux-mips.org stating that all binaries on MIPS must be PIC appears to be somewhat out of date, as both recent GCC and EGLIBC on Linux support non-PIC executables: http://www.linux-mips.org/wiki/PIC_code

查看更多
登录 后发表回答