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

前端 未结 3 1448
暗喜
暗喜 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:23

    If -pie and -static are both given together, gcc will issue unexpected error.

    -pie

    Produce a position independent executable on targets that support it. For predictable results, you must also specify the same set of options used for compilation (-fpie, -fPIE, or model suboptions) when you specify this linker option.

    -pie actually create a DYN type elf file with INTERP with /system/bin/linker

    executable compiled with -pie

    -static

    On systems that support dynamic linking, this prevents linking with the shared libraries. On other systems, this option has no effect.

    -static create a EXEC type elf file with no INTERP

提交回复
热议问题