This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: ARM newlib oddity


On Sun, Oct 9, 2011 at 6:48 AM, Daniel O'Connor <doconnor@gsoft.com.au> wrote:
> Hi,
> I am using newlib on an ARM Cortex-M3 CPU (STM32F103) built with MacPorts (as part of the arm-none-eabi-gcc port).
>
> I find that when I try and use time() that a syscalls file gets linked in which conflicts with the one I am supplying.
>
> The odd thing is that it doesn't link this in if I use, say fputs.. Only (so far anyway) for time().
>
> Is there a way of suppressing this behaviour? i.e. I want to supply my own syscall file.
>
> The link output is like so..
> [ur 9:15] ~/projects/stm32test >bsdmake
> arm-none-eabi-gcc -nostartfiles -Wl,--gc-sections -lc -lm -lgcc -mcpu=cortex-m3 -mthumb -g -Os -fno-exceptions -L -nostartfiles -Wl,--gc-sections,-T/Users/darius/projects/stm32test/STM32F10x_512k_64k_flash.ld main.o comm.o syscalls.o startup_stm32f10x_md_mthomas.o core_cm3.o system_stm32f10x.o stm32f10x_usart.o stm32f10x_flash.o stm32f10x_gpio.o stm32f10x_rcc.o stm32f10x_spi.o stm32f10x_rtc.o stm32f10x_bkp.o stm32f10x_pwr.o stm32f10x_dma.o stm32f10x_tim.o misc.o -Wl,-Map=main.map,--cref -o main.elf
> /opt/local/lib/gcc/arm-none-eabi/4.6.1/../../../../arm-none-eabi/lib/thumb/libg.a(lib_a-syscalls.o): In function `_read':
> /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_cross_arm-none-eabi-gcc/arm-none-eabi-gcc/work/build/arm-none-eabi/thumb/newlib/libc/sys/arm/../../../../../../../gcc-4.6.1/newlib/libc/sys/arm/syscalls.c:230: multiple definition of `_read'
> syscalls.o:/Users/darius/projects/stm32test/syscalls.c:110: first defined here
> /opt/local/lib/gcc/arm-none-eabi/4.6.1/../../../../arm-none-eabi/lib/thumb/libg.a(lib_a-syscalls.o): In function `_lseek':
> /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_cross_arm-none-eabi-gcc/arm-none-eabi-gcc/work/build/arm-none-eabi/thumb/newlib/libc/sys/arm/../../../../../../../gcc-4.6.1/newlib/libc/sys/arm/syscalls.c:303: multiple definition of `_lseek'
> syscalls.o:/Users/darius/projects/stm32test/syscalls.c:102: first defined here
> /opt/local/lib/gcc/arm-none-eabi/4.6.1/../../../../arm-none-eabi/lib/thumb/libg.a(lib_a-syscalls.o): In function `_write':
> /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_cross_arm-none-eabi-gcc/arm-none-eabi-gcc/work/build/arm-none-eabi/thumb/newlib/libc/sys/arm/../../../../../../../gcc-4.6.1/newlib/libc/sys/arm/syscalls.c:335: multiple definition of `_write'
> syscalls.o:/Users/darius/projects/stm32test/syscalls.c:113: first defined here
> /opt/local/lib/gcc/arm-none-eabi/4.6.1/../../../../arm-none-eabi/lib/thumb/libg.a(lib_a-syscalls.o): In function `_close':
> /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_cross_arm-none-eabi-gcc/arm-none-eabi-gcc/work/build/arm-none-eabi/thumb/newlib/libc/sys/arm/../../../../../../../gcc-4.6.1/newlib/libc/sys/arm/syscalls.c:434: multiple definition of `_close'
> syscalls.o:/Users/darius/projects/stm32test/syscalls.c:81: first defined here
> /opt/local/lib/gcc/arm-none-eabi/4.6.1/../../../../arm-none-eabi/lib/thumb/libg.a(lib_a-syscalls.o): In function `_kill':
> /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_cross_arm-none-eabi-gcc/arm-none-eabi-gcc/work/build/arm-none-eabi/thumb/newlib/libc/sys/arm/../../../../../../../gcc-4.6.1/newlib/libc/sys/arm/syscalls.c:440: multiple definition of `_kill'
> syscalls.o:/Users/darius/projects/stm32test/syscalls.c:27: first defined here
> /opt/local/lib/gcc/arm-none-eabi/4.6.1/../../../../arm-none-eabi/lib/thumb/libg.a(lib_a-syscalls.o): In function `_exit':
> /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_cross_arm-none-eabi-gcc/arm-none-eabi-gcc/work/build/arm-none-eabi/thumb/newlib/libc/sys/arm/../../../../../../../gcc-4.6.1/newlib/libc/sys/arm/syscalls.c:459: multiple definition of `_exit'
> syscalls.o:/Users/darius/projects/stm32test/syscalls.c:31: first defined here
> /opt/local/lib/gcc/arm-none-eabi/4.6.1/../../../../arm-none-eabi/lib/thumb/libg.a(lib_a-syscalls.o): In function `_getpid':
> /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_cross_arm-none-eabi-gcc/arm-none-eabi-gcc/work/build/arm-none-eabi/thumb/newlib/libc/sys/arm/../../../../../../../gcc-4.6.1/newlib/libc/sys/arm/syscalls.c:473: multiple definition of `_getpid'
> syscalls.o:/Users/darius/projects/stm32test/syscalls.c:40: first defined here
> /opt/local/lib/gcc/arm-none-eabi/4.6.1/../../../../arm-none-eabi/lib/thumb/libg.a(lib_a-syscalls.o): In function `_sbrk':
> /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_cross_arm-none-eabi-gcc/arm-none-eabi-gcc/work/build/arm-none-eabi/thumb/newlib/libc/sys/arm/../../../../../../../gcc-4.6.1/newlib/libc/sys/arm/syscalls.c:477: multiple definition of `_sbrk'
> syscalls.o:/Users/darius/projects/stm32test/syscalls.c:58: first defined here
> /opt/local/lib/gcc/arm-none-eabi/4.6.1/../../../../arm-none-eabi/lib/thumb/libg.a(lib_a-syscalls.o): In function `_fstat':
> /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_cross_arm-none-eabi-gcc/arm-none-eabi-gcc/work/build/arm-none-eabi/thumb/newlib/libc/sys/arm/../../../../../../../gcc-4.6.1/newlib/libc/sys/arm/syscalls.c:512: multiple definition of `_fstat'
> syscalls.o:/Users/darius/projects/stm32test/syscalls.c:86: first defined here
> /opt/local/lib/gcc/arm-none-eabi/4.6.1/../../../../arm-none-eabi/lib/thumb/libg.a(lib_a-syscalls.o): In function `_isatty':
> /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_cross_arm-none-eabi-gcc/arm-none-eabi-gcc/work/build/arm-none-eabi/thumb/newlib/libc/sys/arm/../../../../../../../gcc-4.6.1/newlib/libc/sys/arm/syscalls.c:616: multiple definition of `_isatty'
> syscalls.o:/Users/darius/projects/stm32test/syscalls.c:94: first defined here
> /opt/local/lib/gcc/arm-none-eabi/4.6.1/../../../../arm-none-eabi/lib/thumb/libg.a(lib_a-syscalls.o): In function `_sbrk':
> syscalls.c:(.text+0x414): undefined reference to `end'
> collect2: ld returned 1 exit status
> *** Error code 1
>
> Stop in /Users/darius/projects/stm32test.
>
>
Hi Daniel,
It seems to me this version newlib is configured with
"--enable-newlib-suppiled-syscalls",
that's why it contains `_read ' in libg.a(lib_a-syscalls.o).
IMHO, you could build newlib by yourself with this tool-chain,
configuring with option "--disable-newlib-supplied-syscalls".
Then check the link command line and link scripts, make sure they do
not specify libgloss libraries, such as librdimon/librdpmon, etc.

Thanks

-- 
Regards.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]