LLVM 11 on Ubuntu 18.04LTS fails to compile compiler-rt/tsan

Hello Community,

when I’m building llvm 11 (tag llvmorg-11.0.0-rc6) on a Ubuntu 18.04LTS system (VM on a Windows host) I get the compile errors

llvm-project/compiler-rt/lib/tsan/rtl/tsan_rtl_amd64.S:7:1: error: expected identifier or ‘(’ before ‘.’ token .section .text
llvm-project/compiler-rt/lib/tsan/rtl/tsan_rtl_amd64.S:16:5: error: invalid preprocessing directive #Save \# Save scratch registers.
llvm-project/compiler-rt/lib/tsan/rtl/tsan_rtl_amd64.S:212:41: error: stray ‘@’ in program movq _ZN14__interception11real_setjmpE@GOTPCREL(%rip), %rdx

My first guess is that the preprocessor interpretes the comments as directives since they also start with the hash.
I’m compiling with the Ubuntu 18.04 native compiler gcc 7.5

I configured the project with
cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS='clang;clang-tools-extra;libcxx;libcxxabi;libunwind;lldb;compiler-rt;lld;polly;debuginfo-tests' ../llvm

and the that generates the errors is compiled with
/usr/bin/cc -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Iprojects/compiler-rt/lib/tsan -I/home/tkruse/apps/llvm-project/compiler-rt/lib/tsan -I/usr/include/libxml2 -Iinclude -I/home/tkruse/apps/llvm-project/llvm/include -I/home/tkruse/apps/llvm-project/compiler-rt/lib/tsan/.. -x c -fPIC -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-comment -fdiagnostics-color -ffunction-sections -fdata-sections -Wall -Wno-unused-parameter -O3 -DNDEBUG -m64 -fno-lto -fPIC -fno-builtin -fno-exceptions -fomit-frame-pointer -funwind-tables -fno-stack-protector -fvisibility=hidden -fno-lto -O3 -g -Wno-variadic-macros -Wno-non-virtual-dtor -fPIE -fno-rtti -msse3 -Wframe-larger-than=530 --sysroot=. -MD -MT projects/compiler-rt/lib/tsan/CMakeFiles/clang_rt.tsan-x86_64.dir/rtl/tsan_rtl_amd64.S.o -MF projects/compiler-rt/lib/tsan/CMakeFiles/clang_rt.tsan-x86_64.dir/rtl/tsan_rtl_amd64.S.o.d -o projects/compiler-rt/lib/tsan/CMakeFiles/clang_rt.tsan-x86_64.dir/rtl/tsan_rtl_amd64.S.o -c /home/tkruse/apps/llvm-project/compiler-rt/lib/tsan/rtl/tsan_rtl_amd64.S

Does somebody have an idea what’s wrong ?

Thanks in Advance!

Update: I upgraded to Ubuntu20.04LTS (ships with gcc9) and checked out llvmorg-11.0.1-rc1 and it built fine.