GCC: -static and -pie are incompatible for x86?

前端 未结 3 1510
暗喜
暗喜 2021-02-15 15:47

I\'m recompiling some executable for Android 5.0 as it requires executables to be PIE. I was able to recompile it for ARM with just adding some argumen

3条回答
  •  滥情空心
    2021-02-15 16:29

    Google's NDK tool contain some info about PIE usage. Visit build/core/build-binary.mk, see line 209. It says:

    # enable PIE for executable beyond certain API level, unless "-static"

    I guess, it is linux dynamic link principle's limit. Because Android interpreter (/system/bin/linker) determining which address elf file to be loaded in a static linked file has no interpreter, elf file will be mapped to memory into a fixed address by linux kernel. Here is a discuss about this change Google issue

    If I have any mistake please figure it out:)

提交回复
热议问题