[En-Nut-Discussion] Realy strange linker problem with NutOS 4.4.0 for Ethernut 3.0 (ARM)

Ole Reinhardt ole.reinhardt at embedded-it.de
Mon Feb 11 23:36:05 CET 2008

Hi all,

I have a strange linker problem.

My application uses the phat filesystem and therefor needs the _open,
_close and similar functions.

Everything works fine until I use the strdup() function in my sources.

If I use strdup() anywhere in my code I get the following linker errors:

arm-elf-gcc ../../xxxxxx/logout.o ../../xxxxxx/version.o ....
-mcpu=arm7tdmi -nostartfiles
-T/home/ole/work/xxxxxx/xxxxxx/ethernut-4.4.0/arch/arm/ldscripts/at91_ram.ld -Wl,-Map=xxxxxx.map,--cref,--no-warn-mismatch -L/home/ole/work/xxxxxx/xxxxxx/arm/nut-build/lib -Wl,--start-group /home/ole/work/xxxxxx/xxxxxx/arm/nut-build/lib/nutinit.o  -lnutpro -lnutos -lnutarch -lnutdev -lnutnet -lnutfs -lnutcrt -lm  -Wl,--end-group -o xxxxxx.elf
/opt/arm-elf/lib/gcc/arm-elf/4.1.2/../../../../arm-elf/lib/libc.a(lib_a-syscalls.o): In function `_open':
multiple definition of `_open'
/home/ole/work/xxxxxx/xxxxxx/arm/nut-build/lib/libnutcrt.a(open.o):open.c:(.text+0x0): first defined here
/opt/arm-elf/lib/gcc/arm-elf/4.1.2/../../../../arm-elf/bin/ld: Warning:
size of symbol `_open' changed from 172
in /home/ole/work/xxxxxx/xxxxxx/arm/nut-build/lib/libnutcrt.a(open.o) to
in /opt/arm-elf/lib/gcc/arm-elf/4.1.2/../../../../arm-elf/lib/libc.a(lib_a-syscalls.o)
/opt/arm-elf/lib/gcc/arm-elf/4.1.2/../../../../arm-elf/lib/libc.a(lib_a-syscalls.o): In function `_close':
multiple definition of `_close'
/home/ole/work/xxxxxx/xxxxxx/arm/nut-build/lib/libnutcrt.a(close.o):close.c:(.text+0x0): first defined here

(Sorry for obfuscating file names, but this is a project under NDA)

What in hell triggers this symbol mixup? Does NutOS uses its own strdup
function or the one from newlib? And what could be the reason to link
the lib_a-syscalls.o?

Has anybody experienced similar problems? Again: Without using strdup
everything works fine!

Btw: I'm using a self build arm-elf-gcc (GCC) 4.1.2 toolchain with
newlib-1.15.0 on my Debian/Sid Linux box.


Ole Reinhardt

|                                                             |
| Embedded-IT          Hard- und Softwarelösungen             |
|                                                             |
| Ole Reinhardt        Tel. / Fax:        +49 (0)271  7420433 |
| Luisenstraße 29      Mobil:             +49 (0)177  7420433 |
| 57076 Siegen         eMail:    ole.reinhardt at embedded-it.de |
| Germany              Web:         http://www.embedded-it.de |
|                      UstID / VAT:       DE198944716         |

More information about the En-Nut-Discussion mailing list