<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <p>Hello again! <br>
    </p>
    <p>Tried out the small Hello World Setup, worked as intended:</p>
    <p>root@christian-forschung-virtual-machine:/home/progs# clang -v
      --target=arm-linux-gnueabihf hello.c -o hello -fuse-ld=lld
      <br>
      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)
      <br>
      Target: arm-unknown-linux-gnueabihf
      <br>
      Thread model: posix
      <br>
      InstalledDir: /usr/local/myclang/bin
      <br>
      Found candidate GCC installation:
      /usr/lib/gcc-cross/arm-linux-gnueabihf/7
      <br>
      Found candidate GCC installation:
      /usr/lib/gcc-cross/arm-linux-gnueabihf/7.3.0
      <br>
      Selected GCC installation:
      /usr/lib/gcc-cross/arm-linux-gnueabihf/7.3.0
      <br>
      Candidate multilib: .;@m32
      <br>
      Selected multilib: .;@m32
      <br>
       "/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
      <br>
      clang -cc1 version 8.0.0 based upon LLVM 8.0.0svn default target
      x86_64-unknown-linux-gnu
      <br>
      ignoring nonexistent directory "/include"
      <br>
      #include "..." search starts here:
      <br>
      #include <...> search starts here:
      <br>
       /usr/local/include
      <br>
       /usr/local/myclang/lib/clang/8.0.0/include
      <br>
       /usr/include
      <br>
      End of search list.
      <br>
       "/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 <i class="moz-txt-slash"><span
          class="moz-txt-tag">/</span>usr/lib/gcc-cross/arm-linux-gnueabihf/7.3.0/../../../../arm-linux-gnueabihf/lib<span
          class="moz-txt-tag">/</span></i>../lib/crt1.o <i
        class="moz-txt-slash"><span class="moz-txt-tag">/</span>usr/lib/gcc-cross/arm-linux-gnueabihf/7.3.0/../../../../arm-linux-gnueabihf/lib<span
          class="moz-txt-tag">/</span></i>../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/../../../..<i
        class="moz-txt-slash"><span class="moz-txt-tag">/</span>arm-linux-gnueabihf/lib<span
          class="moz-txt-tag">/</span></i>../lib
      -L/usr/lib/gcc-cross/arm-linux-gnueabihf/7.3.0/../../../../lib
      -L/usr/local/myclang/bin/..<i class="moz-txt-slash"><span
          class="moz-txt-tag">/</span>lib -L/lib<span
          class="moz-txt-tag">/</span></i>..<i class="moz-txt-slash"><span
          class="moz-txt-tag">/</span>lib -L/usr/lib<span
          class="moz-txt-tag">/</span></i>../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 <i
        class="moz-txt-slash"><span class="moz-txt-tag">/</span>usr/lib/gcc-cross/arm-linux-gnueabihf/7.3.0/../../../../arm-linux-gnueabihf/lib<span
          class="moz-txt-tag">/</span></i>../lib/crtn.o <br>
    </p>
    <p>root@christian-forschung-virtual-machine:/home/progs# qemu-arm -L
      /usr/arm-linux-gnueabihf hello</p>
    <p>Hello, World!</p>
    <p>So far, so good. The Paths written more readable seem to be <br>
    </p>
    <p class="MsoNormal">/usr/local/myclang/lib, /lib, /usr/lib,
      /usr/arm-linux-gnueabihf/lib, so no surprised there. <br>
    </p>
    <p class="MsoNormal"><span style="mso-ansi-language:EN-US"
        lang="EN-US">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:<br>
      </span></p>
    <p class="MsoNormal">cmake -G "Ninja" ..<i class="moz-txt-slash"><span
          class="moz-txt-tag">/</span>llvm/projects/compiler-rt<span
          class="moz-txt-tag">/</span></i>
      -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" <br>
    </p>
    <p class="MsoNormal">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.</p>
    <p class="MsoNormal">The ninja builtins output: <br>
    </p>
    <p class="MsoNormal">root@christian-forschung-virtual-machine:/home/llvm_all/buildrtonly#
      ninja builtins
      <br>
      [147/207] Building C object
      lib/builtins/CMakeFiles/clang_rt.builtins-armhf.dir/emutls.c.o
      <br>
      FAILED:
      lib/builtins/CMakeFiles/clang_rt.builtins-armhf.dir/emutls.c.o
      <br>
      /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
      <br>
      In file included from
      /home/llvm_all/llvm/projects/compiler-rt/lib/builtins/emutls.c:41:
      <br>
      /usr/include/pthread.h:682:6: error: 'regparm' is not valid on
      this platform
      <br>
           __cleanup_fct_attribute;
      <br>
           ^~~~~~~~~~~~~~~~~~~~~~~
      <br>
      /usr/include/bits/pthreadtypes-arch.h:103:50: note: expanded from
      macro '__cleanup_fct_attribute'
      <br>
      # define __cleanup_fct_attribute __attribute__ ((__regparm__ (1)))
      <br>
                                                       ^            ~
      <br>
      In file included from
      /home/llvm_all/llvm/projects/compiler-rt/lib/builtins/emutls.c:41:
      <br>
      /usr/include/pthread.h:694:3: error: 'regparm' is not valid on
      this platform
      <br>
        __cleanup_fct_attribute;
      <br>
        ^~~~~~~~~~~~~~~~~~~~~~~
      <br>
      /usr/include/bits/pthreadtypes-arch.h:103:50: note: expanded from
      macro '__cleanup_fct_attribute'
      <br>
      # define __cleanup_fct_attribute __attribute__ ((__regparm__ (1)))
      <br>
                                                       ^            ~
      <br>
      In file included from
      /home/llvm_all/llvm/projects/compiler-rt/lib/builtins/emutls.c:41:
      <br>
      /usr/include/pthread.h:735:6: error: 'regparm' is not valid on
      this platform
      <br>
           __cleanup_fct_attribute __attribute__ ((__noreturn__))
      <br>
           ^~~~~~~~~~~~~~~~~~~~~~~
      <br>
      /usr/include/bits/pthreadtypes-arch.h:103:50: note: expanded from
      macro '__cleanup_fct_attribute'
      <br>
      # define __cleanup_fct_attribute __attribute__ ((__regparm__ (1)))
      <br>
                                                       ^            ~
      <br>
      3 errors generated.
      <br>
      [148/207] Building C object
lib/builtins/CMakeFiles/clang_rt.builtins-armhf.dir/gcc_personality_v0.c.o<br>
/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]
      <br>
      _Unwind_Reason_Code __gnu_unwind_frame(struct _Unwind_Exception *,
      <br>
                                                    ^
      <br>
/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]
      <br>
      continueUnwind(struct _Unwind_Exception *exceptionObject,
      <br>
                            ^
      <br>
/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]
      <br>
          if (__gnu_unwind_frame(exceptionObject, context) != _URC_OK)
      <br>
                                 ^~~~~~~~~~~~~~~
      <br>
/home/llvm_all/llvm/projects/compiler-rt/lib/builtins/gcc_personality_v0.c:148:66:
      note: passing argument to parameter here
      <br>
      _Unwind_Reason_Code __gnu_unwind_frame(struct _Unwind_Exception *,
      <br>
                                                                       ^
      <br>
/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]
      <br>
               _Unwind_State state, struct _Unwind_Exception
      *exceptionObject,
      <br>
                                           ^
      <br>
/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]
      <br>
              return continueUnwind(exceptionObject, context);
      <br>
                                    ^~~~~~~~~~~~~~~
      <br>
/home/llvm_all/llvm/projects/compiler-rt/lib/builtins/gcc_personality_v0.c:153:42:
      note: passing argument to parameter 'exceptionObject' here
      <br>
      continueUnwind(struct _Unwind_Exception *exceptionObject,
      <br>
                                               ^
      <br>
/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]
      <br>
              return continueUnwind(exceptionObject, context);
      <br>
                                    ^~~~~~~~~~~~~~~
      <br>
/home/llvm_all/llvm/projects/compiler-rt/lib/builtins/gcc_personality_v0.c:153:42:
      note: passing argument to parameter 'exceptionObject' here
      <br>
      continueUnwind(struct _Unwind_Exception *exceptionObject,
      <br>
                                               ^
      <br>
/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]
      <br>
          return continueUnwind(exceptionObject, context);
      <br>
                                ^~~~~~~~~~~~~~~
      <br>
/home/llvm_all/llvm/projects/compiler-rt/lib/builtins/gcc_personality_v0.c:153:42:
      note: passing argument to parameter 'exceptionObject' here
      <br>
      continueUnwind(struct _Unwind_Exception *exceptionObject,
      <br>
                                               ^
      <br>
      7 warnings generated.
      <br>
      [152/207] Building ASM object
      lib/builtins/CMakeFiles/clang_rt.builtins-armhf.dir/arm/aeabi_cdcmp.S.o
      <br>
      ninja: build stopped: subcommand failed.
    </p>
    <p class="MsoNormal">Almost there! Thanks in advance!</p>
    <p class="MsoNormal">Christian<br>
    </p>
    <p>
    </p>
    <p><br>
    </p>
    <br>
    <div class="moz-cite-prefix">On 07.12.2018 17:40, Peter Smith wrote:<br>
    </div>
    <blockquote
cite="mid:CAEt-8LA8fM3jZANiQvH2ZaW4V69LXd-OgfWMTxY7je4QFx=7LQ@mail.gmail.com"
      type="cite">
      <pre wrap="">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:
</pre>
      <blockquote type="cite">
        <pre wrap="">
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":

</pre>
      </blockquote>
      <pre wrap="">
Thanks for the comments. I will try and revisit that document next
week and will post an update.

</pre>
      <blockquote type="cite">
        <pre wrap="">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.

</pre>
      </blockquote>
      <pre wrap="">
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

</pre>
      <blockquote type="cite">
        <pre wrap="">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:
</pre>
        <blockquote type="cite">
          <pre wrap="">
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>
</pre>
        </blockquote>
        <pre wrap="">


_______________________________________________
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>