本文介绍了-fPIC进行文本重定位?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为ARM重新编译大小合适的软件堆栈(doubango).两周后,我认为我终于完成了任务,因为具有文本重定位功能的库不再具有armeabiarmv5tearmv7-a的功能.但是,armv7-a-neon仍然有它们...

I'm trying to recompile a decently-sized software stack (doubango) for ARM. After two weeks, I thought i finally got it done because the libraries that had text-relocations were no longer having them for armeabi, armv5te, armv7-a. However, armv7-a-neon still have them...

我知道,链接到包含文本重定位的静态库或共享库也会在我的库中引入它们,并且要防止人们在重新编译所有内容以构建与位置无关的代码时在他的CFLAGS中使用-fPIC.完成所有这些之后,我还建立了不带文本重定位功能的FFMPEG ...

I know that linking against static libraries or shared libraries that contain text relocations will introduce them in my library as well, and to fight that one should use -fPIC in his CFLAGS while recompiling everything to build position independent code. All that's done, I built FFMPEG without text-relocations as well...

我不明白的是:如果我为所有拱门使用相同的源文件集,并手动检查.a文件是否具有文本重定位,为什么只有一个单个文本重定位出现在ARMv7 NEON吗?

我正在像readelf -a <libame.a> | grep TEXTREL一样使用readelf检查.a.so库.

I'm checking using readelf like so readelf -a <libame.a> | grep TEXTREL for both .a and .so libs.

devshark@ubuntu:~/SCRATCH/doubango_env/doubango/android-projects/output/gpl/armv7-a-neon/lib$ readelf -a libtinyWRAP.so | grep TEXTREL
   0x00000016 (TEXTREL)                    0x0
   0x0000001e (FLAGS)                      SYMBOLIC TEXTREL BIND_NOW

我如何找到在armv7neon .so库中引入文本重定位的罪魁祸首?

How do I find the culprit that's introducing the text relocations in my armv7neon .so library?

我正在使用NDK r12b.这是整个构建输出的粘贴框:好的,不要粘贴或粘贴框,因为它们不允许2.1mb的文本.

I'm using NDK r12b. Here's a pastebin of the whole build output: OK, no pastie or pastebin since they won't allow 2.1mb of text.

太好了.那么,为什么只为NEON出现文本重定位?

Great. So, any ideas why text relocations are appearing only for NEON?

这个问题可能与此类似,只是我也没有针对x86的重定位. 为什么NDK会生成即使在设置了-fPIC标志之后,x86仍具有文本重定位的共享库?

The question could be simialr to this one, except that i don't have relocations for x86 either. Why is NDK generating shared library for x86 with text relocation even after setting -fPIC flag?

推荐答案

如果所有内容都是使用-fPIC构建的,则其余的文本重定位通常都在任何手写的程序集中.

If everything is being built with -fPIC, the remaining text relocations are generally in any hand written assembly.

看起来ffmpeg的汇编代码似乎有一些文本重定位问题:

It looks like ffmpeg is known to have some text relocation issues with its assembler code:

  • Report on the Android bug tracker (closed, not an Android bug): https://code.google.com/p/android/issues/detail?id=191235
  • ffmpeg bug: https://trac.ffmpeg.org/ticket/4928
  • Another question about this here that claims there is a fix: https://stackoverflow.com/a/34697703/632035

这篇关于-fPIC进行文本重定位?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-11 02:10