This is the mail archive of the crossgcc@sources.redhat.com mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: strange linking problem



I am not getting any useful output from the linker. Here is what I have:


================================================
$ 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 /gcc_build/sh4/lib/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 -lgcc -lc /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 -t -v hello.o
------------------------------------------------------------------------------------------------------------
GNU ld version 2.14 20030612
sh-elf-ld: mode shelf
/gcc_build/sh4/lib/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
(/gcc_build/sh4/lib/gcc-lib/sh-elf/3.3.2/m4/libgcc.a)_set_fpscr.o
(/gcc_build/sh4/lib/gcc-lib/sh-elf/3.3.2/../../../../sh-elf/lib/m4/libc.a)atexit
.o
(/gcc_build/sh4/lib/gcc-lib/sh-elf/3.3.2/../../../../sh-elf/lib/m4/libc.a)exit.o


(/gcc_build/sh4/lib/gcc-lib/sh-elf/3.3.2/../../../../sh-elf/lib/m4/libc.a)impure
.o
(/gcc_build/sh4/lib/gcc-lib/sh-elf/3.3.2/../../../../sh-elf/lib/m4/libc.a)malloc
.o
(/gcc_build/sh4/lib/gcc-lib/sh-elf/3.3.2/../../../../sh-elf/lib/m4/libc.a)malloc
r.o
(/gcc_build/sh4/lib/gcc-lib/sh-elf/3.3.2/../../../../sh-elf/lib/m4/libc.a)mlock.
o
(/gcc_build/sh4/lib/gcc-lib/sh-elf/3.3.2/../../../../sh-elf/lib/m4/libc.a)sbrkr.
o
(/gcc_build/sh4/lib/gcc-lib/sh-elf/3.3.2/../../../../sh-elf/lib/m4/libc.a)syscal
ls.o
(/gcc_build/sh4/lib/gcc-lib/sh-elf/3.3.2/../../../../sh-elf/lib/m4/libc.a)trap.o

(/gcc_build/sh4/lib/gcc-lib/sh-elf/3.3.2/../../../../sh-elf/lib/m4/libc.a)abort.
o
(/gcc_build/sh4/lib/gcc-lib/sh-elf/3.3.2/../../../../sh-elf/lib/m4/libc.a)freer.
o
(/gcc_build/sh4/lib/gcc-lib/sh-elf/3.3.2/../../../../sh-elf/lib/m4/libc.a)signal
.o
(/gcc_build/sh4/lib/gcc-lib/sh-elf/3.3.2/../../../../sh-elf/lib/m4/libc.a)signal
r.o
/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
hello.o
/gcc_build/sh4/lib/gcc-lib/sh-elf/3.3.2/../../../../sh-elf/lib/m4/libc.a(freer.o
)(.text+0x3b0): In function `malloc_trim_r':
../../../../../../gcc-3.3.2/newlib/libc/stdlib/mallocr.c:3322: undefined referen
ce to `__udivsi3_i4'
hello.o(.text+0x20): In function `main':
: undefined reference to `fprintf'
sh-elf-ld: link errors found, deleting executable `a.out'


===================================================



From: Bill Gatliff <bgat@billgatliff.com>
To: Alexander Gdalevich <gdalevich@hotmail.com>
CC: crossgcc@sources.redhat.com
Subject: Re: strange linking problem
Date: Mon, 15 Dec 2003 13:01:20 -0600

Alex:


BTW, I've figured out the issue with _impure_ptr. Newlib uses struct _reent to make standard C library functions reentrant. I just have to have a global variable named _impure_ptr that is a pointer to struct _reent.


If you are properly linking, it should be there already. Are you getting any error messages? Does compiling/linking with -v provide any interesting output?


b.g.


--
Bill Gatliff
Linux, NetBSD, RTEMS, eCos: yea, I do free software!
bgat@billgatliff.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




_________________________________________________________________
Don?t worry if your Inbox will max out while you are enjoying the holidays. Get MSN Extra Storage! http://join.msn.com/?PAGE=features/es



------ Want more information? See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/ Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]