1

This is my linker command:

arm-none-eabi-ld boot_and_link/startup.o drivers/gpio.o ../programs/dmips/dhry_1.o ../programs/dmips/dhry_2.o -nostartfiles -T boot_and_link/linker.ld -L/usr/lib/gcc/arm-none-eabi/4.8/armv6-m -lgcc -L/usr/lib/arm-none-eabi/newlib/armv6-m/ -lc -L/usr/lib/arm-none-eabi/newlib/armv6-m/ -lnosys -o ../programs/dmips/dmips.elf

I'm using, my own startup code and my own linker script since I'm doing a bare metal compilation in an attempt to run Dhrystone benchmark on an Cortex M0 processor.

These are the errors I get:

/usr/lib/arm-none-eabi/newlib/armv6-m//libc.a(lib_a-fvwrite.o): In function `__sfvwrite_r':
/home/tin/projects/debian/arm-toolchain/collab-maint/newlib/build/arm-none-eabi/armv6-m/newlib/libc/stdio/../../../../../../newlib/libc/stdio/fvwrite.c:196: undefined reference to `__aeabi_idiv'
/usr/lib/arm-none-eabi/newlib/armv6-m//libnosys.a(sbrk.o): In function `_sbrk':
/home/tin/projects/debian/arm-toolchain/collab-maint/newlib/build/arm-none-eabi/armv6-m/libgloss/libnosys/../../../../../libgloss/libnosys/sbrk.c:14: undefined reference to `end'

The end symbol, as I understand it, should be the end of the heap right? I can get rid of it by setting it in the linker script.

However the other one is wierd. That symbol is declared in libgcc.a which is included.

In my opinion the problem is a simple path conflict: whatever fvwrite.o is, it wants to use that symbol and the linker is not looking for it in libgcc.a which exists and is added as parameter library. Keep in mind this is just a thought. I don't really know what is going on.

Any ideas?

aarelovich
  • 5,140
  • 11
  • 55
  • 106
  • The order you list things is important. Try `-lc` **before** `-lgcc` for instance. Your question appears to have nothing directly related to ARM programming. – artless noise Apr 23 '15 at 14:59
  • possible duplicate of [What is an undefined reference/unresolved external symbol error and how do I fix it?](http://stackoverflow.com/questions/12573816/what-is-an-undefined-reference-unresolved-external-symbol-error-and-how-do-i-fix) – Notlikethat Apr 23 '15 at 21:04

0 Answers0