fromGoogleCode / mclinker

Automatically exported from code.google.com/p/mclinker
Other
0 stars 0 forks source link

Mips segmentation fault #130

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. ld.mcld -mtriple="mipsel-none-linux-gnueabi" 
--dynamic-linker=/system/bin/linker 
--sysroot=<Android-NDK>/platforms/android-9/arch-mips/ mips-obj.o 
libgabi++_shared.so -lc -lm  -o test.exe
2. (Push test.exe and libgabi++_shared.so to mips emulator /data )
3. adb shell LD_LIBRARY_PATH=/data /data/test.exe

* What is the expected output? What do you see instead?
Expect: Binary run correctly, and we will get "OK: Exception raised: Memory 
allocation failure!" it printed.

* What version of the product are you using? On what operating system?
master branch, ced79f29ca5f4ba79f7480215ff7801c780ab199 at 13th, March.
Android NDK r8d.
Linux 2.6.32-21-generic #32-Ubuntu SMP x86_64 GNU/Linux

* Please provide any additional information below.

It works on NDK prebuilt ld, Please verify:
<Android-NDK>/toolchains/mipsel-linux-android-4.7/prebuilt/linux-x86/bin/mipsel-
linux-android-g++ --sysroot=<Android-NDK>/platforms/android-9/arch-mips/ 
mips-obj.o libgabi++_shared.so -lc -lm -o test.exe

Original issue reported on code.google.com by wenhan...@gmail.com on 13 Mar 2013 at 6:40

Attachments:

GoogleCodeExporter commented 9 years ago
Result from adb logcat attached.

Original comment by wenhan...@gmail.com on 13 Mar 2013 at 6:43

Attachments:

GoogleCodeExporter commented 9 years ago
Loop in Chiao-Ying and Simon

Original comment by LubaTang on 13 Mar 2013 at 7:17

GoogleCodeExporter commented 9 years ago
Could you attach test.exe for me to debug?

I think mclinker only supports .so files for MIPS.  To generate static or 
dynamic executables is not tested.  We need to work on this feature for MIPS.

Thanks!

Original comment by iceber...@gmail.com on 14 Mar 2013 at 5:46

GoogleCodeExporter commented 9 years ago
Agree. As to me I have never implemented or tested MIPS .exe support in 
MCLinker. It looks like even very simple executable with a single printf() call 
fails.

I've attached a.out built from mips-obj.o. I plan to take a look at this 
problem next week.

Original comment by si...@atanasyan.com on 14 Mar 2013 at 6:57

Attachments:

GoogleCodeExporter commented 9 years ago
Small problem (incorrect name of entry symbol) has been fixed. The next task is 
implementation of R_MIPS_26 relocation and related stuff (PLT) support.

Original comment by si...@atanasyan.com on 18 Mar 2013 at 9:19

GoogleCodeExporter commented 9 years ago
Hi Simon,

  I think we can delay R_MIPS_26 and PLT supports, because all Android code is compiled with -fpic.  There are no R_MIPS_26 calls and no PLT required from the compilation with -fpic.

  But if you still want to do it, I will be ok.  Thanks!

Original comment by iceber...@gmail.com on 18 Mar 2013 at 9:23

GoogleCodeExporter commented 9 years ago
Starting from revision f003d0c85ad6 the following command shows another error 
message:
$ adb shell "LD_LIBRARY_PATH=/data/local/tmp /data/local/tmp/test.exe"          

soinfo_relocate(linker.cpp:1178): unknown reloc type 126 @ 0x400770 (0)CANNOT 
LINK EXECUTABLE

That is because android dynamic linker does not support R_MIPS_COPY relocation.
http://sourceware.org/ml/binutils/2008-07/txt00000.txt

Original comment by si...@atanasyan.com on 9 Jun 2013 at 11:35