[llvm-dev] Compiling for baremetal ARMv4 on Ubuntu Linux
Peter Smith via llvm-dev
llvm-dev at lists.llvm.org
Tue Dec 4 06:54:03 PST 2018
Just a few quick observations.
- It looks like you may have downloaded the linux arm toolchain. For bare
metal you probably wanted the Arm embedded toolchain,
-- That toolchain will have newlib rather than glibc, I don't know whether
it will have one pre-compiled for v4 though. If not you may have to find an
older toolchain or build newlib youtself.
- The bare-metal driver in clang (arm-none-eabi) is not multilib aware and
won't put the paths to the libraries on the link line, the -L flag
-- I have found that following the samples in the gnu embedded toolchain
with gcc using the -v flag to get the paths it is using, then use these
If you can let us know what problems you are seeing building compiler-rt
then we may be able to help. I'm not sure there is anyone building it for
arm v4 so you may be hitting new problems. I'm away at a conference today
and tomorrow but I can try later in the week.
On Tue, 4 Dec 2018 at 12:21, cscheuer via llvm-dev <llvm-dev at lists.llvm.org>
> I am currently trying to compile a pretty simple program to work on an
> experimental board. It contains an (FPGA-version of) an ARMv4 processor.
> So basically, I try this (on my Ubuntu 18.04.1 LTS):
> clang -v --target=arm-none-eabi -c barehello.c -o barehelloCLANG.o
> clang -v --target=arm-none-eabi -c io.c -o io.o
> clang -v --target=arm-none-eabi barehelloCLANG.o io.o -o
> helloCLANGstatic -static -fuse-ld=lld
> Which results in
> clang version 8.0.0 (https://git.llvm.org/git/clang.git/
> Target: arm-none-unknown-eabi
> Thread model: posix
> InstalledDir: /usr/local/my_clang/bin
> "/usr/local/my_clang/bin/ld.lld" barehelloCLANG.o io.o -Bstatic
> -L/usr/local/my_clang/lib/clang/8.0.0/lib/baremetal -lc -lm
> -lclang_rt.builtins-arm.a -o helloCLANGstatic
> ld.lld: error: unable to find library -lc
> ld.lld: error: unable to find library -lm
> ld.lld: error: unable to find library -lclang_rt.builtins-arm.a
> clang-8: error: ld.lld command failed with exit code 1 (use -v to see
> on the linking part. I downloaded a sysroot from
> and tried to include it via --sysroot=/my/path/to/it, but clang acted
> unimpressed with the same errors. So I'm missing clang_rt.builtins-arm.a
> I guess, but that does not exist on my system.
> So next, I tried basically every version of "how to cross-compile
> llvm/clang/compiler-rt" That google came up with, but was not able to
> get a single one to actually work. Any ideas how to get this running?
> Thanks in advance!
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the llvm-dev