Re: 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 you, i use mips-linux-gnu-gcc 4.3.2 (Sourcery G++ Lite 4.3-51) 
and glibc 2.12.1-0ubuntu9 (libc6-dev) but when i build it error is:

make ARCH=mips CROSS_COMPILE=mips-linux-gnu-
http://old.nabble.com/file/p30366623/thientai.png 
CHK include/linux/version.h
CHK include/linux/utsrelease.h
CC arch/mips/kernel/asm-offsets.s
arch/mips/kernel/asm-offsets.c: In function 'output_mm_defines':
arch/mips/kernel/asm-offsets.c:232: error: invalid 'asm': invalid use of
'%X'
arch/mips/kernel/asm-offsets.c:233: error: invalid 'asm': invalid use of
'%X'
arch/mips/kernel/asm-offsets.c:234: error: invalid 'asm': invalid use of
'%X'
make[1]: *** [arch/mips/kernel/asm-offsets.s] Error 1
make: *** [prepare0] Error 2 
http://ngosylien.edu.vn/forum/showthread.php?482-3-12-2010-Port-Gcc-for-Mips-to-Gcc-for-x86&p=589&viewfull=1#post589




hjksfw hjksfw wrote:
> 
> Thanks very much.
> I change glibc from 2.4 to 2.7 and the resulted cross-compiled
> mips-linux-gcc 4.3.1 worked well for both kernel and dynamically
> linked elf executables.
> 
> å 08-9-3ïDavid Daney<ddaney@xxxxxxxxxx> åéï
>> hjksfw hjksfw wrote:
>> > Hi all, I have build mips-linux-gcc on debian i486 pc from  following
>> sources:
>> > Gcc-4.3.1
>> > Binutils-2.18
>> > Glibc-2.4
>> > Kernel-headers-2.6.18
>> .
>> .
>> .
>> > when I compile linux-2.6.18 from mips-linux-gcc 4.3.1, there is an
>> error:
>> >
>> .
>> .
>> .
>> >
>> > the kernel compiled successfully.But mips-linux-gcc-4.1.1 have no such
>> problem.
>>
>> Perhaps you should stick to gcc-4.1.1 for your kernel.
>>
>> > And the following is problems for dynamically linked elf.
>> > A simplest test program:
>> > #include
>> > int main()
>> > {
>> >         printf("hello mips\n");
>> >        return 0;
>> > }
>> >
>> >
>> > mips-linux-gcc test.c ïo test-dyn
>> > Mips-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), not
>> > stripped
>> > $ 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 is
>> > statically linked, so it can be executed):
>> > Strace the program:
>> > / # strace ./test-dyn
>> > execve("./test-dyn", ["./test-dyn"], [/* 6 vars */]) = 0
>> > do_page_fault() #2: sending SIGSEGV to test-dyn for invalid read
>> access from
>> > 0002e258 (epc == 2aabf140, ra == 2aab4f70)
>> > uname({sys="Linux", node="192.168.172.44", ...}) = 0
>> > old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS,
>> > -1, 0) = 0x2aac5000
>> > access("/etc/ld.so.preload", R_OK)      = 0
>> > open("/etc/ld.so.preload", O_RDONLY)    = 3
>> > fstat64(3, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
>> > close(3)                                = 0
>> > --- SIGSEGV (Segmentation fault) @ 0 (0) ---
>> > +++ killed by SIGSEGV +++
>> > Process 98 detached
>> > / # strace ./test-static
>> > execve("./test-static", ["./test-static"], [/* 6 vars */]) = 0
>> > svr4_syscall()                          = 4122
>> > svr4_syscall()                          = 4045
>> > brk(0x494c98)                           = 0x494c98
>> > set_thread_area(0x49b460)               = -2143376080
>> > brk(0x4b5c98)                           = 0x4b5c98
>> > brk(0x4b6000)                           = 0x4b6000
>> > fstat64(1, {st_mode=S_IFCHR|0646, st_rdev=makedev(5, 1), ...}) = 0
>> > ioctl(1, TIOCNXCL, {B115200 opost isig icanon echo ...}) = 0
>> > old_mmap(NULL, 131072, PROT_READ|PROT_WRITE,
>> > MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2aaa8000
>> > write(1, "hello mips\n", 11hello mips
>> > )            = 11
>> > exit_group(0)                           = ?
>> > Process 100 detached
>> >
>> > I don't know what's wrong with the mips-linux-gcc 4.3.1, would you
>> > help me please?
>>
>> I don't think gcc-4.3.x is supported by any version of glibc prior to
>> 2.8.  Best to use a supported version of gcc when building glibc.
>>
>> I have successfully used gcc-4.3.x on several different mips
>> platforms.  But I only build glibc with supported compiler versions.
>> You could try upgrading to glibc 2.7 or 2.8.  Or ...
>>
>> > And I have also tried to cross-compile gcc for mips-linux from:
>> > Gcc-4.1.1
>> > Binutils-2.17
>> > Glibc-2.4
>> > kernel-headers-2.6.18
>> > This cross-compiled gcc worked fine for both kernel and programs.
>>
>> ...Use these versions as they seem to work for you.
>>
>> David Daney
>>
> 
> 

-- 
View this message in context: http://old.nabble.com/gcc-4.3.1-for-mips-linux-failed-to-execute-dynamically-linked-elf-executables-tp19263040p30366623.html
Sent from the gcc - Help mailing list archive at Nabble.com.




[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