strange linking problem
Alexander Gdalevich
gdalevich@hotmail.com
Mon Dec 15 16:42:00 GMT 2003
Greetings!
I've recently build the newest gcc 3.3.2 cross-compiler. It works fine, but
I have trouble linking with ld.
Here is the output from gcc when compiling a regular helloworld program:
Program
===============================
hello.c
---------------------------------------------------------------------
#include <stdio.h>
int main(int argc, char ** argv)
{
return fprintf(stderr, "Hello world!\r\n");
}
===============================
Output when linked with collect2:
===============================
sh-elf-gcc -mb -fno-delayed-branch -O2 -m4 -v hello.c
----------------------------------------------------------------------
Reading specs from /gcc_build/sh4/lib/gcc-lib/sh-elf/3.3.2/specs
Configured with: ../gcc-3.3.2/configure --target=sh-elf
--prefix=/gcc_build/sh4
--enable-languages=c,c++ --with-newlib --program-prefix=sh-elf-
--disable-thread
s --with-gxx-include-dir=/gcc_build/sh4/sh-elf/include -v
Thread model: single
gcc version 3.3.2
/gcc_build/sh4/lib/gcc-lib/sh-elf/3.3.2/cc1.exe -quiet -v -D__GNUC__=3
-D__GNUC
_MINOR__=3 -D__GNUC_PATCHLEVEL__=2 hello.c -quiet -dumpbase hello.c -mb -m4
-aux
base hello -O2 -version -fno-delayed-branch -o
/cygdrive/c/DOCUME~1/Alex/LOCALS~
1/Temp/ccbMelHP.s
GNU C version 3.3.2 (sh-elf)
compiled by GNU C version 3.3.1 (cygming special).
GGC heuristics: --param ggc-min-expand=64 --param ggc-min-heapsize=65438
ignoring nonexistent directory "/gcc_build/sh4/sh-elf/sys-include"
#include "..." search starts here:
#include <...> search starts here:
/gcc_build/sh4/include
/gcc_build/sh4/lib/gcc-lib/sh-elf/3.3.2/include
/gcc_build/sh4/sh-elf/include
End of search list.
/gcc_build/sh4/lib/gcc-lib/sh-elf/3.3.2/../../../../sh-elf/bin/as.exe -big
-o /
cygdrive/c/DOCUME~1/Alex/LOCALS~1/Temp/cc7Ypnva.o
/cygdrive/c/DOCUME~1/Alex/LOCA
LS~1/Temp/ccbMelHP.s
/gcc_build/sh4/lib/gcc-lib/sh-elf/3.3.2/collect2.exe -m shelf
/gcc_build/sh4/li
b/gcc-lib/sh-elf/3.3.2/m4/crt1.o
/gcc_build/sh4/lib/gcc-lib/sh-elf/3.3.2/m4/crti
.o /gcc_build/sh4/lib/gcc-lib/sh-elf/3.3.2/m4/crtbegin.o
-L/gcc_build/sh4/lib/gc
c-lib/sh-elf/3.3.2/m4 -L/gcc_build/sh4/lib/gcc-lib/sh-elf/3.3.2
-L/gcc_build/sh4
/lib/gcc-lib/sh-elf/3.3.2/../../../../sh-elf/lib/m4
-L/gcc_build/sh4/lib/gcc-lib
/sh-elf/3.3.2/../../../../sh-elf/lib
/cygdrive/c/DOCUME~1/Alex/LOCALS~1/Temp/cc7
Ypnva.o -lgcc -lc -lgcc /gcc_build/sh4/lib/gcc-lib/sh-elf/3.3.2/m4/crtend.o
/gcc
_build/sh4/lib/gcc-lib/sh-elf/3.3.2/m4/crtn.o
=====================================================
Output when linked with ld
=====================================================
$ sh-elf-ld -m shelf -N -L/gcc_build/sh4/lib/gcc-lib/sh-elf/3.3.2/m4
-L/gcc_bui
ld/sh4/lib/gcc-lib/sh-elf/3.3.2
-L/gcc_build/sh4/lib/gcc-lib/sh-elf/3.3.2/../..
/../../sh-elf/lib/m4
-L/gcc_build/sh4/lib/gcc-lib/sh-elf/3.3.2/../../../../sh-e
lf/lib -v hello.o
------------------------------------------------------------------------------------------------------------------------
GNU ld version 2.14 20030612
sh-elf-ld: warning: cannot find entry symbol start; defaulting to
00000000000010
00
hello.o(.text+0x18): In function `main':
: undefined reference to `_impure_ptr'
hello.o(.text+0x20): In function `main':
: undefined reference to `fprintf'
======================================================
I'll appreciate any clue as to what's going on.
Thanks.
----------------------------------------------------------------
"Normal people ... believe that if it ain't broke, don't fix it. Engineers
believe that if it ain't broke, it doesn't have enough features yet."
_________________________________________________________________
Tired of slow downloads and busy signals? Get a high-speed Internet
connection! Comparison-shop your local high-speed providers here.
https://broadband.msn.com
------
Want more information? See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com
More information about the crossgcc
mailing list