<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <p>Hello Peter,</p>
    <p>the unable to find -lc, -lm was indeed fixed as soon as I got the
      -L right, thanks! So for the record, the correct way to include
      the paths was „-L/usr/lib/gcc/arm-none-eabi/6.3.1/
      -L/usr/lib/arm-none-eabi/lib/“. <br>
    </p>
    <p>The -clang_rt.builtins-armv6m.a still puzzles me: I built the
      compiler-rt according to the mentioned baremetal recipe some time
      ago with <br>
    </p>
    <o:p></o:p>
    <p>
    </p>
    cmake –G Ninja –DBAREMETAL_ARMV6M_SYSROOT=${ARMEABI5GCC}
    -DBAREMETAL_ARMV7M_SYSROOT=${ARMEABI5GCC}-
    DBAREMETAL_ARMV7EM_SYSROOT=${ARMEABI5GCC} –DCMAKE_BUILD_TYPE=Release
    –C /home/llvm_4rt/llvm/tools/clang/cmake/caches/BaremetalARM.cmake
    /home/llvm_4rt/llvm/ <br>
    <br>
    where
ARMEABI5GCC=/home/crichter/Downloads/gcc-arm-none-eabi-5_4-2016q3/arm-none-eabi
    is from the sysroot download site you gave me back then. <br>
    <br>
    That resulted in a libclang_rt.builtins.a file which I considered to
    be the right one to use now, but neither copying it into <br>
    /usr/local/myclang/lib/clang/8.0.0/lib/baremetal (which did not
    exist before, only /linux was present already) or adding another .a
    behind the name helped the linker, nor did adding a
    -l<path-to-libclang_rt.builtins.a>. Did I <br>
    build the wrong one or am I using it incorrectly?<br>
    <br>
    The part about the int _start () __attribute__ ((naked)) was needed
    when compiling with gcc because otherwise the program contained an
    unwanted push{r4, lr}. But this is a problem for a later day that
    might not even occur with clang. I'll see if it comes back to haunt
    me when I'm able to compile the program with clang, I guess :-)<br>
    <br>
    Thanks once more!<br>
    Christian<br>
    <br>
    <br>
    <blockquote
cite="mid:CAEt-8LDdc1biX7NYtzdDSW49mdrCmc_7XCGpPDoLd0yP7y2xvg@mail.gmail.com"
      type="cite">
      <pre wrap="">Hello Christian,

I'd expect that adding the library paths (-L) from gcc -v should fix
the unable to find -lc, -lm but it won't fix the
-lclang_rt.builtins-armv6m.a . To get clang_rt.builtins-armv6m.a you
will need to cross compile compiler-rt for v6m and copy it to
/usr/local/myclang/lib/clang/8.0.0/lib/baremetal . Beware that
building compiler-rt for v6m does need quite a bit of fighting cmake
(<a class="moz-txt-link-freetext" href="https://llvm.org/docs/HowToCrossCompileBuiltinsOnArm.html">https://llvm.org/docs/HowToCrossCompileBuiltinsOnArm.html</a>). Your
alternative if you already have a libgcc.a is to use --nostdlib or
--nodefaultlibs to stop the driver adding -lm -lc
-lclang_rt.builtins-armv6m.a , although you'll need to add your c
library (and possibly math library) yourself in that case.

I don't understand the part about __start. I'd expect __start to be
provided by the c library, probably newlib or newlib nano from
arm-none-eabi.

Peter


On Sat, 2 Mar 2019 at 14:08, Christian Richter
<a class="moz-txt-link-rfc2396E" href="mailto:christian.richter@hsu-hh.de"><christian.richter@hsu-hh.de></a> wrote:
</pre>
      <blockquote type="cite">
        <pre wrap="">
Hello again,

so I've tried the following: I created a working gcc version with arm-none-eabi-gcc (this took some time, hence the late answer I'm afraid). The output of the linker stage looks like this:

root@christian-forschung-virtual-machine:/home/progs# arm-none-eabi-gcc -v start.o barehello.o io.o -nostartfiles -Wl,--build-id=none -Wl,-init=_start -Ttext 0x8000 -static -o hello

Using built-in specs.
COLLECT_GCC=arm-none-eabi-gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/arm-none-eabi/6.3.1/lto-wrapper
Target: arm-none-eabi
Configured with: ../src/configure --build=x86_64-linux-gnu --prefix=/usr --includedir='/usr/lib/include' --mandir='/usr/lib/share/man' --infodir='/usr/lib/share/info' --sysconfdir=/etc --localstatedir=/var --disable-silent-rules --libdir='/usr/lib/lib/x86_64-linux-gnu' --libexecdir='/usr/lib/lib/x86_64-linux-gnu' --disable-maintainer-mode --disable-dependency-tracking --mandir=/usr/share/man --enable-languages=c,c++,lto --enable-multilib --disable-decimal-float --disable-libffi --disable-libgomp --disable-libmudflap --disable-libquadmath --disable-libssp --disable-libstdcxx-pch --disable-nls --disable-shared --disable-threads --disable-tls --build=x86_64-linux-gnu --target=arm-none-eabi --with-system-zlib --with-gnu-as --with-gnu-ld --with-pkgversion=15:6.3.1+svn253039-1build1 --without-included-gettext --prefix=/usr/lib --infodir=/usr/share/doc/gcc-arm-none-eabi/info --htmldir=/usr/share/doc/gcc-arm-none-eabi/html --pdfdir=/usr/share/doc/gcc-arm-none-eabi/pdf --bindir=/usr/bin --libexecdir=/usr/lib --libdir=/usr/lib --disable-libstdc++-v3 --host=x86_64-linux-gnu --with-headers=no --without-newlib --with-multilib-list=rmprofile CFLAGS='-g -O2 -fdebug-prefix-map=/build/gcc-arm-none-eabi-iopiMw/gcc-arm-none-eabi-6.3.1+svn253039=. -fstack-protector-strong' CPPFLAGS='-Wdate-time -D_FORTIFY_SOURCE=2' CXXFLAGS='-g -O2 -fdebug-prefix-map=/build/gcc-arm-none-eabi-iopiMw/gcc-arm-none-eabi-6.3.1+svn253039=. -fstack-protector-strong' FCFLAGS='-g -O2 -fdebug-prefix-map=/build/gcc-arm-none-eabi-iopiMw/gcc-arm-none-eabi-6.3.1+svn253039=. -fstack-protector-strong' FFLAGS='-g -O2 -fdebug-prefix-map=/build/gcc-arm-none-eabi-iopiMw/gcc-arm-none-eabi-6.3.1+svn253039=. -fstack-protector-strong' GCJFLAGS='-g -O2 -fdebug-prefix-map=/build/gcc-arm-none-eabi-iopiMw/gcc-arm-none-eabi-6.3.1+svn253039=. -fstack-protector-strong' LDFLAGS='-Wl,-Bsymbolic-functions -Wl,-z,relro' OBJCFLAGS='-g -O2 -fdebug-prefix-map=/build/gcc-arm-none-eabi-iopiMw/gcc-arm-none-eabi-6.3.1+svn253039=. -fstack-protector-strong' OBJCXXFLAGS='-g -O2 -fdebug-prefix-map=/build/gcc-arm-none-eabi-iopiMw/gcc-arm-none-eabi-6.3.1+svn253039=. -fstack-protector-strong' INHIBIT_LIBC_CFLAGS=-DUSE_TM_CLONE_REGISTRY=0 AR_FOR_TARGET=arm-none-eabi-ar AS_FOR_TARGET=arm-none-eabi-as LD_FOR_TARGET=arm-none-eabi-ld NM_FOR_TARGET=arm-none-eabi-nm OBJDUMP_FOR_TARGET=arm-none-eabi-objdump RANLIB_FOR_TARGET=arm-none-eabi-ranlib READELF_FOR_TARGET=arm-none-eabi-readelf STRIP_FOR_TARGET=arm-none-eabi-strip
Thread model: single
gcc version 6.3.1 20170620 (15:6.3.1+svn253039-1build1)
COMPILER_PATH=/usr/lib/gcc/arm-none-eabi/6.3.1/:/usr/lib/gcc/arm-none-eabi/6.3.1/:/usr/lib/gcc/arm-none-eabi/:/usr/lib/gcc/arm-none-eabi/6.3.1/:/usr/lib/gcc/arm-none-eabi/:/usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/
LIBRARY_PATH=/usr/lib/gcc/arm-none-eabi/6.3.1/:/usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/
COLLECT_GCC_OPTIONS='-v' '-nostartfiles' '-Ttext' '0x8000' '-static' '-o' 'hello'
 /usr/lib/gcc/arm-none-eabi/6.3.1/collect2 -plugin /usr/lib/gcc/arm-none-eabi/6.3.1/liblto_plugin.so -plugin-opt=/usr/lib/gcc/arm-none-eabi/6.3.1/lto-wrapper -plugin-opt=-fresolution=/tmp/cceNgJBK.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lc -Bstatic -X -o hello -L/usr/lib/gcc/arm-none-eabi/6.3.1 -L/usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib start.o barehello.o io.o --build-id=none -init=_start --start-group -lgcc -lc --end-group -Ttext 0x8000
COLLECT_GCC_OPTIONS='-v' '-nostartfiles' '-Ttext' '0x8000' '-static' '-o' 'hello'


and the resulting program works on the baremetal ARM (after objcopying it). So far, so good.  Using a similar call for clang --target=armv6m-none-eabi fails like this:

root@christian-forschung-virtual-machine:/home/progs/clang# clang -v start.o barehello.o io.o --target=armv6m-none-eabi -Wl,--build-id=none -Wl,-init=_start -Ttext 0x8000 -static -o hello

clang version 8.0.0 (<a class="moz-txt-link-freetext" href="https://git.llvm.org/git/clang.git/">https://git.llvm.org/git/clang.git/</a> a152c7a4b7ba8f4cb9532ead9a38a7121db43d50) (<a class="moz-txt-link-freetext" href="https://git.llvm.org/git/llvm.git/">https://git.llvm.org/git/llvm.git/</a> 1959ce6f3e01241919968ac1911fd45660239d23)
Target: armv6m-none-unknown-eabi
Thread model: posix
InstalledDir: /usr/local/myclang/bin
 "/usr/local/myclang/bin/ld.lld" start.o barehello.o io.o --build-id=none -init=_start -Bstatic -L/usr/local/myclang/lib/clang/8.0.0/lib/baremetal -Ttext 0x8000 -lc -lm -lclang_rt.builtins-armv6m.a -o hello
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-armv6m.a
clang-8: error: ld.lld command failed with exit code 1 (use -v to see invocation)

I downloaded the sysroot (from <a class="moz-txt-link-freetext" href="https://developer.arm.com/open-source/gnu-toolchain/gnu-rm">https://developer.arm.com/open-source/gnu-toolchain/gnu-rm</a> ) and tried to include it via --sysroot (like --sysroot=/home/crichter/Downloads/gcc-arm-none-eabi-5_4-2016q3/arm-none-eabi) or -L or -l and tried the same for the two libraries gcc seems to use  according to its -v (LIBRARY_PATH=/usr/lib/gcc/arm-none-eabi/6.3.1/:/usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/) or combinations of it, but it all resulted in the same error above. I also tried to use the runtime library I built earlier, but to no avail. So basically, I (still) haven't figured out how to tell clang to use the right libraries. On a side note, I actually needed to include  int _start () __attribute__ ((naked)); into the .c file to make the program work, but clang does not support this (as it seems to be problematic), is there an alternative?

Thanks once more!

Christian



On 04.02.2019 16:26, Peter Smith wrote:

Hello Christian,

I've put some comments inline,

On Sun, 3 Feb 2019 at 13:11, Christian Richter
<a class="moz-txt-link-rfc2396E" href="mailto:christian.richter@hsu-hh.de"><christian.richter@hsu-hh.de></a> wrote:

Hello again,

so after I successfully build the compiler-rt for armv6 I tried to
actually use it in compiling a small helloworld for a baremetal arm
(consisting of barehelloCLANG.c and a small io.h + io.c) , but the
linking part of the compilation resulted in this:

root@christian-forschung-virtual-machine:/home/progs# clang -v
--target=armv6-none-eabi -L
/home/llvm_all/buildrecipe/lib/clang/8.0.0/armv6m-none-eabi
-lclang_rt.builtins.arm barehelloCLANG.o io.o -o helloCLANGstatic
-static -fuse-ld=lld
clang version 8.0.0 (<a class="moz-txt-link-freetext" href="https://git.llvm.org/git/clang.git/">https://git.llvm.org/git/clang.git/</a>
a152c7a4b7ba8f4cb9532ead9a38a7121db43d50)
(<a class="moz-txt-link-freetext" href="https://git.llvm.org/git/llvm.git/">https://git.llvm.org/git/llvm.git/</a>
1959ce6f3e01241919968ac1911fd45660239d23)
Target: armv6-none-unknown-eabi
Thread model: posix
InstalledDir: /usr/local/myclang/bin
  "/usr/local/myclang/bin/ld.lld" -lclang_rt.builtins.arm
barehelloCLANG.o io.o -Bstatic
-L/usr/local/myclang/lib/clang/8.0.0/lib/baremetal
-L/home/llvm_all/buildrecipe/lib/clang/8.0.0/armv6m-none-eabi -lc -lm
-lclang_rt.builtins-armv6.a -o helloCLANGstatic
ld.lld: error: unable to find library -lclang_rt.builtins.arm
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-armv6.a
clang-8: error: ld.lld command failed with exit code 1 (use -v to see
invocation)

Just to be sure; do you really mean --target=armv6-none-eabi ? That is
targeting an old ArmV6 device such as an ARM1176 as used on the
Raspberry Pi; this is very different from --target=armv6m-none-eabi ,
as used on the cortex-m0,  despite there being only one letter
difference in the target! Whichever you need you'll need to have the
right compiler-rt.

When you use a -none-eabi target clang will use the BareMetal driver
that in contrast with the Linux driver adds very few include and
library paths automatically. The driver will automatically add
-lclang_rt.builtins-{arch-name}.a where arch-name will be armv6 if you
are using --target=armv6-none-eabi. Unfortunately when LLD sees
-l{library name} it will search for {library name}.a and {library
name}.so, even if {library name} ends in .a, so LLD will be looking
for clang_rt.builtins-armv6.a.a which it won't find. Personally I
think this could be considered a bug in the BareMetal driver. As a
workaround you can rename, copy or symlink a
clang_rt.builtins-{arch-name}.a.a so that LLD can find it.

So basically, the compiler does not use/find the given libraries, but
after trying a lot of variations of the above with the same result I
can't figure out why.
/home/llvm_all/buildrecipe/lib/clang/8.0.0/armv6m-none-eabi is what the
recipe from <a class="moz-txt-link-freetext" href="https://llvm.org/docs/HowToCrossCompileBuiltinsOnArm.html">https://llvm.org/docs/HowToCrossCompileBuiltinsOnArm.html</a>
gave me and is empty except for clang_rt.builtins-armv6.a. Do I still
need to use the sysroot for baremetal arm in addition or do the
compiler-rt suffice? Once more thanks in advance for any hint or help!

Yes you'll still need to use a sysroot for bare metal Arm. The
compiler-rt builtins library provides run-time functions that the
compiler can use in code-generation, a good example is supporting for
software floating point emulation. It isn't a replacement for a C or
Math library. The last time I tried to make a bare-metal Arm program
work with clang I did the following:
- Downloaded the arm-none-eabi GNU toolchain
<a class="moz-txt-link-freetext" href="https://developer.arm.com/open-source/gnu-toolchain/gnu-rm">https://developer.arm.com/open-source/gnu-toolchain/gnu-rm</a>
- Found one of the sample programs in the
share/gcc-arm-none-eabi/samples directory and built that.
- Made sure the program worked.
- Used arm-none-eabi-gcc -v to find the libraries and paths that GCC was using.
- Substituted clang for arm-none-eabi-gcc after after removing the
libraries I had clang equivalents for.

This is obviously not a great user experience, the BareMetal driver
needs quite a bit of work. Unfortunately due to the needs of multilib
and the dependencies between newlib/newlib-nano and libgloss
components that gcc uses specs files for, this is not simple.

Peter

Christian Richter



On 14.12.2018 18:28, Peter Smith wrote:

Hello again Christian,

I've posted <a class="moz-txt-link-freetext" href="https://reviews.llvm.org/D55709">https://reviews.llvm.org/D55709</a> to see if we can get the
documentation on how to cross-compile compiler-rt improved. I'll be
out of office until next year so I may be a bit slow to respond to any
follow ups.

Peter

On Thu, 13 Dec 2018 at 17:10, Peter Smith <a class="moz-txt-link-rfc2396E" href="mailto:peter.smith@linaro.org"><peter.smith@linaro.org></a> wrote:

Hello Christian,

I've just retried the runtimes way of building for v6m, v7m and v7e-m
. My cmake command was
ARMEABIGCC=/path/to/gcceabi/arm-none-eabi
cmake \
   -G Ninja\
   -DBAREMETAL_ARMV6M_SYSROOT=${ARMEABIGCC}\
   -DBAREMETAL_ARMV7M_SYSROOT=${ARMEABIGCC}\
   -DBAREMETAL_ARMV7EM_SYSROOT=${ARMEABIGCC}\
   -DCMAKE_BUILD_TYPE=Release\
   -C/path/to/llvm/tools/clang/cmake/caches/BaremetalARM.cmake \
   /path/to/llvm

The cache file requires clang and lld. From the build directory they
will go into lib/clang. That worked for me (TM). Hopefully if you can
edit the paths it will work for you. My guess is that you'll want to
set ARMEABIGCC=/home/crichter/Downloads/gcc-arm-none-eabi-5_4-2016q3/arm-none-eabi

Peter

On Thu, 13 Dec 2018 at 12:08, Christian Richter
<a class="moz-txt-link-rfc2396E" href="mailto:christian.richter@hsu-hh.de"><christian.richter@hsu-hh.de></a> wrote:

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 <a class="moz-txt-link-freetext" href="https://developer.arm.com/open-source/gnu-toolchain/gnu-a/downloads">https://developer.arm.com/open-source/gnu-toolchain/gnu-a/downloads</a>. 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 <a class="moz-txt-link-freetext" href="https://developer.arm.com/open-source/gnu-toolchain/gnu-rm/downloads">https://developer.arm.com/open-source/gnu-toolchain/gnu-rm/downloads</a> 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@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 (<a class="moz-txt-link-freetext" href="https://developer.arm.com/open-source/gnu-toolchain/gnu-a/downloads">https://developer.arm.com/open-source/gnu-toolchain/gnu-a/downloads</a>)
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
<a class="moz-txt-link-rfc2396E" href="mailto:christian.richter@hsu-hh.de"><christian.richter@hsu-hh.de></a> wrote:

Hello again!

Tried out the small Hello World Setup, worked as intended:

root@christian-forschung-virtual-machine:/home/progs# clang -v --target=arm-linux-gnueabihf hello.c -o hello -fuse-ld=lld
clang version 8.0.0 (<a class="moz-txt-link-freetext" href="https://git.llvm.org/git/clang.git/">https://git.llvm.org/git/clang.git/</a> a152c7a4b7ba8f4cb9532ead9a38a7121db43d50) (<a class="moz-txt-link-freetext" href="https://git.llvm.org/git/llvm.git/">https://git.llvm.org/git/llvm.git/</a> 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 x86_64-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 armelf_linux_eabi -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 -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --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@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 -DCMAKE_ASM_FLAGS to the cmake for the standalone compiler-rt build while leaving out the --sysroot and --gcc-toolchain:

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" -DCMAKE_C_FLAGS="--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 <a class="moz-txt-link-freetext" href="http://lists.llvm.org/pipermail/llvm-dev/2011-September/043289.html">http://lists.llvm.org/pipermail/llvm-dev/2011-September/043289.html</a> 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@christian-forschung-virtual-machine:/home/llvm_all/buildrtonly# ninja builtins
[147/207] Building C object lib/builtins/CMakeFiles/clang_rt.builtins-armhf.dir/emutls.c.o
FAILED: lib/builtins/CMakeFiles/clang_rt.builtins-armhf.dir/emutls.c.o
/usr/local/myclang/bin/clang --target=arm-linux-gnueabihf -DVISIBILITY_HIDDEN  --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 -DCOMPILER_RT_ARMHF_TARGET -MD -MT lib/builtins/CMakeFiles/clang_rt.builtins-armhf.dir/emutls.c.o -MF lib/builtins/CMakeFiles/clang_rt.builtins-armhf.dir/emutls.c.o.d -o lib/builtins/CMakeFiles/clang_rt.builtins-armhf.dir/emutls.c.o   -c /home/llvm_all/llvm/projects/compiler-rt/lib/builtins/emutls.c
In file included from /home/llvm_all/llvm/projects/compiler-rt/lib/builtins/emutls.c:41:
/usr/include/pthread.h:682:6: error: 'regparm' is not valid on this platform
      __cleanup_fct_attribute;
      ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/bits/pthreadtypes-arch.h:103:50: note: expanded from macro '__cleanup_fct_attribute'
# define __cleanup_fct_attribute __attribute__ ((__regparm__ (1)))
                                                  ^            ~
In file included from /home/llvm_all/llvm/projects/compiler-rt/lib/builtins/emutls.c:41:
/usr/include/pthread.h:694:3: error: 'regparm' is not valid on this platform
   __cleanup_fct_attribute;
   ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/bits/pthreadtypes-arch.h:103:50: note: expanded from macro '__cleanup_fct_attribute'
# define __cleanup_fct_attribute __attribute__ ((__regparm__ (1)))
                                                  ^            ~
In file included from /home/llvm_all/llvm/projects/compiler-rt/lib/builtins/emutls.c:41:
/usr/include/pthread.h:735:6: error: 'regparm' is not valid on this platform
      __cleanup_fct_attribute __attribute__ ((__noreturn__))
      ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/bits/pthreadtypes-arch.h:103:50: note: expanded from macro '__cleanup_fct_attribute'
# define __cleanup_fct_attribute __attribute__ ((__regparm__ (1)))
                                                  ^            ~
3 errors generated.
[148/207] Building C object lib/builtins/CMakeFiles/clang_rt.builtins-armhf.dir/gcc_personality_v0.c.o
/home/llvm_all/llvm/projects/compiler-rt/lib/builtins/gcc_personality_v0.c:148:47: warning: declaration of 'struct _Unwind_Exception' will not be visible outside of this function [-Wvisibility]
_Unwind_Reason_Code __gnu_unwind_frame(struct _Unwind_Exception *,
                                               ^
/home/llvm_all/llvm/projects/compiler-rt/lib/builtins/gcc_personality_v0.c:153:23: warning: declaration of 'struct _Unwind_Exception' will not be visible outside of this function [-Wvisibility]
continueUnwind(struct _Unwind_Exception *exceptionObject,
                       ^
/home/llvm_all/llvm/projects/compiler-rt/lib/builtins/gcc_personality_v0.c:160:28: warning: incompatible pointer types passing 'struct _Unwind_Exception *' to parameter of type 'struct _Unwind_Exception *' [-Wincompatible-pointer-types]
     if (__gnu_unwind_frame(exceptionObject, context) != _URC_OK)
                            ^~~~~~~~~~~~~~~
/home/llvm_all/llvm/projects/compiler-rt/lib/builtins/gcc_personality_v0.c:148:66: note: passing argument to parameter here
_Unwind_Reason_Code __gnu_unwind_frame(struct _Unwind_Exception *,
                                                                  ^
/home/llvm_all/llvm/projects/compiler-rt/lib/builtins/gcc_personality_v0.c:184:38: warning: declaration of 'struct _Unwind_Exception' will not be visible outside of this function [-Wvisibility]
          _Unwind_State state, struct _Unwind_Exception *exceptionObject,
                                      ^
/home/llvm_all/llvm/projects/compiler-rt/lib/builtins/gcc_personality_v0.c:202:31: warning: incompatible pointer types passing 'struct _Unwind_Exception *' to parameter of type 'struct _Unwind_Exception *' [-Wincompatible-pointer-types]
         return continueUnwind(exceptionObject, context);
                               ^~~~~~~~~~~~~~~
/home/llvm_all/llvm/projects/compiler-rt/lib/builtins/gcc_personality_v0.c:153:42: note: passing argument to parameter 'exceptionObject' here
continueUnwind(struct _Unwind_Exception *exceptionObject,
                                          ^
/home/llvm_all/llvm/projects/compiler-rt/lib/builtins/gcc_personality_v0.c:207:31: warning: incompatible pointer types passing 'struct _Unwind_Exception *' to parameter of type 'struct _Unwind_Exception *' [-Wincompatible-pointer-types]
         return continueUnwind(exceptionObject, context);
                               ^~~~~~~~~~~~~~~
/home/llvm_all/llvm/projects/compiler-rt/lib/builtins/gcc_personality_v0.c:153:42: note: passing argument to parameter 'exceptionObject' here
continueUnwind(struct _Unwind_Exception *exceptionObject,
                                          ^
/home/llvm_all/llvm/projects/compiler-rt/lib/builtins/gcc_personality_v0.c:250:27: warning: incompatible pointer types passing 'struct _Unwind_Exception *' to parameter of type 'struct _Unwind_Exception *' [-Wincompatible-pointer-types]
     return continueUnwind(exceptionObject, context);
                           ^~~~~~~~~~~~~~~
/home/llvm_all/llvm/projects/compiler-rt/lib/builtins/gcc_personality_v0.c:153:42: note: passing argument to parameter 'exceptionObject' here
continueUnwind(struct _Unwind_Exception *exceptionObject,
                                          ^
7 warnings generated.
[152/207] Building ASM object lib/builtins/CMakeFiles/clang_rt.builtins-armhf.dir/arm/aeabi_cdcmp.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
<a class="moz-txt-link-rfc2396E" href="mailto:llvm-dev@lists.llvm.org"><llvm-dev@lists.llvm.org></a> wrote:

Hello,

on the problems cross-building compiler-rt: Tried to follow <a class="moz-txt-link-freetext" href="https://llvm.org/docs/HowToCrossCompileBuiltinsOnArm.html">https://llvm.org/docs/HowToCrossCompileBuiltinsOnArm.html</a> which lead to this cmake:

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_C_FLAGS="--target=arm-linux-gnueabihf -march=armv7a --gcc-toolchain=/usr/arm-linux-gnueabihf --sysroot=/usr/arm-linux-gnueabihf/lib"

Some small notes:

- Used -DCMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY instead of  -DCMAKE_EXE_LINKER_FLAGS="-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 -DCMAKE_EXE_LINKER_FLAGS="-fuse-ld=lld":

Thanks for the comments. I will try and revisit that document next
week and will post an update.

root@christian-forschung-virtual-machine:/home/llvm_all/buildrtonly# 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_EXE_LINKER_FLAGS="-fuse-ld=lld" -DCMAKE_C_COMPILER_TARGET="arm-linux-gnueabihf" -DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON -DLLVM_CONFIG_PATH=/usr/local/myclang/bin/llvm-config -DCMAKE_C_FLAGS="--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/llvm_all/buildrtonly/CMakeFiles/CMakeTmp

     Run Build Command:"/usr/bin/ninja" "cmTC_22d97"
     [1/2] Building C object CMakeFiles/cmTC_22d97.dir/testCCompiler.c.o
     [2/2] Linking C executable cmTC_22d97
     FAILED: cmTC_22d97
     : && /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/cmTC_22d97.dir/testCCompiler.c.o  -o cmTC_22d97   && :
     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 -lgcc_s
     ld.lld: error: unable to find library -lc
     ld.lld: error: unable to find library -lgcc
     ld.lld: error: unable to find library -lgcc_s
     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/llvm_all/buildrtonly/CMakeFiles/CMakeOutput.log".
See also "/home/llvm_all/buildrtonly/CMakeFiles/CMakeError.log".


Note: Googling this error suggested installing gcc-multilib or linking "sudo ln -s /usr/lib/x86_64-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
-DCMAKE_ASM_FLAGS="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 STATIC_LIBRARY:

-- 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 __gcc_personality_v0 in gcc_s
-- Looking for __gcc_personality_v0 in gcc_s - found
-- Performing Test COMPILER_RT_HAS_NODEFAULTLIBS_FLAG
-- Performing Test COMPILER_RT_HAS_NODEFAULTLIBS_FLAG - Success
-- Performing Test COMPILER_RT_HAS_FFREESTANDING_FLAG
-- Performing Test COMPILER_RT_HAS_FFREESTANDING_FLAG - Success
-- Performing Test COMPILER_RT_HAS_FPIC_FLAG
-- Performing Test COMPILER_RT_HAS_FPIC_FLAG - Success
-- Performing Test COMPILER_RT_HAS_FPIE_FLAG
-- Performing Test COMPILER_RT_HAS_FPIE_FLAG - Success
-- Performing Test COMPILER_RT_HAS_FNO_BUILTIN_FLAG
-- Performing Test COMPILER_RT_HAS_FNO_BUILTIN_FLAG - Success
-- Performing Test COMPILER_RT_HAS_FNO_EXCEPTIONS_FLAG
-- Performing Test COMPILER_RT_HAS_FNO_EXCEPTIONS_FLAG - Success
-- Performing Test COMPILER_RT_HAS_FOMIT_FRAME_POINTER_FLAG
-- Performing Test COMPILER_RT_HAS_FOMIT_FRAME_POINTER_FLAG - Success
-- Performing Test COMPILER_RT_HAS_FUNWIND_TABLES_FLAG
-- Performing Test COMPILER_RT_HAS_FUNWIND_TABLES_FLAG - Success
-- Performing Test COMPILER_RT_HAS_FNO_STACK_PROTECTOR_FLAG
-- Performing Test COMPILER_RT_HAS_FNO_STACK_PROTECTOR_FLAG - Success
-- Performing Test COMPILER_RT_HAS_FNO_SANITIZE_SAFE_STACK_FLAG
-- Performing Test COMPILER_RT_HAS_FNO_SANITIZE_SAFE_STACK_FLAG - Success
-- Performing Test COMPILER_RT_HAS_FVISIBILITY_HIDDEN_FLAG
-- Performing Test COMPILER_RT_HAS_FVISIBILITY_HIDDEN_FLAG - Success
-- Performing Test COMPILER_RT_HAS_FRTTI_FLAG
-- Performing Test COMPILER_RT_HAS_FRTTI_FLAG - Success
-- Performing Test COMPILER_RT_HAS_FNO_RTTI_FLAG
-- Performing Test COMPILER_RT_HAS_FNO_RTTI_FLAG - Success
-- Performing Test COMPILER_RT_HAS_FNO_FUNCTION_SECTIONS_FLAG
-- Performing Test COMPILER_RT_HAS_FNO_FUNCTION_SECTIONS_FLAG - Success
-- Performing Test COMPILER_RT_HAS_STD_CXX11_FLAG
-- Performing Test COMPILER_RT_HAS_STD_CXX11_FLAG - Success
-- Performing Test COMPILER_RT_HAS_FTLS_MODEL_INITIAL_EXEC
-- Performing Test COMPILER_RT_HAS_FTLS_MODEL_INITIAL_EXEC - Success
-- Performing Test COMPILER_RT_HAS_FNO_LTO_FLAG
-- Performing Test COMPILER_RT_HAS_FNO_LTO_FLAG - Success
-- Performing Test COMPILER_RT_HAS_MSSE3_FLAG
-- Performing Test COMPILER_RT_HAS_MSSE3_FLAG - Success
-- Performing Test COMPILER_RT_HAS_MSSE4_2_FLAG
-- Performing Test COMPILER_RT_HAS_MSSE4_2_FLAG - Success
-- Performing Test COMPILER_RT_HAS_SYSROOT_FLAG
-- Performing Test COMPILER_RT_HAS_SYSROOT_FLAG - Success
-- Performing Test COMPILER_RT_HAS_MCRC_FLAG
-- Performing Test COMPILER_RT_HAS_MCRC_FLAG - Failed
-- Performing Test COMPILER_RT_HAS_FVISIBILITY_INLINES_HIDDEN_FLAG
-- Performing Test COMPILER_RT_HAS_FVISIBILITY_INLINES_HIDDEN_FLAG - Success
-- Performing Test COMPILER_RT_HAS_GR_FLAG
-- Performing Test COMPILER_RT_HAS_GR_FLAG - Failed
-- Performing Test COMPILER_RT_HAS_GS_FLAG
-- Performing Test COMPILER_RT_HAS_GS_FLAG - Failed
-- Performing Test COMPILER_RT_HAS_MT_FLAG
-- Performing Test COMPILER_RT_HAS_MT_FLAG - Failed
-- Performing Test COMPILER_RT_HAS_Oy_FLAG
-- Performing Test COMPILER_RT_HAS_Oy_FLAG - Failed
-- Performing Test COMPILER_RT_HAS_GLINE_TABLES_ONLY_FLAG
-- Performing Test COMPILER_RT_HAS_GLINE_TABLES_ONLY_FLAG - Success
-- Performing Test COMPILER_RT_HAS_G_FLAG
-- Performing Test COMPILER_RT_HAS_G_FLAG - Success
-- Performing Test COMPILER_RT_HAS_Zi_FLAG
-- Performing Test COMPILER_RT_HAS_Zi_FLAG - Failed
-- Performing Test COMPILER_RT_HAS_WALL_FLAG
-- Performing Test COMPILER_RT_HAS_WALL_FLAG - Success
-- Performing Test COMPILER_RT_HAS_WERROR_FLAG
-- Performing Test COMPILER_RT_HAS_WERROR_FLAG - Success
-- Performing Test COMPILER_RT_HAS_WFRAME_LARGER_THAN_FLAG
-- Performing Test COMPILER_RT_HAS_WFRAME_LARGER_THAN_FLAG - Success
-- Performing Test COMPILER_RT_HAS_WGLOBAL_CONSTRUCTORS_FLAG
-- Performing Test COMPILER_RT_HAS_WGLOBAL_CONSTRUCTORS_FLAG - Success
-- Performing Test COMPILER_RT_HAS_WC99_EXTENSIONS_FLAG
-- Performing Test COMPILER_RT_HAS_WC99_EXTENSIONS_FLAG - Success
-- Performing Test COMPILER_RT_HAS_WGNU_FLAG
-- Performing Test COMPILER_RT_HAS_WGNU_FLAG - Success
-- Performing Test COMPILER_RT_HAS_WNON_VIRTUAL_DTOR_FLAG
-- Performing Test COMPILER_RT_HAS_WNON_VIRTUAL_DTOR_FLAG - Success
-- Performing Test COMPILER_RT_HAS_WVARIADIC_MACROS_FLAG
-- Performing Test COMPILER_RT_HAS_WVARIADIC_MACROS_FLAG - Success
-- Performing Test COMPILER_RT_HAS_WUNUSED_PARAMETER_FLAG
-- Performing Test COMPILER_RT_HAS_WUNUSED_PARAMETER_FLAG - Success
-- Performing Test COMPILER_RT_HAS_WCOVERED_SWITCH_DEFAULT_FLAG
-- Performing Test COMPILER_RT_HAS_WCOVERED_SWITCH_DEFAULT_FLAG - Success
-- Performing Test COMPILER_RT_HAS_W4_FLAG
-- Performing Test COMPILER_RT_HAS_W4_FLAG - Failed
-- Performing Test COMPILER_RT_HAS_WX_FLAG
-- Performing Test COMPILER_RT_HAS_WX_FLAG - Failed
-- Performing Test COMPILER_RT_HAS_WD4146_FLAG
-- Performing Test COMPILER_RT_HAS_WD4146_FLAG - Failed
-- Performing Test COMPILER_RT_HAS_WD4291_FLAG
-- Performing Test COMPILER_RT_HAS_WD4291_FLAG - Failed
-- Performing Test COMPILER_RT_HAS_WD4221_FLAG
-- Performing Test COMPILER_RT_HAS_WD4221_FLAG - Failed
-- Performing Test COMPILER_RT_HAS_WD4391_FLAG
-- Performing Test COMPILER_RT_HAS_WD4391_FLAG - Failed
-- Performing Test COMPILER_RT_HAS_WD4722_FLAG
-- Performing Test COMPILER_RT_HAS_WD4722_FLAG - Failed
-- Performing Test COMPILER_RT_HAS_WD4800_FLAG
-- Performing Test COMPILER_RT_HAS_WD4800_FLAG - Failed
-- Looking for __func__
-- Looking for __func__ - found
-- Looking for dlopen in dl
-- Looking for dlopen in dl - found
-- Looking for shm_open in rt
-- Looking for shm_open in rt - found
-- Looking for pow in m
-- Looking for pow in m - found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Looking for setupterm in terminfo
-- Looking for setupterm in terminfo - found
-- Looking for __cxa_throw in c++
-- Looking for __cxa_throw in c++ - found
-- Looking for __cxa_throw in stdc++
-- Looking for __cxa_throw in stdc++ - found
-- Compiler-RT supported architectures: armhf
-- Performing Test COMPILER_RT_HAS_STD_C11_FLAG
-- Performing Test COMPILER_RT_HAS_STD_C11_FLAG - Success
-- Performing Test COMPILER_RT_HAS_VISIBILITY_HIDDEN_FLAG
-- Performing Test COMPILER_RT_HAS_VISIBILITY_HIDDEN_FLAG - Success
-- Performing Test COMPILER_RT_HAS_OMIT_FRAME_POINTER_FLAG
-- Performing Test COMPILER_RT_HAS_OMIT_FRAME_POINTER_FLAG - Success
-- Performing Test COMPILER_RT_HAS_FREESTANDING_FLAG
-- Performing Test COMPILER_RT_HAS_FREESTANDING_FLAG - Success
-- Performing Test COMPILER_RT_HAS_XRAY_COMPILER_FLAG
-- Performing Test COMPILER_RT_HAS_XRAY_COMPILER_FLAG - Success
-- Performing Test COMPILER_RT_HAS_ATOMIC_KEYWORD
-- Performing Test COMPILER_RT_HAS_ATOMIC_KEYWORD - Success
-- Builtin supported architectures: armhf
-- Looking for __VFP_FP__
-- Looking for __VFP_FP__ - found
-- Configuring done
-- Generating done
-- Build files have been written to: /home/llvm_all/buildrtonly

--------------------------------------

ninja output:


root@christian-forschung-virtual-machine:/home/llvm_all/buildrtonly# ninja builtins

[1/207] Building ASM object lib/builtins/CMakeFiles/clang_rt.builtins-armhf.dir/arm/bswapsi2.S.o
FAILED: lib/builtins/CMakeFiles/clang_rt.builtins-armhf.dir/arm/bswapsi2.S.o
/usr/local/myclang/bin/clang -DVISIBILITY_HIDDEN  -fno-lto -std=c11 -fPIC -fno-builtin -fvisibility=hidden -fomit-frame-pointer -fomit-frame-pointer -DCOMPILER_RT_ARMHF_TARGET -MD -MT lib/builtins/CMakeFiles/clang_rt.builtins-armhf.dir/arm/bswapsi2.S.o -MF lib/builtins/CMakeFiles/clang_rt.builtins-armhf.dir/arm/bswapsi2.S.o.d -o lib/builtins/CMakeFiles/clang_rt.builtins-armhf.dir/arm/bswapsi2.S.o -c /home/llvm_all/llvm/projects/compiler-rt/lib/builtins/arm/bswapsi2.S
/home/llvm_all/llvm/projects/compiler-rt/lib/builtins/arm/bswapsi2.S:12:2: error: unknown directive
  .syntax unified
  ^
/home/llvm_all/llvm/projects/compiler-rt/lib/builtins/arm/bswapsi2.S:25:3: error: invalid instruction mnemonic 'eor'
   eor r1, r0, r0, ror #16
   ^~~
/home/llvm_all/llvm/projects/compiler-rt/lib/builtins/arm/bswapsi2.S:26:15: error: unknown token in expression
   bic r1, r1, #0xff0000
               ^
/home/llvm_all/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/llvm_all/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/clang_rt.builtins-armhf.dir/arm/bswapdi2.S.o
FAILED: lib/builtins/CMakeFiles/clang_rt.builtins-armhf.dir/arm/bswapdi2.S.o
/usr/local/myclang/bin/clang -DVISIBILITY_HIDDEN  -fno-lto -std=c11 -fPIC -fno-builtin -fvisibility=hidden -fomit-frame-pointer -fomit-frame-pointer -DCOMPILER_RT_ARMHF_TARGET -MD -MT lib/builtins/CMakeFiles/clang_rt.builtins-armhf.dir/arm/bswapdi2.S.o -MF lib/builtins/CMakeFiles/clang_rt.builtins-armhf.dir/arm/bswapdi2.S.o.d -o lib/builtins/CMakeFiles/clang_rt.builtins-armhf.dir/arm/bswapdi2.S.o -c /home/llvm_all/llvm/projects/compiler-rt/lib/builtins/arm/bswapdi2.S
/home/llvm_all/llvm/projects/compiler-rt/lib/builtins/arm/bswapdi2.S:12:2: error: unknown directive
  .syntax unified
  ^
/home/llvm_all/llvm/projects/compiler-rt/lib/builtins/arm/bswapdi2.S:26:5: error: invalid instruction mnemonic 'eor'
     eor r2, r0, r0, ror #16
     ^~~
/home/llvm_all/llvm/projects/compiler-rt/lib/builtins/arm/bswapdi2.S:27:17: error: unknown token in expression
     bic r2, r2, #0xff0000
                 ^
/home/llvm_all/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/llvm_all/llvm/projects/compiler-rt/lib/builtins/arm/bswapdi2.S:29:5: error: invalid instruction mnemonic 'eor'
     eor r2, r2, r0, ror #8
     ^~~
/home/llvm_all/llvm/projects/compiler-rt/lib/builtins/arm/bswapdi2.S:31:5: error: invalid instruction mnemonic 'eor'
     eor r0, r1, r1, ror #16
     ^~~
/home/llvm_all/llvm/projects/compiler-rt/lib/builtins/arm/bswapdi2.S:32:17: error: unknown token in expression
     bic r0, r0, #0xff0000
                 ^
/home/llvm_all/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/llvm_all/llvm/projects/compiler-rt/lib/builtins/arm/bswapdi2.S:34:5: error: invalid instruction mnemonic 'eor'
     eor r0, r0, r1, ror #8
     ^~~
/home/llvm_all/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/clang_rt.builtins-armhf.dir/arm/comparesf2.S.o
FAILED: lib/builtins/CMakeFiles/clang_rt.builtins-armhf.dir/arm/comparesf2.S.o
/usr/local/myclang/bin/clang -DVISIBILITY_HIDDEN  -fno-lto -std=c11 -fPIC -fno-builtin -fvisibility=hidden -fomit-frame-pointer -fomit-frame-pointer -DCOMPILER_RT_ARMHF_TARGET -MD -MT lib/builtins/CMakeFiles/clang_rt.builtins-armhf.dir/arm/comparesf2.S.o -MF lib/builtins/CMakeFiles/clang_rt.builtins-armhf.dir/arm/comparesf2.S.o.d -o lib/builtins/CMakeFiles/clang_rt.builtins-armhf.dir/arm/comparesf2.S.o -c /home/llvm_all/llvm/projects/compiler-rt/lib/builtins/arm/comparesf2.S
/home/llvm_all/llvm/projects/compiler-rt/lib/builtins/arm/comparesf2.S:41:2: error: unknown directive
  .syntax unified
  ^
/home/llvm_all/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/llvm_all/llvm/projects/compiler-rt/lib/builtins/arm/comparesf2.S:50:5: error: invalid operand for instruction
     vmov r0, s0
     ^
/home/llvm_all/llvm/projects/compiler-rt/lib/builtins/arm/comparesf2.S:51:5: error: invalid operand for instruction
     vmov r1, s1
     ^
/home/llvm_all/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/llvm_all/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/llvm_all/llvm/projects/compiler-rt/lib/builtins/arm/comparesf2.S:56:5: error: invalid instruction mnemonic 'orrs'
     orrs r12, r2, r3, lsr #1
     ^~~~
/home/llvm_all/llvm/projects/compiler-rt/lib/builtins/arm/comparesf2.S:58:5: error: invalid instruction mnemonic 'it'
     it ne
     ^~
/home/llvm_all/llvm/projects/compiler-rt/lib/builtins/arm/comparesf2.S:59:5: error: invalid instruction mnemonic 'eorsne'
     eorsne r12, r0, r1
     ^~~~~~
/home/llvm_all/llvm/projects/compiler-rt/lib/builtins/arm/comparesf2.S:61:5: error: invalid instruction mnemonic 'it'
     it pl
     ^~
/home/llvm_all/llvm/projects/compiler-rt/lib/builtins/arm/comparesf2.S:62:5: error: invalid instruction mnemonic 'subspl'
     subspl r0, r2, r3
     ^~~~~~
/home/llvm_all/llvm/projects/compiler-rt/lib/builtins/arm/comparesf2.S:64:5: error: invalid instruction mnemonic 'it'
     it lo
     ^~
/home/llvm_all/llvm/projects/compiler-rt/lib/builtins/arm/comparesf2.S:65:5: error: invalid instruction mnemonic 'mvnlo'
     mvnlo r0, r1, asr #31
     ^~~~~
/home/llvm_all/llvm/projects/compiler-rt/lib/builtins/arm/comparesf2.S:67:5: error: invalid instruction mnemonic 'it'
     it hi
     ^~
/home/llvm_all/llvm/projects/compiler-rt/lib/builtins/arm/comparesf2.S:68:5: error: invalid instruction mnemonic 'movhi'
     movhi r0, r1, asr #31
     ^~~~~
/home/llvm_all/llvm/projects/compiler-rt/lib/builtins/arm/comparesf2.S:70:5: error: invalid instruction mnemonic 'it'
     it ne
     ^~
/home/llvm_all/llvm/projects/compiler-rt/lib/builtins/arm/comparesf2.S:71:19: error: unknown token in expression
     orrne r0, r0, #1
                   ^
/home/llvm_all/llvm/projects/compiler-rt/lib/builtins/arm/comparesf2.S:167:13: error: unknown token in expression
     cmp r2, #0xff000000
             ^
/home/llvm_all/llvm/projects/compiler-rt/lib/builtins/arm/comparesf2.S:168:5: error: invalid instruction mnemonic 'ite'
     ite ls
     ^~~
/home/llvm_all/llvm/projects/compiler-rt/lib/builtins/arm/comparesf2.S:169:15: error: unknown token in expression
     cmpls r3, #0xff000000
               ^
/home/llvm_all/llvm/projects/compiler-rt/lib/builtins/arm/comparesf2.S:170:15: error: unknown token in expression
     movhi r0, #1
               ^
/home/llvm_all/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/llvm_all/llvm/projects/compiler-rt/lib/builtins/arm/comparesf2.S:188:5: error: invalid operand for instruction
     vmov r0, s0
     ^
/home/llvm_all/llvm/projects/compiler-rt/lib/builtins/arm/comparesf2.S:189:5: error: invalid operand for instruction
     vmov r1, s1
     ^
/home/llvm_all/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/llvm_all/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/llvm_all/llvm/projects/compiler-rt/lib/builtins/arm/comparesf2.S:193:5: error: invalid instruction mnemonic 'orrs'
     orrs r12, r2, r3, lsr #1
     ^~~~
/home/llvm_all/llvm/projects/compiler-rt/lib/builtins/arm/comparesf2.S:194:5: error: invalid instruction mnemonic 'it'
     it ne
     ^~
/home/llvm_all/llvm/projects/compiler-rt/lib/builtins/arm/comparesf2.S:195:5: error: invalid instruction mnemonic 'eorsne'
     eorsne r12, r0, r1
     ^~~~~~
/home/llvm_all/llvm/projects/compiler-rt/lib/builtins/arm/comparesf2.S:196:5: error: invalid instruction mnemonic 'it'
     it pl
     ^~
/home/llvm_all/llvm/projects/compiler-rt/lib/builtins/arm/comparesf2.S:197:5: error: invalid instruction mnemonic 'subspl'
     subspl r0, r2, r3
     ^~~~~~
/home/llvm_all/llvm/projects/compiler-rt/lib/builtins/arm/comparesf2.S:198:5: error: invalid instruction mnemonic 'it'
     it lo
     ^~
/home/llvm_all/llvm/projects/compiler-rt/lib/builtins/arm/comparesf2.S:199:5: error: invalid instruction mnemonic 'mvnlo'
     mvnlo r0, r1, asr #31
     ^~~~~
/home/llvm_all/llvm/projects/compiler-rt/lib/builtins/arm/comparesf2.S:200:5: error: invalid instruction mnemonic 'it'
     it hi
     ^~
/home/llvm_all/llvm/projects/compiler-rt/lib/builtins/arm/comparesf2.S:201:5: error: invalid instruction mnemonic 'movhi'
     movhi r0, r1, asr #31
     ^~~~~
/home/llvm_all/llvm/projects/compiler-rt/lib/builtins/arm/comparesf2.S:202:5: error: invalid instruction mnemonic 'it'
     it ne
     ^~
/home/llvm_all/llvm/projects/compiler-rt/lib/builtins/arm/comparesf2.S:203:19: error: unknown token in expression
     orrne r0, r0, #1
                   ^
/home/llvm_all/llvm/projects/compiler-rt/lib/builtins/arm/comparesf2.S:204:13: error: unknown token in expression
     cmp r2, #0xff000000
             ^
/home/llvm_all/llvm/projects/compiler-rt/lib/builtins/arm/comparesf2.S:205:5: error: invalid instruction mnemonic 'ite'
     ite ls
     ^~~
/home/llvm_all/llvm/projects/compiler-rt/lib/builtins/arm/comparesf2.S:206:15: error: unknown token in expression
     cmpls r3, #0xff000000
               ^
/home/llvm_all/llvm/projects/compiler-rt/lib/builtins/arm/comparesf2.S:207:15: error: unknown token in expression
     movhi r0, #-1
               ^
/home/llvm_all/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/llvm_all/llvm/projects/compiler-rt/lib/builtins/arm/comparesf2.S:220:5: error: invalid operand for instruction
     vmov r0, s0
     ^
/home/llvm_all/llvm/projects/compiler-rt/lib/builtins/arm/comparesf2.S:221:5: error: invalid operand for instruction
     vmov r1, s1
     ^
/home/llvm_all/llvm/projects/compiler-rt/lib/builtins/arm/comparesf2.S:224:18: error: unknown token in expression
     lsls r2, r0, #1
                  ^
/home/llvm_all/llvm/projects/compiler-rt/lib/builtins/arm/comparesf2.S:225:18: error: unknown token in expression
     lsls r3, r1, #1
                  ^
/home/llvm_all/llvm/projects/compiler-rt/lib/builtins/arm/comparesf2.S:226:14: error: unknown token in expression
     movs r0, #0
              ^
/home/llvm_all/llvm/projects/compiler-rt/lib/builtins/arm/comparesf2.S:277:13: error: unknown token in expression
     cmp r2, #0xff000000
             ^
/home/llvm_all/llvm/projects/compiler-rt/lib/builtins/arm/comparesf2.S:278:5: error: invalid instruction mnemonic 'ite'
     ite ls
     ^~~
/home/llvm_all/llvm/projects/compiler-rt/lib/builtins/arm/comparesf2.S:279:15: error: unknown token in expression
     cmpls r3, #0xff000000
               ^
/home/llvm_all/llvm/projects/compiler-rt/lib/builtins/arm/comparesf2.S:280:15: error: unknown token in expression
     movhi r0, #1
               ^
/home/llvm_all/llvm/projects/compiler-rt/lib/builtins/arm/comparesf2.S:287:2: error: invalid operand for instruction
  vmov s0, r0
  ^
/home/llvm_all/llvm/projects/compiler-rt/lib/builtins/arm/comparesf2.S:288:2: error: invalid operand for instruction
  vmov s1, r1
  ^
/home/llvm_all/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/clang_rt.builtins-armhf.dir/arm/clzsi2.S.o
FAILED: lib/builtins/CMakeFiles/clang_rt.builtins-armhf.dir/arm/clzsi2.S.o
/usr/local/myclang/bin/clang -DVISIBILITY_HIDDEN  -fno-lto -std=c11 -fPIC -fno-builtin -fvisibility=hidden -fomit-frame-pointer -fomit-frame-pointer -DCOMPILER_RT_ARMHF_TARGET -MD -MT lib/builtins/CMakeFiles/clang_rt.builtins-armhf.dir/arm/clzsi2.S.o -MF lib/builtins/CMakeFiles/clang_rt.builtins-armhf.dir/arm/clzsi2.S.o.d -o lib/builtins/CMakeFiles/clang_rt.builtins-armhf.dir/arm/clzsi2.S.o -c /home/llvm_all/llvm/projects/compiler-rt/lib/builtins/arm/clzsi2.S
/home/llvm_all/llvm/projects/compiler-rt/lib/builtins/arm/clzsi2.S:16:2: error: unknown directive
  .syntax unified
  ^
/home/llvm_all/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/llvm_all/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/llvm_all/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/llvm_all/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/llvm_all/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/llvm_all/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/llvm_all/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/llvm_all/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/llvm_all/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/llvm_all/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/llvm_all/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/llvm_all/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/llvm_all/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/llvm_all/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/clang_rt.builtins-armhf.dir/arm/clzdi2.S.o
FAILED: lib/builtins/CMakeFiles/clang_rt.builtins-armhf.dir/arm/clzdi2.S.o
/usr/local/myclang/bin/clang -DVISIBILITY_HIDDEN  -fno-lto -std=c11 -fPIC -fno-builtin -fvisibility=hidden -fomit-frame-pointer -fomit-frame-pointer -DCOMPILER_RT_ARMHF_TARGET -MD -MT lib/builtins/CMakeFiles/clang_rt.builtins-armhf.dir/arm/clzdi2.S.o -MF lib/builtins/CMakeFiles/clang_rt.builtins-armhf.dir/arm/clzdi2.S.o.d -o lib/builtins/CMakeFiles/clang_rt.builtins-armhf.dir/arm/clzdi2.S.o -c /home/llvm_all/llvm/projects/compiler-rt/lib/builtins/arm/clzdi2.S
/home/llvm_all/llvm/projects/compiler-rt/lib/builtins/arm/clzdi2.S:16:2: error: unknown directive
  .syntax unified
  ^
/home/llvm_all/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/llvm_all/llvm/projects/compiler-rt/lib/builtins/arm/clzdi2.S:51:2: error: invalid instruction mnemonic 'movne'
  movne r0, r1
  ^~~~~
/home/llvm_all/llvm/projects/compiler-rt/lib/builtins/arm/clzdi2.S:53:2: error: invalid instruction mnemonic 'movne'
  movne r1, 1
  ^~~~~
/home/llvm_all/llvm/projects/compiler-rt/lib/builtins/arm/clzdi2.S:54:2: error: invalid instruction mnemonic 'moveq'
  moveq r1, 33
  ^~~~~
/home/llvm_all/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/llvm_all/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/llvm_all/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/llvm_all/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/llvm_all/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/llvm_all/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/llvm_all/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/llvm_all/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/llvm_all/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/llvm_all/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/llvm_all/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/llvm_all/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/llvm_all/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/clang_rt.builtins-armhf.dir/arm/divmodsi4.S.o
FAILED: lib/builtins/CMakeFiles/clang_rt.builtins-armhf.dir/arm/divmodsi4.S.o
/usr/local/myclang/bin/clang -DVISIBILITY_HIDDEN  -fno-lto -std=c11 -fPIC -fno-builtin -fvisibility=hidden -fomit-frame-pointer -fomit-frame-pointer -DCOMPILER_RT_ARMHF_TARGET -MD -MT lib/builtins/CMakeFiles/clang_rt.builtins-armhf.dir/arm/divmodsi4.S.o -MF lib/builtins/CMakeFiles/clang_rt.builtins-armhf.dir/arm/divmodsi4.S.o.d -o lib/builtins/CMakeFiles/clang_rt.builtins-armhf.dir/arm/divmodsi4.S.o -c /home/llvm_all/llvm/projects/compiler-rt/lib/builtins/arm/divmodsi4.S
/home/llvm_all/llvm/projects/compiler-rt/lib/builtins/arm/divmodsi4.S:24:2: error: unknown directive
  .syntax unified
  ^
/home/llvm_all/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/llvm_all/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/llvm_all/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/llvm_all/llvm/projects/compiler-rt/lib/builtins/arm/divmodsi4.S:46:11: error: Invalid rounding mode.
     push {r4-r7, lr} ; add r7, sp, #12
           ^
/home/llvm_all/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/llvm_all/llvm/projects/compiler-rt/lib/builtins/arm/divmodsi4.S:49:5: error: invalid instruction mnemonic 'eor'
     eor r4, r0, r1
     ^~~
/home/llvm_all/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/llvm_all/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/llvm_all/llvm/projects/compiler-rt/lib/builtins/arm/divmodsi4.S:53:5: error: invalid instruction mnemonic 'eor'
     eor ip, r0, r0, asr #31
     ^~~
/home/llvm_all/llvm/projects/compiler-rt/lib/builtins/arm/divmodsi4.S:54:5: error: invalid instruction mnemonic 'eor'
     eor lr, r1, r1, asr #31
     ^~~
/home/llvm_all/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/llvm_all/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/llvm_all/llvm/projects/compiler-rt/lib/builtins/arm/divmodsi4.S:58:5: error: invalid instruction mnemonic 'bl'
     bl __udivmodsi4
     ^~
/home/llvm_all/llvm/projects/compiler-rt/lib/builtins/arm/divmodsi4.S:60:5: error: invalid instruction mnemonic 'ldr'
     ldr r1, [r6]
     ^~~
/home/llvm_all/llvm/projects/compiler-rt/lib/builtins/arm/divmodsi4.S:61:5: error: invalid instruction mnemonic 'eor'
     eor r0, r0, r4, asr #31
     ^~~
/home/llvm_all/llvm/projects/compiler-rt/lib/builtins/arm/divmodsi4.S:62:5: error: invalid instruction mnemonic 'eor'
     eor r1, r1, r5, asr #31
     ^~~
/home/llvm_all/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/llvm_all/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/llvm_all/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/llvm_all/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, <a class="moz-txt-link-freetext" href="https://developer.arm.com/open-source/gnu-toolchain/gnu-rm">https://developer.arm.com/open-source/gnu-toolchain/gnu-rm</a>
-- 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 <a class="moz-txt-link-rfc2396E" href="mailto:llvm-dev@lists.llvm.org"><llvm-dev@lists.llvm.org></a> 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 (<a class="moz-txt-link-freetext" href="https://git.llvm.org/git/clang.git/">https://git.llvm.org/git/clang.git/</a>
a152c7a4b7ba8f4cb9532ead9a38a7121db43d50)
(<a class="moz-txt-link-freetext" href="https://git.llvm.org/git/llvm.git/">https://git.llvm.org/git/llvm.git/</a>
1959ce6f3e01241919968ac1911fd45660239d23)
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
invocation)

on the linking part. I downloaded a sysroot from
<a class="moz-txt-link-freetext" href="https://developer.arm.com/open-source/gnu-toolchain/gnu-a/downloads/8-2-2018-08">https://developer.arm.com/open-source/gnu-toolchain/gnu-a/downloads/8-2-2018-08</a>
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
<a class="moz-txt-link-abbreviated" href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>
<a class="moz-txt-link-freetext" href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a>


_______________________________________________
LLVM Developers mailing list
<a class="moz-txt-link-abbreviated" href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>
<a class="moz-txt-link-freetext" href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a>


_______________________________________________
LLVM Developers mailing list
<a class="moz-txt-link-abbreviated" href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>
<a class="moz-txt-link-freetext" href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a>




</pre>
      </blockquote>
    </blockquote>
    <br>
  </body>
</html>