(This test was done on a powerpc64 for TARGET_ARCH=powerpc64, not cross compiling. Compared to my normal, successful buildworld I just added WITH_LLVM_LIBUNWIND= to the SRC_CONF_ENV file that I use.) I list parts of the .meta file contents for 3 files that got errors: # Meta data file /usr/obj/powerpc64vtsc_clang_altbinutils_world/powerpc.powerpc64/usr/src/lib/libgcc_eh/libunwind.o.meta CMD /usr/bin/clang++ -B /usr/local/powerpc64-freebsd/bin/ -target powerpc64-unknown-freebsd12.0 --sysroot=/usr/obj/powerpc64vtsc_clang_altbinutils_world/powerpc.powerpc64/usr/src/tmp -B/usr/local/powerpc64-freebsd/bin/ -fvisibility=hidden -fPIC -O2 -pipe -I/usr/src/contrib/llvm/projects/libunwind/include -I/usr/src/lib/libgcc_eh -D_LIBUNWIND_IS_NATIVE_ONLY -Wsystem-headers -Wall -Wno-format-y2k -Wno-uninitialized -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable -Wno-tautological-compare -Wno-unused-value -Wno-parentheses-equality -Wno-unused-function -Wno-enum-conversion -Wno-unused-local-typedef -Wno-switch -Wno-switch-enum -Wno-knr-promoted-parameter -Qunused-arguments -std=c++11 -fno-rtti -Wno-c++11-extensions -c /usr/src/contrib/llvm/projects/libunwind/src/libunwind.cpp -o libunwind.o CWD /usr/obj/powerpc64vtsc_clang_altbinutils_world/powerpc.powerpc64/usr/src/lib/libgcc_eh TARGET libunwind.o -- command output -- In file included from /usr/src/contrib/llvm/projects/libunwind/src/libunwind.cpp:27: /usr/src/contrib/llvm/projects/libunwind/src/UnwindCursor.hpp:612:3: error: static_assert failed "UnwindCursor<> does not fit in unw_cursor_t" static_assert((check_fit<UnwindCursor<A, R>, unw_cursor_t>::does_fit), ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/src/contrib/llvm/projects/libunwind/src/libunwind.cpp:68:24: note: in instantiation of member function 'libunwind::UnwindCursor<libunwind::LocalAddressSpace, libunwind::Registers_ppc>::UnwindCursor' requested here new ((void *)cursor) UnwindCursor<LocalAddressSpace, REGISTER_KIND>( ^ 1 error generated. *** Error code 1 # Meta data file /usr/obj/powerpc64vtsc_clang_altbinutils_world/powerpc.powerpc64/usr/src/lib/libgcc_eh/UnwindRegistersRestore.o.meta CMD /usr/bin/clang -B /usr/local/powerpc64-freebsd/bin/ -target powerpc64-unknown-freebsd12.0 --sysroot=/usr/obj/powerpc64vtsc_clang_altbinutils_world/powerpc.powerpc64/usr/src/tmp -B/usr/local/powerpc64-freebsd/bin/ -O2 -pipe -I/usr/src/contrib/llvm/projects/libunwind/include -I/usr/src/lib/libgcc_eh -D_LIBUNWIND_IS_NATIVE_ONLY -std=gnu99 -Wsystem-headers -Wall -Wno-format-y2k -Wno-uninitialized -Wno-pointer-sign -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable -Wno-tautological-compare -Wno-unused-value -Wno-parentheses-equality -Wno-unused-function -Wno-enum-conversion -Wno-unused-local-typedef -Wno-switch -Wno-switch-enum -Wno-knr-promoted-parameter -Qunused-arguments -c /usr/src/contrib/llvm/projects/libunwind/src/UnwindRegistersRestore.S -o UnwindRegistersRestore.o CMD CWD /usr/obj/powerpc64vtsc_clang_altbinutils_world/powerpc.powerpc64/usr/src/lib/libgcc_eh TARGET UnwindRegistersRestore.o -- command output -- /usr/src/contrib/llvm/projects/libunwind/src/UnwindRegistersRestore.S:98:46: error: unexpected token in directive .globl _ZN9libunwind13Registers_ppc6jumptoEv @ .hidden _ZN9libunwind13Registers_ppc6jumptoEv @ .type _ZN9libunwind13Registers_ppc6jumptoEv,@function @ _ZN9libunwind13Registers_ppc6jumptoEv: ^ /usr/src/contrib/llvm/projects/libunwind/src/UnwindRegistersRestore.S:100:3: error: unrecognized instruction mnemonic ; void libunwind::Registers_ppc::jumpto() ^ /usr/src/contrib/llvm/projects/libunwind/src/UnwindRegistersRestore.S:100:17: error: unexpected token at start of statement ; void libunwind::Registers_ppc::jumpto() ^ /usr/src/contrib/llvm/projects/libunwind/src/UnwindRegistersRestore.S:102:3: error: unrecognized instruction mnemonic ; On entry: ^ /usr/src/contrib/llvm/projects/libunwind/src/UnwindRegistersRestore.S:102:11: error: unexpected token at start of statement ; On entry: ^ /usr/src/contrib/llvm/projects/libunwind/src/UnwindRegistersRestore.S:103:3: error: unrecognized instruction mnemonic ; thread_state pointer is in r3 ^ /usr/src/contrib/llvm/projects/libunwind/src/UnwindRegistersRestore.S:103:24: error: unrecognized instruction mnemonic ; thread_state pointer is in r3 ^ /usr/src/contrib/llvm/projects/libunwind/src/UnwindRegistersRestore.S:103:30: error: unrecognized instruction mnemonic ; thread_state pointer is in r3 ^ . . . (a very long list) . . . # Meta data file /usr/obj/powerpc64vtsc_clang_altbinutils_world/powerpc.powerpc64/usr/src/lib/libgcc_eh/UnwindRegistersSave.o.meta CMD /usr/bin/clang -B /usr/local/powerpc64-freebsd/bin/ -target powerpc64-unknown-freebsd12.0 --sysroot=/usr/obj/powerpc64vtsc_clang_altbinutils_world/powerpc.powerpc64/usr/src/tmp -B/usr/local/powerpc64-freebsd/bin/ -O2 -pipe -I/usr/src/contrib/llvm/projects/libunwind/include -I/usr/src/lib/libgcc_eh -D_LIBUNWIND_IS_NATIVE_ONLY -std=gnu99 -Wsystem-headers -Wall -Wno-format-y2k -Wno-uninitialized -Wno-pointer-sign -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable -Wno-tautological-compare -Wno-unused-value -Wno-parentheses-equality -Wno-unused-function -Wno-enum-conversion -Wno-unused-local-typedef -Wno-switch -Wno-switch-enum -Wno-knr-promoted-parameter -Qunused-arguments -c /usr/src/contrib/llvm/projects/libunwind/src/UnwindRegistersSave.S -o UnwindRegistersSave.o CMD CWD /usr/obj/powerpc64vtsc_clang_altbinutils_world/powerpc.powerpc64/usr/src/lib/libgcc_eh TARGET UnwindRegistersSave.o -- command output -- /usr/src/contrib/llvm/projects/libunwind/src/UnwindRegistersSave.S:102:3: error: unrecognized instruction mnemonic ; extern int unw_getcontext(unw_context_t* thread_state) ^ /usr/src/contrib/llvm/projects/libunwind/src/UnwindRegistersSave.S:102:14: error: unrecognized instruction mnemonic ; extern int unw_getcontext(unw_context_t* thread_state) ^ /usr/src/contrib/llvm/projects/libunwind/src/UnwindRegistersSave.S:104:3: error: unrecognized instruction mnemonic ; On entry: ^ /usr/src/contrib/llvm/projects/libunwind/src/UnwindRegistersSave.S:104:11: error: unexpected token at start of statement ; On entry: ^ /usr/src/contrib/llvm/projects/libunwind/src/UnwindRegistersSave.S:105:3: error: unrecognized instruction mnemonic ; thread_state pointer is in r3 ^ /usr/src/contrib/llvm/projects/libunwind/src/UnwindRegistersSave.S:105:24: error: unrecognized instruction mnemonic ; thread_state pointer is in r3 ^ /usr/src/contrib/llvm/projects/libunwind/src/UnwindRegistersSave.S:105:30: error: unrecognized instruction mnemonic ; thread_state pointer is in r3 ^ /usr/src/contrib/llvm/projects/libunwind/src/UnwindRegistersSave.S:107:23: error: unexpected token in directive .globl unw_getcontext @ .type unw_getcontext,@function @ unw_getcontext: ^ /usr/src/contrib/llvm/projects/libunwind/src/UnwindRegistersSave.S:108:13: error: invalid memory operand stw r0, 8(r3) ^ /usr/src/contrib/llvm/projects/libunwind/src/UnwindRegistersSave.S:108:15: error: unknown operand stw r0, 8(r3) ^ /usr/src/contrib/llvm/projects/libunwind/src/UnwindRegistersSave.S:108:15: error: unexpected token at start of statement stw r0, 8(r3) ^ /usr/src/contrib/llvm/projects/libunwind/src/UnwindRegistersSave.S:109:8: error: invalid operand for instruction mflr r0 ^ /usr/src/contrib/llvm/projects/libunwind/src/UnwindRegistersSave.S:110:13: error: invalid memory operand stw r0, 0(r3) ; store lr as ssr0 ^ /usr/src/contrib/llvm/projects/libunwind/src/UnwindRegistersSave.S:110:15: error: unknown operand stw r0, 0(r3) ; store lr as ssr0 ^ /usr/src/contrib/llvm/projects/libunwind/src/UnwindRegistersSave.S:110:15: error: unexpected token at start of statement stw r0, 0(r3) ; store lr as ssr0 ^ /usr/src/contrib/llvm/projects/libunwind/src/UnwindRegistersSave.S:110:19: error: unrecognized instruction mnemonic stw r0, 0(r3) ; store lr as ssr0 ^ /usr/src/contrib/llvm/projects/libunwind/src/UnwindRegistersSave.S:110:28: error: unrecognized instruction mnemonic stw r0, 0(r3) ; store lr as ssr0 ^ /usr/src/contrib/llvm/projects/libunwind/src/UnwindRegistersSave.S:111:14: error: invalid memory operand stw r1, 12(r3) ^ /usr/src/contrib/llvm/projects/libunwind/src/UnwindRegistersSave.S:111:16: error: unknown operand stw r1, 12(r3) ^ . . . (Another very long list) . . .
The naked 'r*' and 'f*' register designations are a Darwinism. SysV notation requires '%r*' and '%f*', or naked numbers. This should probably be filed upstream as well.
(In reply to Justin Hibbits from comment #1) I have submitted llvm 31590 for the UnwindRegisters*.S related syntax error reports. (Not covering libunwind.cpp's static assert failure.) While I placed it against llvm's/clang's powerpc support initially my guess is they may reclassify it as against libunwind's source. (I did not find where to classify something as a libunwind issue and I also took the point of view that their compiler infrastructure was supposed to be able to parse their project's source code.) Of course they might end up declaring that llvm/projects/libunwind/ is intentionally darwin-specific for powerpc64 and powerpc and so only is expected to compile for a darwin target relative to what they support. (I've no clue of their policy/intent for such.)
Note: I recently posted to a list that the problems still exist as of head -r339076 . This was in reply to a suggestion to try it. But the particular experiment was adding WITH_LLVM_LIBUNWIND= to a src.conf type of file for using devel/powerpc64-gcc to do the build (on a powerpc64). [clang is still not up to it.] For example, UnwindRegistersRestore.S did not get the C-preprocessor handling that it is designed for and the __ppc__ assembler notation still has "register designations are a Darwinism" status. The ";" comment notation also might be a Darwinism as far as I know. WITH_LLVM_LIBUNWIND= is not yet an option for powerpc64 and the like.
Head -r349793 picked up the last of the 8.0.1 rc3 changes for dealing with TOC (r2) save/restore for powerpc64, prior updates having gotten past the asserts and having .S files that are not rejected. 8.0.1 has not been merged to stable/12 yet.
Things have progressed to powerpc64 and 32-bit powerpc being built by llvm (more recent versions), including use of its libunwind. The reported problem is gone.