error: only position independent executables (PIE) are supported
来源:互联网 发布:郑州施工队 网络布线 编辑:程序博客网 时间:2024/06/05 00:11
PIE, position independent executables.
android 4.1上开始支持PIE,所以4.1之前的版本不能使用PIE的executable,而之前开发的app一般都是非PIE的。
Android 4.1 PIE (Position Independent Executable) support Read-only relocations / immediate binding (-Wl,-z,relro -Wl,-z,now) dmesg_restrict enabled (avoid leaking kernel addresses) kptr_restrict enabled (avoid leaking kernel addresses)
在android L后,linker.cpp中,
//bionic\linker\linker.cppstatic ElfW(Addr) __linker_init_post_relocation(KernelArgumentBlock& args, ElfW(Addr) linker_base) { ElfW(Ehdr)* elf_hdr = reinterpret_cast<ElfW(Ehdr)*>(si->base); //不是PIE的直接报错返回,而之前的版本中都没有 if (elf_hdr->e_type != ET_DYN) { __libc_format_fd(2, "error: only position independent executables (PIE) are supported.\n"); exit(EXIT_FAILURE); }}
所以在android L后,非PIE的exe执行都会报错error: only position independent executables (PIE) are supported.
。
1.但是如果在android 4.1之前的版本运行PIE, 也是有办法的:
The Chromium project released a wrapper that allows PIE binaries to run on pre-JB Android releases。
具体的使用方法见http://stackoverflow.com/questions/24818902/running-a-native-library-on-android-l-error-only-position-independent-executab,
其中run_pie在android L中的external\chromium_org\tools\android\run_pie
中可找到,下面是run_pie.c中的注释,说明run_pie主要是为了在linker不支持PIE的早期版本中运行PIE。
// This is a wrapper to run position independent executables on Android ICS,// where the linker doesn't support PIE. This requires the PIE binaries to be// built with CFLAGS +=-fvisibility=default -fPIE, and LDFLAGS += -rdynamic -pie// such that the main() symbol remains exported and can be dlsym-ed.
2.那么在android L之后的版本运行非PIE,有没有办法?
目前是没有解决方案,除非你把bionic的linker替换,具体参考下面的文章,使用其中修改编译过的linker, http://forum.xda-developers.com/google-nexus-5/development/fix-bypassing-pie-security-check-t2797731
- error: only position independent executables (PIE) are supported.
- error: only position independent executables (PIE) are supported.
- error: only position independent executables (PIE) are supported
- error: only position independent executables (PIE) are supported
- android PIE error: only position independent executables (PIE) are supported解决方法
- android_server pie/nonpie 解决error: only position independent executables (PIE) are supported
- android PIE error: only position independent executables (PIE) are supported解决方法
- only position independent executables (PIE) are supported的解决问题
- (OK) Android 5+ —— error: only position independent executables (PIE) are supported.
- android可执行文件出现error: only position independent executables (PIE) are supported.
- android可执行文件出现error: only position independent executables (PIE) are supported.
- NDK编译可执行文件在Android L中运行显示error: only position independent executables (PIE) are supported.失败问题解决办法。
- NDK编译可执行文件在Android L中运行显示error: only position independent executables (PIE) are supported.失败问题解决办法。
- SQL Server Profiler错误:only TrueType fonts are supported
- Only 64-bit build environments are supported beyond froyo/2.2
- Only 64-bit build environments are supported beyond froyo/2.2
- only 64-bit build environment are supported beyong froyo/2.2
- Cross origin requests are only supported for HTTP
- java保证线程安全的两种方式
- 手动添加用户hive,基本组为hive(5000),附加组为mygroup
- Mybatis源码分析
- Java EE三大组件技术
- Python 文件/文件夹操作(读写read/write、复制copy、删除delete、重命名rename)
- error: only position independent executables (PIE) are supported
- tcpcopy
- 【原创】k8s源码分析-----kubelet(6)statusManager
- JQuery设置和去除disabled
- CQOI 2016 Day2 日志
- 一个支持事件event的自定义EventTarget类型
- 第七周项目一-成员函数、友元函数和一般函数有区别(1)
- U-boot分析与移植(2)_U-boot stage1分析
- Vector Asset Studio的使用