libunwind build errors on aarch64 during LLVM/Clang installation

I try to build LLVM/Clang 3.8.1 on Tegra X1 (aarch64) and libunwind is needed. Compilation failed when try to build libunwind with the following compilation errors:

[ 51%] Building C object
projects/libunwind/src/CMakeFiles/unwind.dir/UnwindRegistersRestore.S.o
/mnt/SD/hipacc/tar_llvm/llvm-3.8.1.src/projects/libunwind/src/UnwindRegistersRestore.S:270:74:
warning: invoking macro GLUE2 argument 1: empty macro arguments are
undefined in ISO C90 and ISO C++98 [enabled by default]
DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind15Registers_arm646jumptoEv)
^
/mnt/SD/hipacc/tar_llvm/llvm-3.8.1.src/projects/libunwind/src/UnwindRegistersRestore.S:270:74:
warning: invoking macro GLUE2 argument 1: empty macro arguments are
undefined in ISO C90 and ISO C++98 [enabled by default]
/mnt/SD/hipacc/tar_llvm/llvm-3.8.1.src/projects/libunwind/src/UnwindRegistersRestore.S:270:74:
warning: invoking macro GLUE2 argument 1: empty macro arguments are
undefined in ISO C90 and ISO C++98 [enabled by default]
/mnt/SD/hipacc/tar_llvm/llvm-3.8.1.src/projects/libunwind/src/UnwindRegistersRestore.S:270:74:
warning: invoking macro GLUE2 argument 1: empty macro arguments are
undefined in ISO C90 and ISO C++98 [enabled by default]
/mnt/SD/hipacc/tar_llvm/llvm-3.8.1.src/projects/libunwind/src/UnwindRegistersRestore.S:
Assembler messages:
/mnt/SD/hipacc/tar_llvm/llvm-3.8.1.src/projects/libunwind/src/UnwindRegistersRestore.S:285:
Error: operand 2 should be an integer register – ldp x28,fp,[x0,#0x0E0]' /mnt/SD/hipacc/tar_llvm/llvm-3.8.1.src/projects/libunwind/src/UnwindRegistersRestore.S:286: Error: operand 1 should be an integer register -- ldr lr,[x0,#0x100]’
/mnt/SD/hipacc/tar_llvm/llvm-3.8.1.src/projects/libunwind/src/UnwindRegistersRestore.S:309:
Error: operand 1 should be an integer register – `ret lr’
projects/libunwind/src/CMakeFiles/unwind.dir/build.make:182: recipe for
target
‘projects/libunwind/src/CMakeFiles/unwind.dir/UnwindRegistersRestore.S.o’
failed
make[2]: ***
[projects/libunwind/src/CMakeFiles/unwind.dir/UnwindRegistersRestore.S.o]
Error 1
CMakeFiles/Makefile2:12542: recipe for target
‘projects/libunwind/src/CMakeFiles/unwind.dir/all’ failed
make[1]: *** [projects/libunwind/src/CMakeFiles/unwind.dir/all] Error 2
Makefile:149: recipe for target ‘all’ failed
make: *** [all] Error 2

Os: Ubuntu 16.04, gcc/g++ : 4.8

I already installed this same clang version on two PC x86, Ubuntu OS, gcc / g ++ 4.8 without any problems. I can’t find any information on internet. I hope you can help me with this
problem.
Thanks.

The GNU assembler doesn't support "fp" as an alias for "x29" so it's
complaining about that load instruction. Similarly "lr" is an alias
for "x30".

Libunwind in trunk has been fixed to be compatible with GNU now (the
instruction is "ldp x28, x29, [x0, #0x0e0]" etc) but obviously that
happened after 3.8 branched (it *was* quite a while ago, you're almost
always better using the latest release for LLVM). There'll be a
similar errors in UnwindRegistersSave.S.

Cheers.

Tim.