Problems building three-stage LLVM 10.0.0 on macOS

Hello,

I am working on a three stage LLVM on macOS based on LLVM 10.0.0. The
first stage is just clang, libc++ and compiler-rt built with Xcode, no
problem.

The second stage in this case is a clang that's instrumented built
with the first stage.

The third stage is a clang built with the first stage but with PGO
data from the second stage. In this version I enable LTO and
whole-program-vtables.

This builds clang fine - but compiler-rt fails in the lipo stage:

llvm-lipo: error:
'/var/folders/5c/85r7gp0909j5jbytzds1j7b40000gn/T/InstrProfilingMerge-72375a.o':
The file was not recognized as a valid object file

This happened first with the system lipo - I thought that was because
Xcode lipo didn't understand newer bitcode for LTO so I switched to
llvm-lipo (by a symlink) but I still get the same error.

Any ideas on how to fix this except turning of LTO? Should I build
compiler-rt separately without LTO?

Thanks,
Tobias