[llvm-dev] Compiling for baremetal ARMv4 on Ubuntu Linux (original) (raw)

Christian Richter via llvm-dev llvm-dev at lists.llvm.org
Thu Dec 13 04:08:28 PST 2018


Hello Peter and Lists,

thanks a lot, that way it worked out! The final cmake was

cmake -G "Ninja" ../llvm/projects/compiler-rt/ -DCOMPILER_RT_BUILD_BUILTINS=ON -DCOMPILER_RT_BUILD_SANITIZERS=OFF -DCOMPILER_RT_BUILD_XRAY=OFF -DCOMPILER_RT_BUILD_LIBFUZZER=OFF -DCOMPILER_RT_BUILD_PROFILE=OFF -DCMAKE_C_COMPILER=/usr/local/myclang/bin/clang -DCMAKE_AR=/usr/local/myclang/bin/llvm-ar -DCMAKE_NM=/usr/local/myclang/bin/llvm-nm -DCMAKE_RANLIB=/usr/local/myclang/bin/llvm-ranlib -DCMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY -DCMAKE_C_COMPILER_TARGET="arm-linux-gnueabihf" -DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON -DLLVM_CONFIG_PATH=/usr/local/myclang/bin/llvm-config -DCMAKE_ASM_FLAGS="--target=arm-linux-gnueabihf -march=armv7a --gcc-toolchain=/home/crichter/arm-linux-gnueabihf/gcc-arm --sysroot=/home/crichter/arm-linux-gnueabihf/sysroot-glibc/" -DCMAKE_C_FLAGS="--target=arm-linux-gnueabihf -march=armv7a --gcc-toolchain=/home/crichter/arm-linux-gnueabihf/gcc-arm --sysroot=/home/crichter/arm-linux-gnueabihf/sysroot-glibc/"

where sysroot-glibc/ contains sysroot-glibc-8.2-x86_64 and /arm-linux-gnueabihf/gcc-arm contains gcc-arm-8.2 for Aarch32 hard float from https://developer.arm.com/open-source/gnu-toolchain/gnu-a/downloads. This resulted in successfully building libclang_rt.builtins-armhf.a

So next, I tried to use the cmake recipe for BaremetalARM as in the documentation. Therefore, I moved the compiler-rt directory from llvm/projects to llvm/runtimes. I downloaded the latest updates of gcc-arm-none-eabi6/7/8 from https://developer.arm.com/open-source/gnu-toolchain/gnu-rm/downloads and tried to build in a new directory. But whether I gave the -C the path to BaremetalARM.cmake's directory or the file itself, nothing started. I was unsure whether to keep the paths to llvm-ar, llvm-nm and so on as well and whether or not to give the new compiler-rt-directory or the whole llvm-directory as a starting point. Am I using the wrong build directory here? Is this still "Ninja"? The error message (see below) is true: /home/llvm_4rt/llvm/tools/clang/cmake/caches contains no CMakeLists.txt, just the BaremetalARM.cmake among other recipes. Giving -C the file directly just leads to a "this is a file, not a directory" error.

This is (one of my) cmake commands:

root at christian-forschung-virtual-machine:/home/llvm_4rt/buildrecipe# cmake -G "Ninja" ../llvm/runtimes/compiler-rt -DCOMPILER_RT_BUILD_BUILTINS=ON -DCOMPILER_RT_BUILD_SANITIZERS=OFF -DCOMPILER_RT_BUILD_XRAY=OFF -DCOMPILER_RT_BUILD_LIBFUZZER=OFF -DCOMPILER_RT_BUILD_PROFILE=OFF -DCMAKE_C_COMPILER=/usr/local/myclang/bin/clang -DCMAKE_AR=/usr/local/myclang/bin/llvm-ar -DCMAKE_NM=/usr/local/myclang/bin/llvm-nm -DCMAKE_RANLIB=/usr/local/myclang/bin/llvm-ranlib -DCMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY -DCMAKE_C_COMPILER_TARGET="arm-linux-gnueabihf" -DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON -DLLVM_CONFIG_PATH=/usr/local/myclang/bin/llvm-config -DBAREMETAL_ARMV5M_SYSROOT=/home/crichter/Downloads/gcc-arm-none-eabi-5_4-2016q3

-DBAREMETAL_ARMV6M_SYSROOT=/home/crichter/Downloads/gcc-arm-none-eabi-6-2017-q2-update -DBAREMETAL_ARMV7M_SYSROOT=/home/crichter/Downloads/gcc-arm-none-eabi-7-2018-q2-update -C /home/llvm_4rt/llvm/tools/clang/cmake/caches

loading initial cache file /home/llvm_4rt/llvm/tools/clang/cmake/caches CMake Error: Error processing file: /home/llvm_4rt/llvm/tools/clang/cmake/caches CMake Error: The source directory "/home/llvm_4rt/llvm/tools/clang/cmake/caches" does not appear to contain CMakeLists.txt. Specify --help for usage, or press the help button on the CMake GUI.

So I'm obviously using it wrong, would appreciate any pointers in the right direction! Christian

On 10.12.2018 17:59, Peter Smith wrote:

Hello Christian,

Yes it does look like clang will add /usr/local/include unless --nostdinc is used, although that will mean skipping a lot of other include directories that clang will implicitly add based on the target. I can think of a couple of ways to proceed: 1.) use -nostdinc and add in the directories you need manually 2.) use a cross gcc toolchain in a different directory such as one from (https://developer.arm.com/open-source/gnu-toolchain/gnu-a/downloads) and use --gcc-toolchain and --sysroot. I must admit I've only ever done 2.) myself as I've wanted to make sure I've not inadvertently depended on something on my machine. Apologies for the confusion. Peter On Mon, 10 Dec 2018 at 16:05, Christian Richter <christian.richter at hsu-hh.de> wrote: Hello again!

Tried out the small Hello World Setup, worked as intended: root at christian-forschung-virtual-machine:/home/progs# clang -v --target=arm-linux-gnueabihf hello.c -o hello -fuse-ld=lld clang version 8.0.0 (https://git.llvm.org/git/clang.git/ a152c7a4b7ba8f4cb9532ead9a38a7121db43d50) (https://git.llvm.org/git/llvm.git/ 1959ce6f3e01241919968ac1911fd45660239d23) Target: arm-unknown-linux-gnueabihf Thread model: posix InstalledDir: /usr/local/myclang/bin Found candidate GCC installation: /usr/lib/gcc-cross/arm-linux-gnueabihf/7 Found candidate GCC installation: /usr/lib/gcc-cross/arm-linux-gnueabihf/7.3.0 Selected GCC installation: /usr/lib/gcc-cross/arm-linux-gnueabihf/7.3.0 Candidate multilib: .;@m32 Selected multilib: .;@m32 "/usr/local/myclang/bin/clang-8" -cc1 -triple armv6kz-unknown-linux-gnueabihf -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -discard-value-names -main-file-name hello.c -mrelocation-model static -mthread-model posix -mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases -fuse-init-array -target-cpu arm1176jzf-s -target-feature +strict-align -target-abi aapcs-linux -mfloat-abi hard -fallow-half-arguments-and-returns -dwarf-column-info -debugger-tuning=gdb -v -resource-dir /usr/local/myclang/lib/clang/8.0.0 -internal-isystem /usr/local/include -internal-isystem /usr/local/myclang/lib/clang/8.0.0/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -fdebug-compilation-dir /home/progs -ferror-limit 19 -fmessage-length 202 -fno-signed-char -fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics -o /tmp/hello-98a3a7.o -x c hello.c -faddrsig clang -cc1 version 8.0.0 based upon LLVM 8.0.0svn default target x8664-unknown-linux-gnu ignoring nonexistent directory "/include" #include "..." search starts here: #include <...> search starts here: /usr/local/include /usr/local/myclang/lib/clang/8.0.0/include /usr/include End of search list. "/usr/local/myclang/bin/ld.lld" -EL -z relro -X --hash-style=gnu --eh-frame-hdr -m armelflinuxeabi -dynamic-linker /lib/ld-linux-armhf.so.3 -o hello /usr/lib/gcc-cross/arm-linux-gnueabihf/7.3.0/../../../../arm-linux-gnueabihf/lib/../lib/crt1.o /usr/lib/gcc-cross/arm-linux-gnueabihf/7.3.0/../../../../arm-linux-gnueabihf/lib/../lib/crti.o /usr/lib/gcc-cross/arm-linux-gnueabihf/7.3.0/crtbegin.o -L/usr/lib/gcc-cross/arm-linux-gnueabihf/7.3.0 -L/usr/lib/gcc-cross/arm-linux-gnueabihf/7.3.0/../../../../arm-linux-gnueabihf/lib/../lib -L/usr/lib/gcc-cross/arm-linux-gnueabihf/7.3.0/../../../../lib -L/usr/local/myclang/bin/../lib -L/lib/../lib -L/usr/lib/../lib -L/usr/lib/arm-linux-gnueabihf/../../lib -L/usr/lib/gcc-cross/arm-linux-gnueabihf/7.3.0/../../../../arm-linux-gnueabihf/lib -L/usr/lib/gcc-cross/arm-linux-gnueabihf/7.3.0/../../.. -L/usr/local/myclang/bin/../lib -L/lib -L/usr/lib /tmp/hello-98a3a7.o -lgcc --as-needed -lgccs --no-as-needed -lc -lgcc --as-needed -lgccs --no-as-needed /usr/lib/gcc-cross/arm-linux-gnueabihf/7.3.0/crtend.o /usr/lib/gcc-cross/arm-linux-gnueabihf/7.3.0/../../../../arm-linux-gnueabihf/lib/../lib/crtn.o root at christian-forschung-virtual-machine:/home/progs# qemu-arm -L /usr/arm-linux-gnueabihf hello Hello, World! So far, so good. The Paths written more readable seem to be /usr/local/myclang/lib, /lib, /usr/lib, /usr/arm-linux-gnueabihf/lib, so no surprised there. Then I added the suggested -DCMAKEASMFLAGS to the cmake for the standalone compiler-rt build while leaving out the --sysroot and --gcc-toolchain: cmake -G "Ninja" ../llvm/projects/compiler-rt/ -DCOMPILERRTBUILDBUILTINS=ON -DCOMPILERRTBUILDSANITIZERS=OFF -DCOMPILERRTBUILDXRAY=OFF -DCOMPILERRTBUILDLIBFUZZER=OFF -DCOMPILERRTBUILDPROFILE=OFF -DCMAKECCOMPILER=/usr/local/myclang/bin/clang -DCMAKEAR=/usr/local/myclang/bin/llvm-ar -DCMAKENM=/usr/local/myclang/bin/llvm-nm -DCMAKERANLIB=/usr/local/myclang/bin/llvm-ranlib -DCMAKETRYCOMPILETARGETTYPE=STATICLIBRARY -DCMAKECCOMPILERTARGET="arm-linux-gnueabihf" -DCOMPILERRTDEFAULTTARGETONLY=ON -DLLVMCONFIGPATH=/usr/local/myclang/bin/llvm-config -DCMAKEASMFLAGS="--target=arm-linux-gnueabihf -march=armv7a" -DCMAKECFLAGS="--target=arm-linux-gnueabihf -march=armv7a" now "ninja builtins" at least starts working, but fails after a while (see below). The error seems similar to http://lists.llvm.org/pipermail/llvm-dev/2011-September/043289.html to me, so it might still be some variant of the problem from before: Using a x86-header where an ARM one would be needed. The ninja builtins output: root at christian-forschung-virtual-machine:/home/llvmall/buildrtonly# ninja builtins [147/207] Building C object lib/builtins/CMakeFiles/clangrt.builtins-armhf.dir/emutls.c.o FAILED: lib/builtins/CMakeFiles/clangrt.builtins-armhf.dir/emutls.c.o /usr/local/myclang/bin/clang --target=arm-linux-gnueabihf -DVISIBILITYHIDDEN --target=arm-linux-gnueabihf -march=armv7a -Wall -Wno-unused-parameter -fno-lto -std=c11 -fPIC -fno-builtin -fvisibility=hidden -fomit-frame-pointer -fomit-frame-pointer -DCOMPILERRTARMHFTARGET -MD -MT lib/builtins/CMakeFiles/clangrt.builtins-armhf.dir/emutls.c.o -MF lib/builtins/CMakeFiles/clangrt.builtins-armhf.dir/emutls.c.o.d -o lib/builtins/CMakeFiles/clangrt.builtins-armhf.dir/emutls.c.o -c /home/llvmall/llvm/projects/compiler-rt/lib/builtins/emutls.c In file included from /home/llvmall/llvm/projects/compiler-rt/lib/builtins/emutls.c:41: /usr/include/pthread.h:682:6: error: 'regparm' is not valid on this platform _cleanupfctattribute; ^~~~~~~~~~~~~~~~~~~~~~~ _/usr/include/bits/pthreadtypes-arch.h:103:50: note: expanded from macro 'cleanupfctattribute' _# define cleanupfctattribute attribute ((regparm (1))) ^ ~ In file included from /home/llvmall/llvm/projects/compiler-rt/lib/builtins/emutls.c:41: /usr/include/pthread.h:694:3: error: 'regparm' is not valid on this platform _cleanupfctattribute; ^~~~~~~~~~~~~~~~~~~~~~~ _/usr/include/bits/pthreadtypes-arch.h:103:50: note: expanded from macro 'cleanupfctattribute' _# define cleanupfctattribute attribute ((regparm (1))) ^ ~ In file included from /home/llvmall/llvm/projects/compiler-rt/lib/builtins/emutls.c:41: /usr/include/pthread.h:735:6: error: 'regparm' is not valid on this platform _cleanupfctattribute attribute ((noreturn)) ^~~~~~~~~~~~~~~~~~~~~~~ _/usr/include/bits/pthreadtypes-arch.h:103:50: note: expanded from macro 'cleanupfctattribute' _# define cleanupfctattribute attribute ((regparm (1))) ^ ~ 3 errors generated. [148/207] Building C object lib/builtins/CMakeFiles/clangrt.builtins-armhf.dir/gccpersonalityv0.c.o /home/llvmall/llvm/projects/compiler-rt/lib/builtins/gccpersonalityv0.c:148:47: warning: declaration of 'struct UnwindException' will not be visible outside of this function [-Wvisibility] _UnwindReasonCode gnuunwindframe(struct UnwindException *, ^ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/gccpersonalityv0.c:153:23: warning: declaration of 'struct UnwindException' will not be visible outside of this function [-Wvisibility] continueUnwind(struct UnwindException *exceptionObject, ^ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/gccpersonalityv0.c:160:28: warning: incompatible pointer types passing 'struct UnwindException *' to parameter of type 'struct UnwindException *' [-Wincompatible-pointer-types] _if (gnuunwindframe(exceptionObject, context) != URCOK) ^~~~~~~~~~~~~~~ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/gccpersonalityv0.c:148:66: note: passing argument to parameter here _UnwindReasonCode gnuunwindframe(struct UnwindException *, ^ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/gccpersonalityv0.c:184:38: warning: declaration of 'struct UnwindException' will not be visible outside of this function [-Wvisibility] UnwindState state, struct UnwindException *exceptionObject, ^ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/gccpersonalityv0.c:202:31: warning: incompatible pointer types passing 'struct UnwindException *' to parameter of type 'struct UnwindException *' [-Wincompatible-pointer-types] return continueUnwind(exceptionObject, context); ^~~~~~~~~~~~~~~ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/gccpersonalityv0.c:153:42: note: passing argument to parameter 'exceptionObject' here continueUnwind(struct UnwindException *exceptionObject, ^ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/gccpersonalityv0.c:207:31: warning: incompatible pointer types passing 'struct UnwindException *' to parameter of type 'struct UnwindException *' [-Wincompatible-pointer-types] return continueUnwind(exceptionObject, context); ^~~~~~~~~~~~~~~ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/gccpersonalityv0.c:153:42: note: passing argument to parameter 'exceptionObject' here continueUnwind(struct UnwindException *exceptionObject, ^ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/gccpersonalityv0.c:250:27: warning: incompatible pointer types passing 'struct UnwindException *' to parameter of type 'struct UnwindException *' [-Wincompatible-pointer-types] return continueUnwind(exceptionObject, context); ^~~~~~~~~~~~~~~ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/gccpersonalityv0.c:153:42: note: passing argument to parameter 'exceptionObject' here continueUnwind(struct UnwindException *exceptionObject, ^ 7 warnings generated. [152/207] Building ASM object lib/builtins/CMakeFiles/clangrt.builtins-armhf.dir/arm/aeabicdcmp.S.o ninja: build stopped: subcommand failed. Almost there! Thanks in advance! Christian

On 07.12.2018 17:40, Peter Smith wrote: Hello Christian, I've put some comments inline On Fri, 7 Dec 2018 at 15:48, Christian Richter via llvm-dev <llvm-dev at lists.llvm.org> wrote: Hello, on the problems cross-building compiler-rt: Tried to follow https://llvm.org/docs/HowToCrossCompileBuiltinsOnArm.html which lead to this cmake: cmake -G "Ninja" ../llvm/projects/compiler-rt/ -DCOMPILERRTBUILDBUILTINS=ON -DCOMPILERRTBUILDSANITIZERS=OFF -DCOMPILERRTBUILDXRAY=OFF -DCOMPILERRTBUILDLIBFUZZER=OFF -DCOMPILERRTBUILDPROFILE=OFF -DCMAKECCOMPILER=/usr/local/myclang/bin/clang -DCMAKEAR=/usr/local/myclang/bin/llvm-ar -DCMAKENM=/usr/local/myclang/bin/llvm-nm -DCMAKERANLIB=/usr/local/myclang/bin/llvm-ranlib -DCMAKETRYCOMPILETARGETTYPE=STATICLIBRARY -DCMAKECCOMPILERTARGET="arm-linux-gnueabihf" -DCOMPILERRTDEFAULTTARGETONLY=ON -DLLVMCONFIGPATH=/usr/local/myclang/bin/llvm-config -DCMAKECFLAGS="--target=arm-linux-gnueabihf -march=armv7a --gcc-toolchain=/usr/arm-linux-gnueabihf --sysroot=/usr/arm-linux-gnueabihf/lib" Some small notes: - Used -DCMAKETRYCOMPILETARGETTYPE=STATICLIBRARY instead of -DCMAKEEXELINKERFLAGS="-fuse-ld=lld" as Peter Smith suggested because it actually is a library and therefore does not need to be linked. If I do not change that, the cmake does not work (see below). - used -G "Ninja" although not explicitly stated in the tutorial as they use "ninja builtins" next. - had to change --march=armv7a to -march=armv7a as clang did not accept the first one. the cmake was successful, but the ninja builtins was not (see both outputs below). Am I doing the --gcc-toolchain / --sysroot part right? These are just the places where the result of "apt install arm-linux-gnueabihf" lives. cmake output with -DCMAKEEXELINKERFLAGS="-fuse-ld=lld": Thanks for the comments. I will try and revisit that document next week and will post an update. root at christian-forschung-virtual-machine:/home/llvmall/buildrtonly# cmake -G "Ninja" ../llvm/projects/compiler-rt/ -DCOMPILERRTBUILDBUILTINS=ON -DCOMPILERRTBUILDSANITIZERS=OFF -DCOMPILERRTBUILDXRAY=OFF -DCOMPILERRTBUILDLIBFUZZER=OFF -DCOMPILERRTBUILDPROFILE=OFF -DCMAKECCOMPILER=/usr/local/myclang/bin/clang -DCMAKEAR=/usr/local/myclang/bin/llvm-ar -DCMAKENM=/usr/local/myclang/bin/llvm-nm -DCMAKERANLIB=/usr/local/myclang/bin/llvm-ranlib -DCMAKEEXELINKERFLAGS="-fuse-ld=lld" -DCMAKECCOMPILERTARGET="arm-linux-gnueabihf" -DCOMPILERRTDEFAULTTARGETONLY=ON -DLLVMCONFIGPATH=/usr/local/myclang/bin/llvm-config -DCMAKECFLAGS="--target=arm-linux-gnueabihf -march=armv7a --gcc-toolchain=/usr/arm-linux-gnueabihf --sysroot=/usr/arm-linux-gnueabihf/lib" -- The C compiler identification is Clang 8.0.0 -- The CXX compiler identification is Clang 8.0.0 -- The ASM compiler identification is unknown -- Found assembler: /usr/local/myclang/bin/clang -- Check for working C compiler: /usr/local/myclang/bin/clang -- Check for working C compiler: /usr/local/myclang/bin/clang -- broken CMake Error at /usr/share/cmake-3.10/Modules/CMakeTestCCompiler.cmake:52 (message): The C compiler "/usr/local/myclang/bin/clang" is not able to compile a simple test program. It fails with the following output: Change Dir: /home/llvmall/buildrtonly/CMakeFiles/CMakeTmp Run Build Command:"/usr/bin/ninja" "cmTC22d97" [1/2] Building C object CMakeFiles/cmTC22d97.dir/testCCompiler.c.o [2/2] Linking C executable cmTC22d97 FAILED: cmTC22d97 : && /usr/local/myclang/bin/clang --target=arm-linux-gnueabihf --target=arm-linux-gnueabihf -march=armv7a --gcc-toolchain=/usr/arm-linux-gnueabihf --sysroot=/usr/arm-linux-gnueabihf/lib -fuse-ld=lld CMakeFiles/cmTC22d97.dir/testCCompiler.c.o -o cmTC22d97 && : ld.lld: error: cannot open crt1.o: No such file or directory ld.lld: error: cannot open crti.o: No such file or directory ld.lld: error: cannot open crtbegin.o: No such file or directory ld.lld: error: unable to find library -lgcc ld.lld: error: unable to find library -lgccs ld.lld: error: unable to find library -lc ld.lld: error: unable to find library -lgcc ld.lld: error: unable to find library -lgccs ld.lld: error: cannot open crtend.o: No such file or directory ld.lld: error: cannot open crtn.o: No such file or directory clang-8: error: linker command failed with exit code 1 (use -v to see invocation) ninja: build stopped: subcommand failed. CMake will not be able to correctly generate this project. Call Stack (most recent call first): CMakeLists.txt:10 (project) -- Configuring incomplete, errors occurred! See also "/home/llvmall/buildrtonly/CMakeFiles/CMakeOutput.log". See also "/home/llvmall/buildrtonly/CMakeFiles/CMakeError.log". Note: Googling this error suggested installing gcc-multilib or linking "sudo ln -s /usr/lib/x8664-linux-gnu /usr/lib64" (which both did not fix it). But the crt1.o that lld does not seem to find is probably the one from arm-linux-gnueabihf, right? "Locate" says it's right in /usr/arm-linux-gnueabihf/lib. The instructions to use --gcc-toolchain and --sysroot work well for a separate toolchain install directory. They don't seem to work as well for a debian multiarch style installation. I think it will be worth trying to compile helloworld outside of cmake. If you can get that to work then this might help guide us to what flags to use. On my ubuntu 16.04 machine I've got /usr/arm-linux-gnueabihf and /usr/include/arm-linux-gnueabihf and /usr/lib/arm-linux-gnueabihf With this configuration the clang linux driver is able to find the libraries without the sysroot and gcc-toolchain as it is effectively root. Can you try with a simple helloworld program: clang --target=arm-linux-gnueabihf hello.c -o hello -fuse-ld=lld qemu-arm -L /usr/arm-linux-gnueabihf hello If all is well you should see qemu-arm print Hello World. You may need to install the package qemu-user if you've not already done so. With the -v option clang will tell you where it is searching for headers and libraries, I've often found that useful in trying to find out what is going. Assuming that this has worked for you can you try removing "--gcc-toolchain=/usr/arm-linux-gnueabihf --sysroot=/usr/arm-linux-gnueabihf/lib" from your flags in the cmake build. For the errors below it looks like clang is using the default target for assembler, note that --target=arm-linux-gnueabihf is missing. I have seen that before, and the solution I found was to pass -DCMAKEASMFLAGS="same as C flags including --target=arm-linux-gnueabihf and -march=armv7a" Thanks for reporting the problems. If I get time next week I'll have a go at improving the documentation. Peter Thanks so far! Christian cmake output with STATICLIBRARY: -- The C compiler identification is Clang 8.0.0 -- The CXX compiler identification is Clang 8.0.0 -- The ASM compiler identification is Clang -- Found assembler: /usr/local/myclang/bin/clang -- Check for working C compiler: /usr/local/myclang/bin/clang -- Check for working C compiler: /usr/local/myclang/bin/clang -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Check for working CXX compiler: /usr/local/myclang/bin/clang++ -- Check for working CXX compiler: /usr/local/myclang/bin/clang++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done -- Looking for unwind.h -- Looking for unwind.h - found -- Found PythonInterp: /usr/bin/python2.7 (found version "2.7.15") -- Looking for fopen in c -- Looking for fopen in c - found _-- Looking for gccpersonalityv0 in gccs _-- Looking for gccpersonalityv0 in gccs - found -- Performing Test COMPILERRTHASNODEFAULTLIBSFLAG -- Performing Test COMPILERRTHASNODEFAULTLIBSFLAG - Success -- Performing Test COMPILERRTHASFFREESTANDINGFLAG -- Performing Test COMPILERRTHASFFREESTANDINGFLAG - Success -- Performing Test COMPILERRTHASFPICFLAG -- Performing Test COMPILERRTHASFPICFLAG - Success -- Performing Test COMPILERRTHASFPIEFLAG -- Performing Test COMPILERRTHASFPIEFLAG - Success -- Performing Test COMPILERRTHASFNOBUILTINFLAG -- Performing Test COMPILERRTHASFNOBUILTINFLAG - Success -- Performing Test COMPILERRTHASFNOEXCEPTIONSFLAG -- Performing Test COMPILERRTHASFNOEXCEPTIONSFLAG - Success -- Performing Test COMPILERRTHASFOMITFRAMEPOINTERFLAG -- Performing Test COMPILERRTHASFOMITFRAMEPOINTERFLAG - Success -- Performing Test COMPILERRTHASFUNWINDTABLESFLAG -- Performing Test COMPILERRTHASFUNWINDTABLESFLAG - Success -- Performing Test COMPILERRTHASFNOSTACKPROTECTORFLAG -- Performing Test COMPILERRTHASFNOSTACKPROTECTORFLAG - Success -- Performing Test COMPILERRTHASFNOSANITIZESAFESTACKFLAG -- Performing Test COMPILERRTHASFNOSANITIZESAFESTACKFLAG - Success -- Performing Test COMPILERRTHASFVISIBILITYHIDDENFLAG -- Performing Test COMPILERRTHASFVISIBILITYHIDDENFLAG - Success -- Performing Test COMPILERRTHASFRTTIFLAG -- Performing Test COMPILERRTHASFRTTIFLAG - Success -- Performing Test COMPILERRTHASFNORTTIFLAG -- Performing Test COMPILERRTHASFNORTTIFLAG - Success -- Performing Test COMPILERRTHASFNOFUNCTIONSECTIONSFLAG -- Performing Test COMPILERRTHASFNOFUNCTIONSECTIONSFLAG - Success -- Performing Test COMPILERRTHASSTDCXX11FLAG -- Performing Test COMPILERRTHASSTDCXX11FLAG - Success -- Performing Test COMPILERRTHASFTLSMODELINITIALEXEC -- Performing Test COMPILERRTHASFTLSMODELINITIALEXEC - Success -- Performing Test COMPILERRTHASFNOLTOFLAG -- Performing Test COMPILERRTHASFNOLTOFLAG - Success -- Performing Test COMPILERRTHASMSSE3FLAG -- Performing Test COMPILERRTHASMSSE3FLAG - Success -- Performing Test COMPILERRTHASMSSE42FLAG -- Performing Test COMPILERRTHASMSSE42FLAG - Success -- Performing Test COMPILERRTHASSYSROOTFLAG -- Performing Test COMPILERRTHASSYSROOTFLAG - Success -- Performing Test COMPILERRTHASMCRCFLAG -- Performing Test COMPILERRTHASMCRCFLAG - Failed -- Performing Test COMPILERRTHASFVISIBILITYINLINESHIDDENFLAG -- Performing Test COMPILERRTHASFVISIBILITYINLINESHIDDENFLAG - Success -- Performing Test COMPILERRTHASGRFLAG -- Performing Test COMPILERRTHASGRFLAG - Failed -- Performing Test COMPILERRTHASGSFLAG -- Performing Test COMPILERRTHASGSFLAG - Failed -- Performing Test COMPILERRTHASMTFLAG -- Performing Test COMPILERRTHASMTFLAG - Failed -- Performing Test COMPILERRTHASOyFLAG -- Performing Test COMPILERRTHASOyFLAG - Failed -- Performing Test COMPILERRTHASGLINETABLESONLYFLAG -- Performing Test COMPILERRTHASGLINETABLESONLYFLAG - Success -- Performing Test COMPILERRTHASGFLAG -- Performing Test COMPILERRTHASGFLAG - Success -- Performing Test COMPILERRTHASZiFLAG -- Performing Test COMPILERRTHASZiFLAG - Failed -- Performing Test COMPILERRTHASWALLFLAG -- Performing Test COMPILERRTHASWALLFLAG - Success -- Performing Test COMPILERRTHASWERRORFLAG -- Performing Test COMPILERRTHASWERRORFLAG - Success -- Performing Test COMPILERRTHASWFRAMELARGERTHANFLAG -- Performing Test COMPILERRTHASWFRAMELARGERTHANFLAG - Success -- Performing Test COMPILERRTHASWGLOBALCONSTRUCTORSFLAG -- Performing Test COMPILERRTHASWGLOBALCONSTRUCTORSFLAG - Success -- Performing Test COMPILERRTHASWC99EXTENSIONSFLAG -- Performing Test COMPILERRTHASWC99EXTENSIONSFLAG - Success -- Performing Test COMPILERRTHASWGNUFLAG -- Performing Test COMPILERRTHASWGNUFLAG - Success -- Performing Test COMPILERRTHASWNONVIRTUALDTORFLAG -- Performing Test COMPILERRTHASWNONVIRTUALDTORFLAG - Success -- Performing Test COMPILERRTHASWVARIADICMACROSFLAG -- Performing Test COMPILERRTHASWVARIADICMACROSFLAG - Success -- Performing Test COMPILERRTHASWUNUSEDPARAMETERFLAG -- Performing Test COMPILERRTHASWUNUSEDPARAMETERFLAG - Success -- Performing Test COMPILERRTHASWCOVEREDSWITCHDEFAULTFLAG -- Performing Test COMPILERRTHASWCOVEREDSWITCHDEFAULTFLAG - Success -- Performing Test COMPILERRTHASW4FLAG -- Performing Test COMPILERRTHASW4FLAG - Failed -- Performing Test COMPILERRTHASWXFLAG -- Performing Test COMPILERRTHASWXFLAG - Failed -- Performing Test COMPILERRTHASWD4146FLAG -- Performing Test COMPILERRTHASWD4146FLAG - Failed -- Performing Test COMPILERRTHASWD4291FLAG -- Performing Test COMPILERRTHASWD4291FLAG - Failed -- Performing Test COMPILERRTHASWD4221FLAG -- Performing Test COMPILERRTHASWD4221FLAG - Failed -- Performing Test COMPILERRTHASWD4391FLAG -- Performing Test COMPILERRTHASWD4391FLAG - Failed -- Performing Test COMPILERRTHASWD4722FLAG -- Performing Test COMPILERRTHASWD4722FLAG - Failed -- Performing Test COMPILERRTHASWD4800FLAG -- Performing Test COMPILERRTHASWD4800FLAG - Failed -- Looking for func -- Looking for func - found -- Looking for dlopen in dl -- Looking for dlopen in dl - found -- Looking for shmopen in rt -- Looking for shmopen in rt - found -- Looking for pow in m -- Looking for pow in m - found -- Looking for pthreadcreate in pthread -- Looking for pthreadcreate in pthread - found -- Looking for setupterm in terminfo -- Looking for setupterm in terminfo - found _-- Looking for cxathrow in c++ _-- Looking for cxathrow in c++ - found _-- Looking for cxathrow in stdc++ _-- Looking for cxathrow in stdc++ - found -- Compiler-RT supported architectures: armhf -- Performing Test COMPILERRTHASSTDC11FLAG -- Performing Test COMPILERRTHASSTDC11FLAG - Success -- Performing Test COMPILERRTHASVISIBILITYHIDDENFLAG -- Performing Test COMPILERRTHASVISIBILITYHIDDENFLAG - Success -- Performing Test COMPILERRTHASOMITFRAMEPOINTERFLAG -- Performing Test COMPILERRTHASOMITFRAMEPOINTERFLAG - Success -- Performing Test COMPILERRTHASFREESTANDINGFLAG -- Performing Test COMPILERRTHASFREESTANDINGFLAG - Success -- Performing Test COMPILERRTHASXRAYCOMPILERFLAG -- Performing Test COMPILERRTHASXRAYCOMPILERFLAG - Success -- Performing Test COMPILERRTHASATOMICKEYWORD -- Performing Test COMPILERRTHASATOMICKEYWORD - Success -- Builtin supported architectures: armhf -- Looking for VFPFP -- Looking for VFPFP - found -- Configuring done -- Generating done -- Build files have been written to: /home/llvmall/buildrtonly -------------------------------------- ninja output: root at christian-forschung-virtual-machine:/home/llvmall/buildrtonly# ninja builtins [1/207] Building ASM object lib/builtins/CMakeFiles/clangrt.builtins-armhf.dir/arm/bswapsi2.S.o FAILED: lib/builtins/CMakeFiles/clangrt.builtins-armhf.dir/arm/bswapsi2.S.o /usr/local/myclang/bin/clang -DVISIBILITYHIDDEN -fno-lto -std=c11 -fPIC -fno-builtin -fvisibility=hidden -fomit-frame-pointer -fomit-frame-pointer -DCOMPILERRTARMHFTARGET -MD -MT lib/builtins/CMakeFiles/clangrt.builtins-armhf.dir/arm/bswapsi2.S.o -MF lib/builtins/CMakeFiles/clangrt.builtins-armhf.dir/arm/bswapsi2.S.o.d -o lib/builtins/CMakeFiles/clangrt.builtins-armhf.dir/arm/bswapsi2.S.o -c /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/bswapsi2.S /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/bswapsi2.S:12:2: error: unknown directive .syntax unified ^ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/bswapsi2.S:25:3: error: invalid instruction mnemonic 'eor' eor r1, r0, r0, ror #16 ^~~ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/bswapsi2.S:26:15: error: unknown token in expression bic r1, r1, #0xff0000 ^ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/bswapsi2.S:27:3: error: unknown use of instruction mnemonic without a size suffix mov r1, r1, lsr #8 ^ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/bswapsi2.S:28:3: error: invalid instruction mnemonic 'eor' eor r0, r1, r0, ror #8 ^~~ [2/207] Building ASM object lib/builtins/CMakeFiles/clangrt.builtins-armhf.dir/arm/bswapdi2.S.o FAILED: lib/builtins/CMakeFiles/clangrt.builtins-armhf.dir/arm/bswapdi2.S.o /usr/local/myclang/bin/clang -DVISIBILITYHIDDEN -fno-lto -std=c11 -fPIC -fno-builtin -fvisibility=hidden -fomit-frame-pointer -fomit-frame-pointer -DCOMPILERRTARMHFTARGET -MD -MT lib/builtins/CMakeFiles/clangrt.builtins-armhf.dir/arm/bswapdi2.S.o -MF lib/builtins/CMakeFiles/clangrt.builtins-armhf.dir/arm/bswapdi2.S.o.d -o lib/builtins/CMakeFiles/clangrt.builtins-armhf.dir/arm/bswapdi2.S.o -c /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/bswapdi2.S /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/bswapdi2.S:12:2: error: unknown directive .syntax unified ^ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/bswapdi2.S:26:5: error: invalid instruction mnemonic 'eor' eor r2, r0, r0, ror #16 ^~~ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/bswapdi2.S:27:17: error: unknown token in expression bic r2, r2, #0xff0000 ^ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/bswapdi2.S:28:5: error: unknown use of instruction mnemonic without a size suffix mov r2, r2, lsr #8 ^ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/bswapdi2.S:29:5: error: invalid instruction mnemonic 'eor' eor r2, r2, r0, ror #8 ^~~ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/bswapdi2.S:31:5: error: invalid instruction mnemonic 'eor' eor r0, r1, r1, ror #16 ^~~ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/bswapdi2.S:32:17: error: unknown token in expression bic r0, r0, #0xff0000 ^ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/bswapdi2.S:33:5: error: unknown use of instruction mnemonic without a size suffix mov r0, r0, lsr #8 ^ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/bswapdi2.S:34:5: error: invalid instruction mnemonic 'eor' eor r0, r0, r1, ror #8 ^~~ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/bswapdi2.S:39:5: error: unknown use of instruction mnemonic without a size suffix mov r1, r2 ^ [3/207] Building ASM object lib/builtins/CMakeFiles/clangrt.builtins-armhf.dir/arm/comparesf2.S.o FAILED: lib/builtins/CMakeFiles/clangrt.builtins-armhf.dir/arm/comparesf2.S.o /usr/local/myclang/bin/clang -DVISIBILITYHIDDEN -fno-lto -std=c11 -fPIC -fno-builtin -fvisibility=hidden -fomit-frame-pointer -fomit-frame-pointer -DCOMPILERRTARMHFTARGET -MD -MT lib/builtins/CMakeFiles/clangrt.builtins-armhf.dir/arm/comparesf2.S.o -MF lib/builtins/CMakeFiles/clangrt.builtins-armhf.dir/arm/comparesf2.S.o.d -o lib/builtins/CMakeFiles/clangrt.builtins-armhf.dir/arm/comparesf2.S.o -c /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/comparesf2.S /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/comparesf2.S:41:2: error: unknown directive .syntax unified ^ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/comparesf2.S:45:1: error: unexpected token at start of statement _@ int eqsf2(float a, float b) ^ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/comparesf2.S:50:5: error: invalid operand for instruction vmov r0, s0 ^ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/comparesf2.S:51:5: error: invalid operand for instruction vmov r1, s1 ^ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/comparesf2.S:53:5: error: unknown use of instruction mnemonic without a size suffix mov r2, r0, lsl #1 ^ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/comparesf2.S:54:5: error: unknown use of instruction mnemonic without a size suffix mov r3, r1, lsl #1 ^ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/comparesf2.S:56:5: error: invalid instruction mnemonic 'orrs' orrs r12, r2, r3, lsr #1 ^~~~ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/comparesf2.S:58:5: error: invalid instruction mnemonic 'it' it ne ^~ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/comparesf2.S:59:5: error: invalid instruction mnemonic 'eorsne' eorsne r12, r0, r1 ^~~~~~ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/comparesf2.S:61:5: error: invalid instruction mnemonic 'it' it pl ^~ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/comparesf2.S:62:5: error: invalid instruction mnemonic 'subspl' subspl r0, r2, r3 ^~~~~~ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/comparesf2.S:64:5: error: invalid instruction mnemonic 'it' it lo ^~ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/comparesf2.S:65:5: error: invalid instruction mnemonic 'mvnlo' mvnlo r0, r1, asr #31 ^~~~~ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/comparesf2.S:67:5: error: invalid instruction mnemonic 'it' it hi ^~ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/comparesf2.S:68:5: error: invalid instruction mnemonic 'movhi' movhi r0, r1, asr #31 ^~~~~ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/comparesf2.S:70:5: error: invalid instruction mnemonic 'it' it ne ^~ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/comparesf2.S:71:19: error: unknown token in expression orrne r0, r0, #1 ^ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/comparesf2.S:167:13: error: unknown token in expression cmp r2, #0xff000000 ^ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/comparesf2.S:168:5: error: invalid instruction mnemonic 'ite' ite ls ^~~ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/comparesf2.S:169:15: error: unknown token in expression cmpls r3, #0xff000000 ^ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/comparesf2.S:170:15: error: unknown token in expression movhi r0, #1 ^ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/comparesf2.S:179:1: error: unexpected token at start of statement _@ int gtsf2(float a, float b) ^ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/comparesf2.S:188:5: error: invalid operand for instruction vmov r0, s0 ^ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/comparesf2.S:189:5: error: invalid operand for instruction vmov r1, s1 ^ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/comparesf2.S:191:5: error: unknown use of instruction mnemonic without a size suffix mov r2, r0, lsl #1 ^ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/comparesf2.S:192:5: error: unknown use of instruction mnemonic without a size suffix mov r3, r1, lsl #1 ^ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/comparesf2.S:193:5: error: invalid instruction mnemonic 'orrs' orrs r12, r2, r3, lsr #1 ^~~~ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/comparesf2.S:194:5: error: invalid instruction mnemonic 'it' it ne ^~ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/comparesf2.S:195:5: error: invalid instruction mnemonic 'eorsne' eorsne r12, r0, r1 ^~~~~~ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/comparesf2.S:196:5: error: invalid instruction mnemonic 'it' it pl ^~ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/comparesf2.S:197:5: error: invalid instruction mnemonic 'subspl' subspl r0, r2, r3 ^~~~~~ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/comparesf2.S:198:5: error: invalid instruction mnemonic 'it' it lo ^~ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/comparesf2.S:199:5: error: invalid instruction mnemonic 'mvnlo' mvnlo r0, r1, asr #31 ^~~~~ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/comparesf2.S:200:5: error: invalid instruction mnemonic 'it' it hi ^~ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/comparesf2.S:201:5: error: invalid instruction mnemonic 'movhi' movhi r0, r1, asr #31 ^~~~~ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/comparesf2.S:202:5: error: invalid instruction mnemonic 'it' it ne ^~ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/comparesf2.S:203:19: error: unknown token in expression orrne r0, r0, #1 ^ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/comparesf2.S:204:13: error: unknown token in expression cmp r2, #0xff000000 ^ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/comparesf2.S:205:5: error: invalid instruction mnemonic 'ite' ite ls ^~~ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/comparesf2.S:206:15: error: unknown token in expression cmpls r3, #0xff000000 ^ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/comparesf2.S:207:15: error: unknown token in expression movhi r0, #-1 ^ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/comparesf2.S:214:1: error: unexpected token at start of statement _@ int unordsf2(float a, float b) ^ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/comparesf2.S:220:5: error: invalid operand for instruction vmov r0, s0 ^ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/comparesf2.S:221:5: error: invalid operand for instruction vmov r1, s1 ^ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/comparesf2.S:224:18: error: unknown token in expression lsls r2, r0, #1 ^ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/comparesf2.S:225:18: error: unknown token in expression lsls r3, r1, #1 ^ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/comparesf2.S:226:14: error: unknown token in expression movs r0, #0 ^ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/comparesf2.S:277:13: error: unknown token in expression cmp r2, #0xff000000 ^ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/comparesf2.S:278:5: error: invalid instruction mnemonic 'ite' ite ls ^~~ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/comparesf2.S:279:15: error: unknown token in expression cmpls r3, #0xff000000 ^ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/comparesf2.S:280:15: error: unknown token in expression movhi r0, #1 ^ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/comparesf2.S:287:2: error: invalid operand for instruction vmov s0, r0 ^ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/comparesf2.S:288:2: error: invalid operand for instruction vmov s1, r1 ^ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/comparesf2.S:289:2: error: invalid instruction mnemonic 'b' _b unordsf2 ^ [4/207] Building ASM object lib/builtins/CMakeFiles/clangrt.builtins-armhf.dir/arm/clzsi2.S.o FAILED: lib/builtins/CMakeFiles/clangrt.builtins-armhf.dir/arm/clzsi2.S.o /usr/local/myclang/bin/clang -DVISIBILITYHIDDEN -fno-lto -std=c11 -fPIC -fno-builtin -fvisibility=hidden -fomit-frame-pointer -fomit-frame-pointer -DCOMPILERRTARMHFTARGET -MD -MT lib/builtins/CMakeFiles/clangrt.builtins-armhf.dir/arm/clzsi2.S.o -MF lib/builtins/CMakeFiles/clangrt.builtins-armhf.dir/arm/clzsi2.S.o.d -o lib/builtins/CMakeFiles/clangrt.builtins-armhf.dir/arm/clzsi2.S.o -c /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/clzsi2.S /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/clzsi2.S:16:2: error: unknown directive .syntax unified ^ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/clzsi2.S:33:2: error: unknown use of instruction mnemonic without a size suffix mov r1, 1 ^ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/clzsi2.S:35:2: error: invalid instruction mnemonic 'lsrs' lsrs r2, r0, 16; movne r0, r2; addeq r1, 16 ^~~~ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/clzsi2.S:35:19: error: invalid instruction mnemonic 'movne' lsrs r2, r0, 16; movne r0, r2; addeq r1, 16 ^~~~~ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/clzsi2.S:35:33: error: invalid instruction mnemonic 'addeq' lsrs r2, r0, 16; movne r0, r2; addeq r1, 16 ^~~~~ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/clzsi2.S:36:2: error: invalid instruction mnemonic 'lsrs' lsrs r2, r0, 8; movne r0, r2; addeq r1, 8 ^~~~ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/clzsi2.S:36:18: error: invalid instruction mnemonic 'movne' lsrs r2, r0, 8; movne r0, r2; addeq r1, 8 ^~~~~ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/clzsi2.S:36:32: error: invalid instruction mnemonic 'addeq' lsrs r2, r0, 8; movne r0, r2; addeq r1, 8 ^~~~~ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/clzsi2.S:37:2: error: invalid instruction mnemonic 'lsrs' lsrs r2, r0, 4; movne r0, r2; addeq r1, 4 ^~~~ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/clzsi2.S:37:18: error: invalid instruction mnemonic 'movne' lsrs r2, r0, 4; movne r0, r2; addeq r1, 4 ^~~~~ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/clzsi2.S:37:32: error: invalid instruction mnemonic 'addeq' lsrs r2, r0, 4; movne r0, r2; addeq r1, 4 ^~~~~ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/clzsi2.S:38:2: error: invalid instruction mnemonic 'lsrs' lsrs r2, r0, 2; movne r0, r2; addeq r1, 2 ^~~~ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/clzsi2.S:38:18: error: invalid instruction mnemonic 'movne' lsrs r2, r0, 2; movne r0, r2; addeq r1, 2 ^~~~~ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/clzsi2.S:38:32: error: invalid instruction mnemonic 'addeq' lsrs r2, r0, 2; movne r0, r2; addeq r1, 2 ^~~~~ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/clzsi2.S:40:2: error: unknown use of instruction mnemonic without a size suffix sub r0, r1, r0, lsr #1 ^ [5/207] Building ASM object lib/builtins/CMakeFiles/clangrt.builtins-armhf.dir/arm/clzdi2.S.o FAILED: lib/builtins/CMakeFiles/clangrt.builtins-armhf.dir/arm/clzdi2.S.o /usr/local/myclang/bin/clang -DVISIBILITYHIDDEN -fno-lto -std=c11 -fPIC -fno-builtin -fvisibility=hidden -fomit-frame-pointer -fomit-frame-pointer -DCOMPILERRTARMHFTARGET -MD -MT lib/builtins/CMakeFiles/clangrt.builtins-armhf.dir/arm/clzdi2.S.o -MF lib/builtins/CMakeFiles/clangrt.builtins-armhf.dir/arm/clzdi2.S.o.d -o lib/builtins/CMakeFiles/clangrt.builtins-armhf.dir/arm/clzdi2.S.o -c /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/clzdi2.S /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/clzdi2.S:16:2: error: unknown directive .syntax unified ^ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/clzdi2.S:50:2: error: unknown use of instruction mnemonic without a size suffix cmp r1, 0 ^ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/clzdi2.S:51:2: error: invalid instruction mnemonic 'movne' movne r0, r1 ^~~~~ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/clzdi2.S:53:2: error: invalid instruction mnemonic 'movne' movne r1, 1 ^~~~~ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/clzdi2.S:54:2: error: invalid instruction mnemonic 'moveq' moveq r1, 33 ^~~~~ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/clzdi2.S:56:2: error: invalid instruction mnemonic 'lsrs' lsrs r2, r0, 16; movne r0, r2; addeq r1, 16 ^~~~ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/clzdi2.S:56:19: error: invalid instruction mnemonic 'movne' lsrs r2, r0, 16; movne r0, r2; addeq r1, 16 ^~~~~ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/clzdi2.S:56:33: error: invalid instruction mnemonic 'addeq' lsrs r2, r0, 16; movne r0, r2; addeq r1, 16 ^~~~~ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/clzdi2.S:57:2: error: invalid instruction mnemonic 'lsrs' lsrs r2, r0, 8; movne r0, r2; addeq r1, 8 ^~~~ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/clzdi2.S:57:18: error: invalid instruction mnemonic 'movne' lsrs r2, r0, 8; movne r0, r2; addeq r1, 8 ^~~~~ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/clzdi2.S:57:32: error: invalid instruction mnemonic 'addeq' lsrs r2, r0, 8; movne r0, r2; addeq r1, 8 ^~~~~ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/clzdi2.S:58:2: error: invalid instruction mnemonic 'lsrs' lsrs r2, r0, 4; movne r0, r2; addeq r1, 4 ^~~~ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/clzdi2.S:58:18: error: invalid instruction mnemonic 'movne' lsrs r2, r0, 4; movne r0, r2; addeq r1, 4 ^~~~~ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/clzdi2.S:58:32: error: invalid instruction mnemonic 'addeq' lsrs r2, r0, 4; movne r0, r2; addeq r1, 4 ^~~~~ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/clzdi2.S:59:2: error: invalid instruction mnemonic 'lsrs' lsrs r2, r0, 2; movne r0, r2; addeq r1, 2 ^~~~ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/clzdi2.S:59:18: error: invalid instruction mnemonic 'movne' lsrs r2, r0, 2; movne r0, r2; addeq r1, 2 ^~~~~ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/clzdi2.S:59:32: error: invalid instruction mnemonic 'addeq' lsrs r2, r0, 2; movne r0, r2; addeq r1, 2 ^~~~~ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/clzdi2.S:61:2: error: unknown use of instruction mnemonic without a size suffix sub r0, r1, r0, lsr #1 ^ [6/207] Building ASM object lib/builtins/CMakeFiles/clangrt.builtins-armhf.dir/arm/divmodsi4.S.o FAILED: lib/builtins/CMakeFiles/clangrt.builtins-armhf.dir/arm/divmodsi4.S.o /usr/local/myclang/bin/clang -DVISIBILITYHIDDEN -fno-lto -std=c11 -fPIC -fno-builtin -fvisibility=hidden -fomit-frame-pointer -fomit-frame-pointer -DCOMPILERRTARMHFTARGET -MD -MT lib/builtins/CMakeFiles/clangrt.builtins-armhf.dir/arm/divmodsi4.S.o -MF lib/builtins/CMakeFiles/clangrt.builtins-armhf.dir/arm/divmodsi4.S.o.d -o lib/builtins/CMakeFiles/clangrt.builtins-armhf.dir/arm/divmodsi4.S.o -c /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/divmodsi4.S /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/divmodsi4.S:24:2: error: unknown directive .syntax unified ^ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/divmodsi4.S:28:1: error: unexpected token at start of statement _@ int divmodsi4(int divident, int divisor, int *remainder) ^ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/divmodsi4.S:29:1: error: unexpected token at start of statement @ Calculate the quotient and remainder of the (signed) division. The return ^ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/divmodsi4.S:30:1: error: unexpected token at start of statement @ value is the quotient, the remainder is placed in the variable. ^ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/divmodsi4.S:46:11: error: Invalid rounding mode. push {r4-r7, lr} ; add r7, sp, #12 ^ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/divmodsi4.S:46:36: error: unknown token in expression push {r4-r7, lr} ; add r7, sp, #12 ^ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/divmodsi4.S:49:5: error: invalid instruction mnemonic 'eor' eor r4, r0, r1 ^~~ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/divmodsi4.S:50:5: error: unknown use of instruction mnemonic without a size suffix mov r5, r0 ^ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/divmodsi4.S:51:5: error: unknown use of instruction mnemonic without a size suffix mov r6, r2 ^ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/divmodsi4.S:53:5: error: invalid instruction mnemonic 'eor' eor ip, r0, r0, asr #31 ^~~ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/divmodsi4.S:54:5: error: invalid instruction mnemonic 'eor' eor lr, r1, r1, asr #31 ^~~ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/divmodsi4.S:55:5: error: unknown use of instruction mnemonic without a size suffix sub r0, ip, r0, asr #31 ^ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/divmodsi4.S:56:5: error: unknown use of instruction mnemonic without a size suffix sub r1, lr, r1, asr #31 ^ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/divmodsi4.S:58:5: error: invalid instruction mnemonic 'bl' _bl udivmodsi4 ^~ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/divmodsi4.S:60:5: error: invalid instruction mnemonic 'ldr' ldr r1, [r6] ^~~ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/divmodsi4.S:61:5: error: invalid instruction mnemonic 'eor' eor r0, r0, r4, asr #31 ^~~ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/divmodsi4.S:62:5: error: invalid instruction mnemonic 'eor' eor r1, r1, r5, asr #31 ^~~ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/divmodsi4.S:63:5: error: unknown use of instruction mnemonic without a size suffix sub r0, r0, r4, asr #31 ^ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/divmodsi4.S:64:5: error: unknown use of instruction mnemonic without a size suffix sub r1, r1, r5, asr #31 ^ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/divmodsi4.S:65:5: error: unknown use of instruction mnemonic without a size suffix str r1, [r6] ^ /home/llvmall/llvm/projects/compiler-rt/lib/builtins/arm/divmodsi4.S:66:10: error: Invalid rounding mode. pop {r4-r7, pc}

On 04.12.2018 15:54, Peter Smith via llvm-dev wrote: Hello, 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, https://developer.arm.com/open-source/gnu-toolchain/gnu-rm -- 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 with lld. 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. Peter On Tue, 4 Dec 2018 at 12:21, cscheuer via llvm-dev <llvm-dev at lists.llvm.org> wrote: 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/ a152c7a4b7ba8f4cb9532ead9a38a7121db43d50) (https://git.llvm.org/git/llvm.git/ 1959ce6f3e01241919968ac1911fd45660239d23) Target: arm-none-unknown-eabi Thread model: posix InstalledDir: /usr/local/myclang/bin "/usr/local/myclang/bin/ld.lld" barehelloCLANG.o io.o -Bstatic -L/usr/local/myclang/lib/clang/8.0.0/lib/baremetal -lc -lm -lclangrt.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 -lclangrt.builtins-arm.a clang-8: error: ld.lld command failed with exit code 1 (use -v to see invocation) on the linking part. I downloaded a sysroot from https://developer.arm.com/open-source/gnu-toolchain/gnu-a/downloads/8-2-2018-08 and tried to include it via --sysroot=/my/path/to/it, but clang acted unimpressed with the same errors. So I'm missing clangrt.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 http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev


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


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

-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20181213/d86947f9/attachment-0001.html> -------------- next part -------------- A non-text attachment was scrubbed... Name: christian_richter.vcf Type: text/x-vcard Size: 246 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20181213/d86947f9/attachment-0001.vcf>



More information about the llvm-dev mailing list