[llvm-dev] ARM baremetal linking (original) (raw)

Peter Smith via llvm-dev llvm-dev at lists.llvm.org
Thu Oct 4 03:23:18 PDT 2018


On Thu, 4 Oct 2018 at 10:12, Goran Mekić via llvm-dev <llvm-dev at lists.llvm.org> wrote:

Hello, I'm trying to build an image using LLVM toolchain and one of the problems I have is that I don't know how to link. With GCC toolchain it's this: _arm-none-eabi-ld --entry=start -T/usr/home/meka/repos/nuttx/nuttx/configs/nucleo-f4x1re/scripts/f401re.ld -L"/usr/home/meka/repos/nuttx/nuttx/staging" -L"/usr/home/meka/repos/nuttx/nuttx/arch/arm/src/board" -o "/usr/home/meka/repos/nuttx/nuttx/nuttx" --start-group -lsched -ldrivers -lconfigs -lc -lmm -larch -lxx -lapps -lfs -lbinfmt -lxx -lboard "/usr/lib/libgcc.a" --end-group If I substitute arm-none-eabi-ld with ld.lld, I get the following error: ld.lld: error: target emulation unknown: -m or at least one .o file required I can't figure out what should I give it as argument to -m. Of course, giving it at least one .o file works.

Hello Goran,

At the moment the emulation is just there to tell LLD which target to use [*]. In your case ARM. At the moment LLD accepts armelf and armelf-linux-eabi. However given that LLD can pick up the right target from the object file and you'll need at least one object file to build an image I'd just rely on that and leave the -m argument out.

Peter

[*] I think the suffix _fbsd on the emulation can be used to set the OSABI to ELFOSABI_FREEBSD but it doesn't look like that affects you.

Regards, meka


LLVM Developers mailing list llvm-dev at lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev



More information about the llvm-dev mailing list