android x86_64 fails to link with possible overflows for relocations in custom assembly
@ystreet
Submitted by Matthew Waters Link to original bug (#795190)
Description
Linking an android application including libav (e.g. the gstplayer android example) fails to link for x86_64 with the following error.
Compiling against v23 of the Android SDK with v26.0.2 of the build tools targeting android-15.
A quick look into fixing this involves fixing the assembly to be more PIC aware and use the appropriate ELF offset symbols/tables.
Log:
/home/matt/Projects/cerbero/build/android-ndk-r16/toolchains/x86_64-4.9/prebuilt/linux-x86_64/lib/gcc/x86_64-linux-android/4.9.x/../../../../x86_64-linux-android/bin/ld.gold: error: /home/matt/Projects/cerbero/build/dist/android_universal/x86_64/lib/libavcodec.a(simple_idct10.o): requires dynamic R_X86_64_PC32 reloc against 'ff_pw_32' which may overflow at runtime; recompile with -fPIC
/home/matt/Projects/cerbero/build/android-ndk-r16/toolchains/x86_64-4.9/prebuilt/linux-x86_64/lib/gcc/x86_64-linux-android/4.9.x/../../../../x86_64-linux-android/bin/ld.gold: error: /home/matt/Projects/cerbero/build/dist/android_universal/x86_64/lib/libavcodec.a(vc1dsp_loopfilter.o): requires dynamic R_X86_64_PC32 reloc against 'ff_pw_5' which may overflow at runtime; recompile with -fPIC
/home/matt/Projects/cerbero/build/android-ndk-r16/toolchains/x86_64-4.9/prebuilt/linux-x86_64/lib/gcc/x86_64-linux-android/4.9.x/../../../../x86_64-linux-android/bin/ld.gold: error: /home/matt/Projects/cerbero/build/dist/android_universal/x86_64/lib/libavcodec.a(vc1dsp_mc.o): requires dynamic R_X86_64_PC32 reloc against 'ff_pw_9' which may overflow at runtime; recompile with -fPIC
/home/matt/Projects/cerbero/build/android-ndk-r16/toolchains/x86_64-4.9/prebuilt/linux-x86_64/lib/gcc/x86_64-linux-android/4.9.x/../../../../x86_64-linux-android/bin/ld.gold: error: /home/matt/Projects/cerbero/build/dist/android_universal/x86_64/lib/libavcodec.a(vc1dsp_mmx.o): requires dynamic R_X86_64_PC32 reloc against 'ff_pw_9' which may overflow at runtime; recompile with -fPIC
/home/matt/Projects/cerbero/build/android-ndk-r16/toolchains/x86_64-4.9/prebuilt/linux-x86_64/lib/gcc/x86_64-linux-android/4.9.x/../../../../x86_64-linux-android/bin/ld.gold: error: /home/matt/Projects/cerbero/build/dist/android_universal/x86_64/lib/libavcodec.a(vc1dsp_mmx.o): requires dynamic R_X86_64_PC32 reloc against 'ff_pw_9' which may overflow at runtime; recompile with -fPIC
and 100 other symbols that follow the same pattern