Link error for arm-elf under Cygwin

Tue Dec 18 11:47:00 GMT 2001

Grant Thanks !
That did solve my link problem.
However a new one cropped up, which may be connected.
I failed to mention that I am using newlib.
The previous link used libc.a at: D:\cygwin\home\amit\arm-elf\arm-elf\lib\
I found libgcc at: D:\cygwin\home\amit\arm-elf\lib\gcc-lib\arm-elf\2.95.3\

Now linking with:
$ arm-elf-ld -e0x8000 -o test test.o -lc -lgcc

I tried debugging with Insight 5.1 and received the following error on the
malloc() line:
 str=(char *)malloc(80)

$ arm-elf-gdb -nw test
GNU gdb 5.1
Copyright 2001 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "--host=i686-pc-cygwin --target=arm-elf"...
(gdb) target sim
Connected to the simulator.
(gdb) load
Loading section .text, size 0x1b8c vma 0x8000
Loading section .rodata, size 0x38 vma 0x9b8c
Loading section .data, size 0x734 vma 0x9cc4
Start address 0x8000
Transfer rate: 71616 bits in <1 sec.
(gdb) r
Starting program: /home/amit/mallocTest/test
_sbrk: Heap and stack collision

Program exited with code 0377.
[Switching to process 0]

Any help will be most appreciated,

Amit Resh

> -----Original Message-----
> From: Grant Edwards []
> Sent: Tuesday, December 18, 2001 5:45 PM
> To: Amit
> Cc:
> Subject: Re: Link error for arm-elf under Cygwin
> On Tue, Dec 18, 2001 at 12:51:46PM +0200, Amit wrote:
> > -1.9.0/newlib/libc/stdlib/mallocr.c:3270: undefined reference
> to `__udivsi3'
> You need to link in libgcc.a
> --
> Grant Edwards

Want more information?  See the CrossGCC FAQ,
Want to unsubscribe? Send a note to

More information about the crossgcc mailing list