gcc-4.3.1 for mips linux failed to execute dynamically linked elf executables

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all, I have build mips-linux-gcc on debian i486 pc from  following sources:Gcc-4.3.1Binutils-2.18Glibc-2.4Kernel-headers-2.6.18
The cross-complied mips-linux-gcc is good for kernel building, and thevmlinux  boots on the target board correctly, but the problem is thatall dynamically linked executable programs are failed to be executedand statically linked executable programs are successful.$ mips-linux-gcc -vUsing built-in specs.Target: mips-linuxConfigured with: ../post-gcc-4.3.1/configure --target=mips-linux--with-float=soft --enable-cxx-flags=-msoft-float --enable-symvers=gnu--prefix=/tools --disable-nls --enable-shared --enable-languages=c,c++--enable-__cxa_atexit --enable-c99 --enable-long-long--enable-threads=posix --with-arch=mips32r2 --with-tune=24kecThread model: posixgcc version 4.3.1 (GCC)
when I compile linux-2.6.18 from mips-linux-gcc 4.3.1, there is an error:
$ make vmlinux.bin  CHK     include/linux/version.h  CHK     include/linux/utsrelease.h  CC      arch/mips/kernel/asm-offsets.sarch/mips/kernel/asm-offsets.c: In function 'output_mm_defines':arch/mips/kernel/asm-offsets.c:228: error: invalid 'asm':invalid use of '%X'arch/mips/kernel/asm-offsets.c:229: error: invalid 'asm':invalid use of '%X'arch/mips/kernel/asm-offsets.c:230: error: invalid 'asm':invalid use of '%X'make[1]: *** [arch/mips/kernel/asm-offsets.s] Error 1make: *** [prepare0] Error 2
the above error is due to the macro:#define constant(string, member) \        __asm__("\n@@@" string "%X0" : : "ri" (member))in arch/mips/kernel/asm-offset.cwhen I change the "%X0" to "%0":#define constant(string, member) \        __asm__("\n@@@" string "%0" : : "ri" (member))
the kernel compiled successfully.But mips-linux-gcc-4.1.1 have no such problem.And the following is problems for dynamically linked elf.A simplest test program:#includeint main(){        printf("hello mips\n");       return 0;}

mips-linux-gcc test.c ?o test-dynMips-linux-gcc test.c ?o test-static ?static

$ file ./test-dyn./test-dyn: ELF 32-bit MSB MIPS64 executable, MIPS, version 1 (SYSV),for GNU/Linux 2.0.0, dynamically linked (uses shared libs), notstripped$ file ./test-static./test-static: ELF 32-bit MSB MIPS64 executable, MIPS, version 1(SYSV), for GNU/Linux 2.0.0, statically linked, not stripped
The strace results on the target mips board are following,(strace isstatically linked, so it can be executed):Strace the program:/ # strace ./test-dynexecve("./test-dyn", ["./test-dyn"], [/* 6 vars */]) = 0do_page_fault() #2: sending SIGSEGV to test-dyn for invalid read access from0002e258 (epc == 2aabf140, ra == 2aab4f70)uname({sys="Linux", node="192.168.172.44", ...}) = 0old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS,-1, 0) = 0x2aac5000access("/etc/ld.so.preload", R_OK)      = 0open("/etc/ld.so.preload", O_RDONLY)    = 3fstat64(3, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0close(3)                                = 0--- SIGSEGV (Segmentation fault) @ 0 (0) ---+++ killed by SIGSEGV +++Process 98 detached/ # strace ./test-staticexecve("./test-static", ["./test-static"], [/* 6 vars */]) = 0svr4_syscall()                          = 4122svr4_syscall()                          = 4045brk(0x494c98)                           = 0x494c98set_thread_area(0x49b460)               = -2143376080brk(0x4b5c98)                           = 0x4b5c98brk(0x4b6000)                           = 0x4b6000fstat64(1, {st_mode=S_IFCHR|0646, st_rdev=makedev(5, 1), ...}) = 0ioctl(1, TIOCNXCL, {B115200 opost isig icanon echo ...}) = 0old_mmap(NULL, 131072, PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2aaa8000write(1, "hello mips\n", 11hello mips)            = 11exit_group(0)                           = ?Process 100 detached
I don't know what's wrong with the mips-linux-gcc 4.3.1, would youhelp me please?And I have also tried to cross-compile gcc for mips-linux from:Gcc-4.1.1Binutils-2.17Glibc-2.4kernel-headers-2.6.18This cross-compiled gcc worked fine for both kernel and programs.

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux