Reference to stub in libgcc.a
Daniel Jacobowitz
drow@mvista.com
Mon Jun 24 07:42:00 GMT 2002
On Mon, Jun 24, 2002 at 04:20:52AM -0500, Dirk Neumann wrote:
> On 23 Jun 2002 20:57:17 +0100
> Nick Clifton <nickc@cambridge.redhat.com> wrote:
>
> > Hi Dirk,
> >
> > > I want to compile a project for arm/thumb. The GCC 3.1 and the
> > > binutils 2.12 are successfully compiled and installed for arm-elf
> > > (on pc-linux-gnu host). The gcc produces an assembler-output with
> > > "_call_via_r3". This stub exists definitely in the library libgcc.a,
> > > but the linker (arm-elf-ld) does not link this stub. The linker-flag
> > > is set to this directory, but arm-elf-ld produces the message
> > > 'undefined reference to _call_via_r3'.
> >
> > What is the *exact* command line with which you are invoking
> > arm-elf-ld ? (If you are running the linker from gcc then try adding
> > the -v command line switch).
>
> the exact command line is
> arm-elf-ld -T armscript -L/home/arm/programme/gcc/lib/gcc-lib/arm-elf/3.1 $(OBJECTS) -lc -o example.elf
> where the -L/... is the directory which contains the libgcc.a (and a subdirectory thumb which contains the libgcc.a for thumb). An expanding to the complete libgcc.a name has no effect. armscript is a file for the ATMEL arm7tdmi-board containing information about target-cpu and memory.
> The libgcc.a is not loaded at all (other stubs are also "undefined reference"s), neither in thumb-mode nor in 32-bit-arm-mode.
>
> Thanks for your effords
You don't mention libgcc anywhere on that command line. You need to;
also, it needs to be at the end of the link command (IIRC). If you
want to use the Thumb libgcc then you need to use the appropriate -L
option yourself. Normally GCC takes care of all this, which is why
linking via GCC is recommended.
--
Daniel Jacobowitz Carnegie Mellon University
MontaVista Software Debian GNU/Linux Developer
More information about the Binutils
mailing list