OSDN Git Service

linker: Allow text-relocs for x86 (only)
authorChristopher R. Palmer <crpalmer@gmail.com>
Sun, 7 Feb 2016 11:46:05 +0000 (06:46 -0500)
committerChih-Wei Huang <cwhuang@linux.org.tw>
Fri, 8 Dec 2017 07:38:43 +0000 (15:38 +0800)
This effectively reverts

https://android.googlesource.com/platform/bionic/+/e4ad91f86a47b39612e030a162f4793cb3421d31%5E%21/#F0

for x86 platforms.  Unfortunately, this seems like it is required
if we are going to support ffmpeg.  The ffmpeg team decreed that they
require text relocations for x86 (only) and that they would not
fix the fact that android 6.0 makes ffmpeg unusable on x86:

https://trac.ffmpeg.org/ticket/4928

Change-Id: I68397f4d62f4f6acd8e0d41b7ecdc115969b890a

linker/linker.cpp

index 078b3d5..397e9a8 100644 (file)
@@ -3320,6 +3320,7 @@ bool soinfo::link_image(const soinfo_list_t& global_group, const soinfo_list_t&
 
 #if !defined(__LP64__)
   if (has_text_relocations) {
+#if !defined(__i386__) // ffmpeg says that they require text relocations on x86
     // Fail if app is targeting M or above.
     if (get_application_target_sdk_version() >= __ANDROID_API_M__) {
       DL_ERR_AND_LOG("\"%s\" has text relocations (https://android.googlesource.com/platform/"
@@ -3327,6 +3328,7 @@ bool soinfo::link_image(const soinfo_list_t& global_group, const soinfo_list_t&
                      "Enforced-for-API-level-23)", get_realpath());
       return false;
     }
+#endif
     // Make segments writable to allow text relocations to work properly. We will later call
     // phdr_table_protect_segments() after all of them are applied.
     DL_WARN("\"%s\" has text relocations (https://android.googlesource.com/platform/"