New tools build, now get conflicting symbol defns.

Rick Mann rmann@latencyzero.com
Wed Dec 12 12:19:00 GMT 2007


Hi. I've been building for an XScale target for some time now using  
binutils-2.18, gcc-4.2.1, and newlib-1.15.

I built the tools as "arm-elf", and I pass -mcpu=xscale to the builds,  
but in general it worked. Now I've gone and built a new toolsuite  
using binutils-2.17, gcc-4.2.1, and newlib-1.15. This time, it was a  
combined (single tree) build. It seemed to go okay, and a minor change  
to my Makefile (to change arm-elf to xscale-elf) seems to allow  
everything to compile.

But then I run into some link errors.

Before, I provided a certain amount of glue to my build. I defined the  
following symbols in a file "glue.c":

_sbrk()
_exit()
_getpid()
_kill()
isatty()
_read()
_write()
_lseek()
_close()
_fstat()

My implementations of this all worked fine, allowing me to send bytes  
back and forth to the target board.

Now, when I build with the newly-built tools, I get a lot of multiple  
definitions warnings for those symbols above (listed  below). libc.a  
and syscalls.c in newlib seem to have defined them for me, and I'm not  
sure how to get them to not be defined. I could allow multiple defs,  
but then I have to make sure my versions are used. I forgot something  
about "standalone" builds, not sure if there's a different option I  
should be using.

Could someone please suggest a fix for this issue? I'd really just  
like to keep my own defs. I use C++ and C, as well as asm code. I have  
my own linker script. Thank you very much.

-- 
Rick


$ xscale-elf-g++ -Wl,-Map,mapfile.txt -Llib -Xlinker --gc-sections - 
Xlinker --script=link.lds -o h.elf obj/start.o obj/vectors.o src/ 
glue.o src/Assert.o src/Graphics.o src/Interrupts.o src/Particle.o src/ 
ProcUtils.o src/Util.o src/lcd.o src/main.o src/pfd/AirData.o src/pfd/ 
ChangingValue.o src/pfd/GraphicsUtils.o src/pfd/MiscUtils.o src/pfd/ 
graphics/Airspeed.o src/pfd/graphics/Altitude.o src/pfd/graphics/HSI.o  
src/pfd/graphics/HSI2.o src/pfd/graphics/Horizon.o src/pfd/graphics/ 
Instrument.o src/pfd/graphics/Rect.o src/pfd/graphics/Renderable.o src/ 
pfd/graphics/TapeDisplay.o  -lgui64 -lm
/usr/local/xscale-gcc-test/lib/gcc/xscale-elf/4.2.1/../../../../xscale- 
elf/lib/libc.a(lib_a-syscalls.o): In function `_kill':
../../../../../../combined/newlib/libc/sys/arm/syscalls.c:444:  
multiple definition of `_kill'
src/glue.o:glue.c:(.text+0xb4): first defined here
/usr/local/xscale-gcc-test/lib/gcc/xscale-elf/4.2.1/../../../../xscale- 
elf/bin/ld: Warning: size of symbol `_kill' changed from 48 in src/ 
glue.o to 84 in /usr/local/xscale-gcc-test/lib/gcc/xscale-elf/ 
4.2.1/../../../../xscale-elf/lib/libc.a(lib_a-syscalls.o)
/usr/local/xscale-gcc-test/lib/gcc/xscale-elf/4.2.1/../../../../xscale- 
elf/lib/libc.a(lib_a-syscalls.o): In function `_exit':
../../../../../../combined/newlib/libc/sys/arm/syscalls.c:465:  
multiple definition of `_exit'
src/glue.o:glue.c:(.text+0x6c): first defined here
/usr/local/xscale-gcc-test/lib/gcc/xscale-elf/4.2.1/../../../../xscale- 
elf/bin/ld: Warning: size of symbol `_exit' changed from 40 in src/ 
glue.o to 8 in /usr/local/xscale-gcc-test/lib/gcc/xscale-elf/ 
4.2.1/../../../../xscale-elf/lib/libc.a(lib_a-syscalls.o)
/usr/local/xscale-gcc-test/lib/gcc/xscale-elf/4.2.1/../../../../xscale- 
elf/lib/libc.a(lib_a-syscalls.o): In function `_getpid':
../../../../../../combined/newlib/libc/sys/arm/syscalls.c:473:  
multiple definition of `_getpid'
src/glue.o:glue.c:(.text+0x94): first defined here
/usr/local/xscale-gcc-test/lib/gcc/xscale-elf/4.2.1/../../../../xscale- 
elf/bin/ld: Warning: size of symbol `_getpid' changed from 32 in src/ 
glue.o to 8 in /usr/local/xscale-gcc-test/lib/gcc/xscale-elf/ 
4.2.1/../../../../xscale-elf/lib/libc.a(lib_a-syscalls.o)
/usr/local/xscale-gcc-test/lib/gcc/xscale-elf/4.2.1/../../../../xscale- 
elf/lib/libc.a(lib_a-syscalls.o): In function `_sbrk':
../../../../../../combined/newlib/libc/sys/arm/syscalls.c:482:  
multiple definition of `_sbrk'
src/glue.o:glue.c:(.text+0x0): first defined here
/usr/local/xscale-gcc-test/lib/gcc/xscale-elf/4.2.1/../../../../xscale- 
elf/bin/ld: Warning: size of symbol `_sbrk' changed from 108 in src/ 
glue.o to 84 in /usr/local/xscale-gcc-test/lib/gcc/xscale-elf/ 
4.2.1/../../../../xscale-elf/lib/libc.a(lib_a-syscalls.o)
/usr/local/xscale-gcc-test/lib/gcc/xscale-elf/4.2.1/../../../../xscale- 
elf/lib/libc.a(lib_a-syscalls.o): In function `_close':
../../../../../../combined/newlib/libc/sys/arm/syscalls.c:434:  
multiple definition of `_close'
src/glue.o:glue.c:(.text+0x294): first defined here
/usr/local/xscale-gcc-test/lib/gcc/xscale-elf/4.2.1/../../../../xscale- 
elf/bin/ld: Warning: size of symbol `_close' changed from 32 in src/ 
glue.o to 16 in /usr/local/xscale-gcc-test/lib/gcc/xscale-elf/ 
4.2.1/../../../../xscale-elf/lib/libc.a(lib_a-syscalls.o)
/usr/local/xscale-gcc-test/lib/gcc/xscale-elf/4.2.1/../../../../xscale- 
elf/lib/libc.a(lib_a-syscalls.o): In function `_write':
../../../../../../combined/newlib/libc/sys/arm/syscalls.c:335:  
multiple definition of `_write'
src/glue.o:glue.c:(.text+0x1c4): first defined here
/usr/local/xscale-gcc-test/lib/gcc/xscale-elf/4.2.1/../../../../xscale- 
elf/bin/ld: Warning: size of symbol `_write' changed from 148 in src/ 
glue.o to 112 in /usr/local/xscale-gcc-test/lib/gcc/xscale-elf/ 
4.2.1/../../../../xscale-elf/lib/libc.a(lib_a-syscalls.o)
/usr/local/xscale-gcc-test/lib/gcc/xscale-elf/4.2.1/../../../../xscale- 
elf/lib/libc.a(lib_a-syscalls.o): In function `_lseek':
../../../../../../combined/newlib/libc/sys/arm/syscalls.c:303:  
multiple definition of `_lseek'
src/glue.o:glue.c:(.text+0x258): first defined here
/usr/local/xscale-gcc-test/lib/gcc/xscale-elf/4.2.1/../../../../xscale- 
elf/bin/ld: Warning: size of symbol `_lseek' changed from 60 in src/ 
glue.o to 16 in /usr/local/xscale-gcc-test/lib/gcc/xscale-elf/ 
4.2.1/../../../../xscale-elf/lib/libc.a(lib_a-syscalls.o)
/usr/local/xscale-gcc-test/lib/gcc/xscale-elf/4.2.1/../../../../xscale- 
elf/lib/libc.a(lib_a-syscalls.o): In function `_read':
../../../../../../combined/newlib/libc/sys/arm/syscalls.c:230:  
multiple definition of `_read'
src/glue.o:glue.c:(.text+0x104): first defined here
/usr/local/xscale-gcc-test/lib/gcc/xscale-elf/4.2.1/../../../../xscale- 
elf/bin/ld: Warning: size of symbol `_read' changed from 192 in src/ 
glue.o to 108 in /usr/local/xscale-gcc-test/lib/gcc/xscale-elf/ 
4.2.1/../../../../xscale-elf/lib/libc.a(lib_a-syscalls.o)
/usr/local/xscale-gcc-test/lib/gcc/xscale-elf/4.2.1/../../../../xscale- 
elf/lib/libc.a(lib_a-syscalls.o): In function `_fstat':
../../../../../../combined/newlib/libc/sys/arm/syscalls.c:512:  
multiple definition of `_fstat'
src/glue.o:glue.c:(.text+0x2b4): first defined here
/usr/local/xscale-gcc-test/lib/gcc/xscale-elf/4.2.1/../../../../xscale- 
elf/bin/ld: Warning: size of symbol `_fstat' changed from 64 in src/ 
glue.o to 48 in /usr/local/xscale-gcc-test/lib/gcc/xscale-elf/ 
4.2.1/../../../../xscale-elf/lib/libc.a(lib_a-syscalls.o)
/usr/local/xscale-gcc-test/lib/gcc/xscale-elf/4.2.1/../../../../xscale- 
elf/lib/libc.a(lib_a-syscalls.o): In function `isatty':
../../../../../../combined/newlib/libc/sys/arm/syscalls.c:616:  
multiple definition of `isatty'
src/glue.o:glue.c:(.text+0xe4): first defined here
/usr/local/xscale-gcc-test/lib/gcc/xscale-elf/4.2.1/../../../../xscale- 
elf/bin/ld: Warning: size of symbol `isatty' changed from 32 in src/ 
glue.o to 56 in /usr/local/xscale-gcc-test/lib/gcc/xscale-elf/ 
4.2.1/../../../../xscale-elf/lib/libc.a(lib_a-syscalls.o)



More information about the Newlib mailing list