1

Trying to figure out a way to link object files that I've built with arm-none-eabi-ld

Here's a directory structure for my build

Application - main.c - start.s - linker.ld

build - main.o - start.o

I just typed this command to make an executable.

Harrys-MacBook-Pro:FreeRTOS-CortexA15 kwooly$ arm-none-eabi-ld -T Application/linker.ld -lc build/start.o build/main.o -o kernel.elf

and I got following error.

arm-none-eabi-ld: cannot find start.o

Is there any way to tell ld that the start.o is in the build directory?

I've tried -L option but wasn't really good.

build/start.o: In function _start': (.text+0x0): multiple definition of_start' build/start.o:(.text+0x0): first defined here Harrys-MacBook-Pro:FreeRTOS-CortexA15 kwooly$

Harry
  • 709
  • 1
  • 6
  • 16
  • The `ld' message is saying you have a 'start.o' in your main directory (with linker.ld). Also, you linker.ld might be specifying files to link (as well as command line). Either post the full linker.ld or any relevant file name related info in the linker.ld. – artless noise May 04 '17 at 12:45

1 Answers1

-1

This question is quite similar with this one,arm-none-eabi-ld: cannot find -lc. Therefore, you could try to reorder it, such as $arm-none-eabi-ld build/start.o build/main.o -T Application/linker.ld -lc -o kernel.elf.

Community
  • 1
  • 1
yenWu
  • 46
  • 5