EmbDev.net

Forum: ARM programming with GCC/GNU tools Trouble linking BREW objects under WinARM4.1x

Author: Adam (Guest)
Posted on:
Attached files:

Hi,

I'm trying to use WinARM 4.1.1 to compile and link object files for a
BREW project. I got started using this page: http://brew.wardco.com/.

First thing to note is that I have this successfully working under the
GNUDE tool chain. When I switched over to WinARM, I initially got it to
work till I noticed that I had -Lc:/gnude/arm-elf/lib instead of
-Lc:/WinARM/arm-elf/lib in my library path. I obviously don't want to
have both systems in place in my environment. Using the WinARM library
path causes me to get the following linker errors (just the short
version; see attached for the full list):
c:/WinARM/arm-elf/lib\libsupc++.a(eh_personality.o): In function `read_encoded_value_with_base':
c:/winarms/gcc-4.1.1/gcc/unwind-pe.h:259: undefined reference to `abort'
c:/WinARM/arm-elf/lib\libsupc++.a(eh_terminate.o):../../../../../gcc-4.1.1/libstdc++-v3/libsupc++/eh_terminate.cc:46: more undefined references to `abort' follow
c:/WinARM/arm-elf/lib\libc.a(fopen.o): In function `_fopen_r':
fopen.c:(.text+0x48): undefined reference to `_open_r'
c:/WinARM/arm-elf/lib\libc.a(freer.o): In function `_malloc_trim_r':
mallocr.c:(.text+0x48): undefined reference to `_sbrk_r'
C:\WinARM/lib/gcc/arm-elf/4.1.1/\libgcc.a(unwind-sjlj.o): In function `_Unwind_SjLj_Resume_or_Rethrow':
../../../gcc-4.1.1/gcc/unwind.inc:263: undefined reference to `abort'

I am not sure how to approach solving this; it appears that I am simply
missing a path somewhere, but which path?

Any insight would be appreciated.

Thanks,
-=-Adam
Author: Martin Thomas (Guest)
Posted on:

It seems that the linker gets forced to link non-interwork-enabled
object- and/or library-code since you use a fixed library path, you may
just try to modify the path so it points to the interwork-enabled
libc-object-code.
It's difficult to analyse this without further information but you may
check if you are calling the linker (arm-elf-ld) directly which is not
recommended. If you are building a C++ application link with
arm-elf-g++. It will "automatically" link with the correct libc-objects
since the frontend "knows" about the multilibs, no need to set a fixed
path to a libc.
Author: Adam (Guest)
Posted on:
Attached files:

Martin, thanks for the reply. I am indeed explicitly calling arm-elf-ld.
I am not sure how to go about making arm-elf-g++ automatically do the
linking for me. Can you provide any details? I am not intimately
familiar with the implicit workings of the linking process. I am using a
template make file that allegedly works for other developers compiling
BREW under WinARM. I have attached that (now modified from the original)
file. I did try to get the linker to use the interworking version of
libc.a, but actually ended up with more errors.

Two interesting notes: 1) While troubleshooting, I noticed that
specifically using the basic libc.a from the GNUDE chain allows the
linking to succeed (and the app to run properly). 2) I just upgraded to
WinARM 4.1.2 (which I wasn't aware was out there till just today!) and
the resulting errors were much smaller in scope:
C:\WinARM\arm-elf\lib\libc.a(lib_a-abort.o): In function `abort':
abort.c:(.text+0xc): undefined reference to `_exit'
C:\WinARM\arm-elf\lib\libc.a(lib_a-fopen.o): In function `_fopen_r':
fopen.c:(.text+0x58): undefined reference to `_open_r'
C:\WinARM\arm-elf\lib\libc.a(lib_a-freer.o): In function `_malloc_trim_r':
mallocr.c:(.text+0x48): undefined reference to `_sbrk_r'
mallocr.c:(.text+0x70): undefined reference to `_sbrk_r'
mallocr.c:(.text+0xb4): undefined reference to `_sbrk_r'
C:\WinARM\arm-elf\lib\libc.a(lib_a-fseek.o): In function `_fseek_r':
fseek.c:(.text+0xf4): undefined reference to `_fstat_r'
fseek.c:(.text+0x35c): undefined reference to `_fstat_r'
C:\WinARM\arm-elf\lib\libc.a(lib_a-makebuf.o): In function `__smakebuf_r':
makebuf.c:(.text+0x40): undefined reference to `_fstat_r'
makebuf.c:(.text+0x104): undefined reference to `isatty'
C:\WinARM\arm-elf\lib\libc.a(lib_a-mallocr.o): In function `_malloc_r':
mallocr.c:(.text+0x428): undefined reference to `_sbrk_r'
mallocr.c:(.text+0x5c0): undefined reference to `_sbrk_r'
C:\WinARM\arm-elf\lib\libc.a(lib_a-signal.o): In function `_raise_r':
signal.c:(.text+0x16c): undefined reference to `_getpid_r'
signal.c:(.text+0x180): undefined reference to `_kill_r'
C:\WinARM\arm-elf\lib\libc.a(lib_a-stdio.o): In function `__sclose':
stdio.c:(.text+0xc): undefined reference to `_close_r'
C:\WinARM\arm-elf\lib\libc.a(lib_a-stdio.o): In function `__sseek':
stdio.c:(.text+0x30): undefined reference to `_lseek_r'
C:\WinARM\arm-elf\lib\libc.a(lib_a-stdio.o): In function `__swrite':
stdio.c:(.text+0x90): undefined reference to `_lseek_r'
stdio.c:(.text+0xb4): undefined reference to `_write_r'
C:\WinARM\arm-elf\lib\libc.a(lib_a-stdio.o): In function `__sread':
stdio.c:(.text+0xd8): undefined reference to `_read_r'
C:\WinARM\arm-elf\lib\libc.a(lib_a-syswrite.o): In function `write':
syswrite.c:(.text+0x24): undefined reference to `_write_r'
C:\WinARM\bin\arm-elf-ld.EXE: link errors found, deleting executable `testpin.el
f'
NMAKE : fatal error U1077: 'C:\WinARM\bin\arm-elf-ld.EXE' : return code '0x1'
Stop.

Reply

Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]




Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.


webmaster@embdev.netContactAdvertising on EmbDev.net