Page MenuHomeFreeBSD

Fix bootstrapping to actually build lldb-tblgen for later use
ClosedPublic

Authored by jrtc27 on Aug 13 2021, 5:57 PM.
Tags
None
Referenced Files
F106014368: D31531.diff
Mon, Dec 23, 10:21 PM
Unknown Object (File)
Thu, Dec 19, 10:56 PM
Unknown Object (File)
Wed, Dec 4, 10:29 AM
Unknown Object (File)
Mon, Nov 25, 2:14 AM
Unknown Object (File)
Nov 14 2024, 12:26 PM
Unknown Object (File)
Nov 13 2024, 12:34 AM
Unknown Object (File)
Nov 11 2024, 8:47 AM
Unknown Object (File)
Nov 11 2024, 7:48 AM
Subscribers
None

Details

Summary

Because MK_LLDB=no is in BSARGS, the bootstrap-tools recursive make does
not add lldb-tblgen to _clang_tblgen, causing it to not be built. This
means that the build currently always uses the host's lldb-tblgen
(which, whilst currently it appears to work, could in future break if
TableGen backends are added or altered) and, if it doesn't exist (either
because the current FreeBSD system was built with it disabled, or you're
building on macOS/Linux), fails. Linux and macOS cross-builds used to
work simply because LLDB was previously in BROKEN_OPTIONS when building
on non-FreeBSD.

Instead, move MK_LLDB=no from BSARGS to XMAKE. This ensures that the
lib/clang build in cross-tools continues to not build LLDB parts for the
bootstrap toolchain (both to save time/space on FreeBSD, and because our
vendored LLDB does not include the macOS and Linux host files so those
would fail to build).

The DIRDEPS target is updated to move MK_LLDB=no from the BSARGS block
that mirrors Makefile.inc1 to the line that disables additional
toolchain components. The DIRDEPS build likely suffers from the same
issue currently, but having never used it and not being familiar with
how it works I am leaving that as-is. If it does suffer from the same
issue it should be easily reproducible by renaming /usr/bin/lldb-tblgen
or moving it to a directory not in PATH.

Fixes: 31ba4ce8898f ("Allow bootstrapping llvm-tblgen on macOS and Linux")
MFC after: 1 week

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 41026
Build 37915: arc lint + arc unit

Event Timeline

jrtc27 created this revision.

I think this is OK. I was worried about the MK_LLDB=no in the cross-tools stage, but lldb isn't part of the toolchain, so it shouldn't matter.

This revision is now accepted and ready to land.Aug 13 2021, 6:00 PM

XMAKE is based on BMAKE which contains BSARGS so it currently already contains MK_LLDB=no, I'm just making sure to preserve that (should perhaps have been clearer in the commit message)

targets/pseudo/bootstrap-tools/Makefile
92–95

My guess for the correct fix for here is to add :NMK_LLDB=* above and LLDB_TBLGEN here?..

targets/pseudo/bootstrap-tools/Makefile
92–95

Yes, LLDB_TBLGEN is picked up in lib/clang/liblldb/Makefile as:

LLDB_TBLGEN?=   lldb-tblgen

so it should be set to the bootstrap lldb-tblgen before going into that directory, similar to LLVM_TBLGEN for lib/clang/libllvm, and CLANG_TBLGEN for lib/clang/libclang.