Hi,
I'm experiencing a relocation issue with the mclinker for mips provided in Android. I am testing the RenderScript back-end, bcc, to compile object files with the -O0 flag in the mips64 emulator. After that the renderscript runtime creates a shared library out of the generated object file, in my case saturation.o, with the following command:
/system/bin/ld.mc -shared -nostdlib /system/lib64/libcompiler_rt.so -mtriple=mips64el-none-linux-gnueabi --library-path=/system/vendor/lib64 --library-path=/system/lib64 -lRSDriver -lm -lc /data/data/com.example.android.basicrenderscript/code_cache/com.android.renderscript.cache/saturation.o -o /data/data/com.example.android.basicrenderscript/code_cache/com.android.renderscript.cache/librs.saturation.so
The shared object is created, but once the runtime attempts to load it, it raises the error:
Unable to open shared library (/data/data/com.example.android.basicrenderscript/code_cache/com.android.renderscript.cache/librs.saturation.so): dlopen failed: text relocations (DT_TEXTREL) found in 64-bit ELF file
Indeed, the shared object contains the symbol DT_TEXTREL
in the dynamic section, and when passing the option --warn-shared-textrel
a corresponding warning is raised by the mclinker as well. Debugging the linker I found out that the shared object is flagged with DT_TEXTREL
due to the section .eh_frame being marked ALLOCATE but not WRITE, whereas this section is not present at all when the source is compiled with -O3. I also noticed that with the gnu linker this symbol does not appear, nor with the mclinker targeting aarch64. Oddly enough, the symbol is also generated by the mips32 mclinker, but the mips32 emulator nevertheless succeeds to load the library with no errors. This behaviour persists also when using the latest snapshot of the mclinker from upstream.
Unfortunately I was not able to create a small repro to pass using the NDK toolchains, because every time the produced objects exhibited the section .eh_frame marked both ALLOCATE and WRITE. But I am attaching the object file produced by bcc and used to create the shared library. Could you please provide any insights or let me know whether you require further info?
Kind regards,
Dean De Leo
Hi Dean, there was a patch pushed to AOSP for this problem. Perhaps it didn't make it into the NDK, as with the stat/fstat problem. I'll check with our Android team manager (Raghu) when he returns from holiday.
-rich
--
You received this message because you are subscribed to the Google Groups "MCLinker" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mclinker+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Is this in upstream? Andrew's NDK fork is now being replaced with the platform versions of everything. This means that we won't have any patches that weren't upstreamed.
Steve
Hi,
It looks like I caught the bug in the linker. It relates to handling R_MIPS_64 relocations against section symbols. Hope to provide a fix in a couple of days.
Regards,
Simon