[llvm-dev] ARM baremetal linking
Goran Mekić via llvm-dev
llvm-dev at lists.llvm.org
Fri Oct 5 11:52:16 PDT 2018
On Thu, Oct 04, 2018 at 10:25:41AM +0200, Goran Mekić via llvm-dev wrote:
> 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
I lost few days staring at the debugger only to realize that
"/usr/lib/libgcc.a" is my system lib. If I'm right, it comes from
compiler-rt, and what I would need is compiler-rt for baremetal ARM. If
I'm right, as CFLAGS for crosscompile are
-target arm-none-eabi -march=armv7-m -mcpu=cortex-m4
that's the exact chip I would need to build compiler-rt for. How could
this be done? Also, if anyone is working on compiling for armv7-m without
using GNU tools, I'm more than interested in joining forces (hopefully
someone has success).
The reason I think this is true are these commands:
clang -print-libgcc-file-name # using the system lib
/usr/lib/libgcc.a
clang -target arm-none-eabi -print-libgcc-file-name # using the baremetal lib
/usr/lib/clang/6.0.1/lib/libclang_rt.builtins-arm.a
As that's where "/usr/lib/libgcc.a" in original command comes from, I
really hope I figured this right, but do correct me if I'm wrong.
Regards,
meka
PS. I tried to do the same last year, but I felt I need to learn a lot
before dealing with LLVM-only baremetal development, and I did. If you
feel I need some more info/literature, please do point it out, I'm more
than willing to learn.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20181005/6971e4d9/attachment.sig>
More information about the llvm-dev
mailing list