This is the mail archive of the
newlib@sources.redhat.com
mailing list for the newlib project.
mips-elf problem
- From: libra <mr924352 at cs dot nthu dot edu dot tw>
- To: newlib at sources dot redhat dot com
- Date: Thu, 8 Jul 2004 16:36:13 +0800
- Subject: mips-elf problem
hello,all
The processes to build up mips-elf tools on cygwin
1. binutils-2.14
$ export host=i686-pc-cygwin
$ export prefix=/tools/mips
$ export target=mips-elf
$ /usr/src/binutils/binutils-2.14/configure \
--host=$host --prefix=$prefix --target=$target \
--with-gnu-as --with-gnu-ld -v 2>&1 | tee configure.log
$ make CFLAGS=-O2 LANGUAGES="c c++" 2>&1 | tee make.log
$ make install LANGUAGES="c c++"
2. gcc-3.3.1-3
/* set up the path for binutils executables */
$ export PATH=$prefix/bin:$PATH
$ /usr/src/gcc/gcc-3.3.1-3/configure \
--enable-languages=c --enable-multilib=no --with-cpu=mips32 \
--host=$host --prefix=$prefix --target=$target \
--with-newlib --with-gnu-as --with-gnu-ld -v 2>&1 | tee configure.log
$ make 2>&1 | tee make.log
$ make install
3. newlib-1.12.0
$ /usr/src/newlib/newlib-1.12.0/configure \
--host=$host --prefix=$prefix --target=$target \
--with-newlib --with-gnu-as --with-gnu-ld -v 2>&1 | tee configure.log
$ make CC_FOR_TARGET=$prefix/$target/bin/gcc \
AS_FOR_TARGET=$prefix/$target/bin/as \
LD_FOR_TARGET=$prefix/$target/bin/ld \
AR_FOR_TARGET=$prefix/$target/bin/ar \
RANLIB_FOR_TARGET=$prefix/$target/bin/ranlib 2>&1 | tee make.log
$ make install
I then wrote a simple hello.c The compiler and assembler seem to work fine.
$ mips-elf-gcc -S hello.c ---> hello.s
$ mips-elf-gcc -c hello.c ---> hello.o
$ mips-elf-as hello.s -o hello.o
But, when I tried to compile/assemble/link, there is problem
$ mips-elf-gcc hello.c
/tools/mips/lib/gcc-lib/mips-elf/3.3.1/../../../../mips-elf/lib/crt0.o
(.text+0x1
4):/usr/src/newlib/newlib-1.12.0/libgloss/mips/crt0.S:80: undefined
reference to
`hardware_hazard_hook'
/tools/mips/lib/gcc-lib/mips-elf/3.3.1/../../../../mips-elf/lib/crt0.o
(.text+0x1
8):/usr/src/newlib/newlib-1.12.0/libgloss/mips/crt0.S:80: undefined
reference to
`hardware_hazard_hook'
/tools/mips/lib/gcc-lib/mips-elf/3.3.1/../../../../mips-elf/lib/crt0.o
(.text+0x6
c):/usr/src/newlib/newlib-1.12.0/libgloss/mips/crt0.S:110: undefined
reference t
o `hardware_hazard_hook'
/tools/mips/lib/gcc-lib/mips-elf/3.3.1/../../../../mips-elf/lib/crt0.o
(.text+0x7
0):/usr/src/newlib/newlib-1.12.0/libgloss/mips/crt0.S:110: undefined
reference t
o `hardware_hazard_hook'
/tools/mips/lib/gcc-lib/mips-elf/3.3.1/../../../../mips-elf/lib/crt0.o
(.text+0xd
0):/usr/src/newlib/newlib-1.12.0/libgloss/mips/crt0.S:146: undefined
reference t
o `get_mem_info'
/tools/mips/lib/gcc-lib/mips-elf/3.3.1/../../../../mips-elf/lib/crt0.o
(.text+0xd
8):/usr/src/newlib/newlib-1.12.0/libgloss/mips/crt0.S:150: undefined
reference t
o `__stack'
/tools/mips/lib/gcc-lib/mips-elf/3.3.1/../../../../mips-elf/lib/crt0.o
(.text+0xd
c):/usr/src/newlib/newlib-1.12.0/libgloss/mips/crt0.S:150: undefined
reference t
o `__stack'
/tools/mips/lib/gcc-lib/mips-elf/3.3.1/../../../../mips-elf/lib/crt0.o
(.text+0x1
04):/usr/src/newlib/newlib-1.12.0/libgloss/mips/crt0.S:180: undefined
reference
to `hardware_init_hook'
/tools/mips/lib/gcc-lib/mips-elf/3.3.1/../../../../mips-elf/lib/crt0.o
(.text+0x1
08):/usr/src/newlib/newlib-1.12.0/libgloss/mips/crt0.S:180: undefined
reference
to `hardware_init_hook'
/tools/mips/lib/gcc-lib/mips-elf/3.3.1/../../../../mips-elf/lib/crt0.o
(.text+0x1
1c):/usr/src/newlib/newlib-1.12.0/libgloss/mips/crt0.S:186: undefined
reference
to `software_init_hook'
/tools/mips/lib/gcc-lib/mips-elf/3.3.1/../../../../mips-elf/lib/crt0.o
(.text+0x1
20):/usr/src/newlib/newlib-1.12.0/libgloss/mips/crt0.S:186: undefined
reference
to `software_init_hook'
/tools/mips/lib/gcc-lib/mips-elf/3.3.1/../../../../mips-elf/lib/crt0.o
(.text+0x1
3c):/usr/src/newlib/newlib-1.12.0/libgloss/mips/crt0.S:193: undefined
reference
to `atexit'
/tools/mips/lib/gcc-lib/mips-elf/3.3.1/../../../../mips-elf/lib/crt0.o
(.text+0x1
64):/usr/src/newlib/newlib-1.12.0/libgloss/mips/crt0.S:222: undefined
reference
to `exit'
/tools/mips/lib/gcc-lib/mips-elf/3.3.1/../../../../mips-elf/lib/crt0.o
(.text+0x1
6c):/usr/src/newlib/newlib-1.12.0/libgloss/mips/crt0.S:260: undefined
reference
to `hardware_exit_hook'
/tools/mips/lib/gcc-lib/mips-elf/3.3.1/../../../../mips-elf/lib/crt0.o
(.text+0x1
70):/usr/src/newlib/newlib-1.12.0/libgloss/mips/crt0.S:260: undefined
reference
to `hardware_exit_hook'
/cygdrive/c/DOCUME~1/cclee/LOCALS~1/Temp/cco1RXdb.o(.text+0x40): In
function `ma
in':
: undefined reference to `printf'
collect2: ld returned 1 exit status
I can reduce some errors by appending -lc -lnullmon to the compiling
command and get
$ mips-elf-gcc hello.c -lc -lnullmon
/tools/mips/lib/gcc-lib/mips-elf/3.3.1/../../../../mips-elf/lib/crt0.o
(.text+0x1
4):/usr/src/newlib/newlib-1.12.0/libgloss/mips/crt0.S:80: undefined
reference to
`hardware_hazard_hook'
/tools/mips/lib/gcc-lib/mips-elf/3.3.1/../../../../mips-elf/lib/crt0.o
(.text+0x1
8):/usr/src/newlib/newlib-1.12.0/libgloss/mips/crt0.S:80: undefined
reference to
`hardware_hazard_hook'
/tools/mips/lib/gcc-lib/mips-elf/3.3.1/../../../../mips-elf/lib/crt0.o
(.text+0x6
c):/usr/src/newlib/newlib-1.12.0/libgloss/mips/crt0.S:110: undefined
reference t
o `hardware_hazard_hook'
/tools/mips/lib/gcc-lib/mips-elf/3.3.1/../../../../mips-elf/lib/crt0.o
(.text+0x7
0):/usr/src/newlib/newlib-1.12.0/libgloss/mips/crt0.S:110: undefined
reference t
o `hardware_hazard_hook'
/tools/mips/lib/gcc-lib/mips-elf/3.3.1/../../../../mips-elf/lib/crt0.o
(.text+0xd
8):/usr/src/newlib/newlib-1.12.0/libgloss/mips/crt0.S:150: undefined
reference t
o `__stack'
/tools/mips/lib/gcc-lib/mips-elf/3.3.1/../../../../mips-elf/lib/crt0.o
(.text+0xd
c):/usr/src/newlib/newlib-1.12.0/libgloss/mips/crt0.S:150: undefined
reference t
o `__stack'
/tools/mips/lib/gcc-lib/mips-elf/3.3.1/../../../../mips-elf/lib/crt0.o
(.text+0x1
04):/usr/src/newlib/newlib-1.12.0/libgloss/mips/crt0.S:180: undefined
reference
to `hardware_init_hook'
/tools/mips/lib/gcc-lib/mips-elf/3.3.1/../../../../mips-elf/lib/crt0.o
(.text+0x1
08):/usr/src/newlib/newlib-1.12.0/libgloss/mips/crt0.S:180: undefined
reference
to `hardware_init_hook'
/tools/mips/lib/gcc-lib/mips-elf/3.3.1/../../../../mips-elf/lib/crt0.o
(.text+0x1
1c):/usr/src/newlib/newlib-1.12.0/libgloss/mips/crt0.S:186: undefined
reference
to `software_init_hook'
/tools/mips/lib/gcc-lib/mips-elf/3.3.1/../../../../mips-elf/lib/crt0.o
(.text+0x1
20):/usr/src/newlib/newlib-1.12.0/libgloss/mips/crt0.S:186: undefined
reference
to `software_init_hook'
/tools/mips/lib/gcc-lib/mips-elf/3.3.1/../../../../mips-elf/lib/crt0.o
(.text+0x1
6c):/usr/src/newlib/newlib-1.12.0/libgloss/mips/crt0.S:260: undefined
reference
to `hardware_exit_hook'
/tools/mips/lib/gcc-lib/mips-elf/3.3.1/../../../../mips-elf/lib/crt0.o
(.text+0x1
70):/usr/src/newlib/newlib-1.12.0/libgloss/mips/crt0.S:260: undefined
reference
to `hardware_exit_hook'
/tools/mips/lib/gcc-lib/mips-elf/3.3.1/../../../../mips-elf/lib/libnullmon.a
(lse
ek.o)(.text+0x8): In function `lseek':
/usr/src/newlib/newlib-1.12.0/libgloss/lseek.c:28: undefined reference
to `__err
no'
collect2: ld returned 1 exit status