Author: Minsoo Choo
Date: 2026-03-20T13:41:06+08:00
New Revision: 984417de3f37ae21c49a0a78058f3e6d28bc2ed4

URL: 
https://github.com/llvm/llvm-project/commit/984417de3f37ae21c49a0a78058f3e6d28bc2ed4
DIFF: 
https://github.com/llvm/llvm-project/commit/984417de3f37ae21c49a0a78058f3e6d28bc2ed4.diff

LOG: [lldb][doc] Add cross-compilation guide for FreeBSD (#186216)

This is instruction for cross-compiling LLDB on FreeBSD based on
@mgorny's [blog
post](https://web.archive.org/web/20250827001729/https://www.moritz.systems/blog/freebsd-remote-process-plugin-on-non-x86-architectures/).
Tested building arm64 binary on amd64 machine and building amd64 binary
on arm64 machine.

---------

Signed-off-by: Minsoo Choo <[email protected]>
Co-authored-by: Michał Górny <[email protected]>

Added: 
    

Modified: 
    lldb/docs/resources/build.rst

Removed: 
    


################################################################################
diff  --git a/lldb/docs/resources/build.rst b/lldb/docs/resources/build.rst
index 9f76b3a6719c6..7e1928a09c532 100644
--- a/lldb/docs/resources/build.rst
+++ b/lldb/docs/resources/build.rst
@@ -653,6 +653,40 @@ arm64 build:
 Note that currently only lldb-server is functional on android. The lldb client
 is not supported and unlikely to work.
 
+Example 4: Cross-compiling for FreeBSD arm64 on FreeBSD host using distset
+**************************************************************************
+
+Start by identifying the FreeBSD version you want to target — in this case,
+FreeBSD 15.0.
+
+Download and decompress the FreeBSD 15.0 distset:
+
+::
+
+  fetch https://download.freebsd.org/releases/arm64/15.0-RELEASE/base.txz
+  sudo mkdir -p /path/to/sysroot/arm64
+  sudo tar -xJf base.txz -C /path/to/sysroot/arm64
+
+Then configure with CMake as follows:
+
+::
+
+  cmake <path-to-monorepo>/llvm-project/llvm -G Ninja \
+    -DCMAKE_BUILD_TYPE=Release \
+    -DLLVM_ENABLE_PROJECTS="clang;lldb" \
+    -DCMAKE_SYSTEM_NAME=FreeBSD \
+    -DCMAKE_SYSTEM_PROCESSOR=AArch64 \
+    -DCMAKE_ASM_FLAGS_INIT="-target aarch64-unknown-freebsd15.0 --sysroot 
/path/to/sysroot/arm64" \
+    -DCMAKE_C_FLAGS_INIT="-target aarch64-unknown-freebsd15.0 --sysroot 
/path/to/sysroot/arm64" \
+    -DCMAKE_CXX_FLAGS_INIT="-target aarch64-unknown-freebsd15.0 --sysroot 
/path/to/sysroot/arm64" \
+    -DCMAKE_FIND_ROOT_PATH="/path/to/sysroot/arm64" \
+    -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER \
+    -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY \
+    -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY \
+    -DLLVM_DEFAULT_TARGET_TRIPLE=aarch64-unknown-freebsd15.0 \
+    -DLLVM_HOST_TRIPLE=aarch64-unknown-freebsd15.0 \
+    -DLLVM_TARGET_ARCH=AArch64
+
 Verifying Python Support
 ------------------------
 


        
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to