Merge branch 'dyn-llvm-rust' into 'master'

Set llvm in rust for redox dynamically linked

See merge request redox-os/redox!1946
This commit is contained in:
Jeremy Soller 2026-02-26 06:17:27 -07:00
commit 0ec8230e3e
5 changed files with 7 additions and 2 deletions

View File

@ -8,6 +8,9 @@ template = "custom"
script = """
DYNAMIC_STATIC_INIT
rsync -av --delete "${COOKBOOK_SOURCE}/" ./
# TODO: fPIC is the default on linux but not on redox and
# required by llvm21 as zstd statically linked there
export CPPFLAGS="$CPPFLAGS -fPIC"
${COOKBOOK_MAKE}
${COOKBOOK_MAKE} install DESTDIR="${COOKBOOK_STAGE}" prefix="/usr"
"""

View File

@ -40,6 +40,7 @@ COOKBOOK_CMAKE_FLAGS+=(
-DLLVM_TOOL_LLVM_PROFDATA_BUILD=On
-DLLVM_TARGETS_TO_BUILD="$LLVM_TARGETS_TO_BUILD"
-DLLVM_ENABLE_ZLIB=Off
-DLLVM_USE_STATIC_ZSTD=On
# the rest of options that shared to clang
-DCROSS_TOOLCHAIN_FLAGS_NATIVE="-DCMAKE_TOOLCHAIN_FILE=$(realpath "${COOKBOOK_RECIPE}/native.cmake")"
@ -64,7 +65,6 @@ if [ "${COOKBOOK_HOST_SYSROOT}" = "/usr" ]; then
# avoid linking as much as possible during bootstrapping
COOKBOOK_CMAKE_FLAGS+=(
-DLLVM_ENABLE_LIBXML2=Off
-DLLVM_USE_STATIC_ZSTD=On
)
fi

View File

@ -1,7 +1,6 @@
[llvm]
download-ci-llvm = false
static-libstdcpp = false
# shared with lld
link-shared = true
[build]

View File

@ -3,6 +3,7 @@ download-ci-llvm = false
static-libstdcpp = false
targets = "X86"
experimental-targets = ""
link-shared = true
[build]
host = ["x86_64-unknown-redox"]

View File

@ -35,6 +35,8 @@ export CARGO_TARGET_X86_64_UNKNOWN_REDOX_RUSTFLAGS="\
-Clink-args=-lz -Clink-args=-lzstd"
# Hack for Rust errorneusly running `llvm-config --version` on cross compiled llvm-config
cat "${COOKBOOK_ROOT}/bin/x86_64-unknown-redox-llvm-config" > "${COOKBOOK_SYSROOT}/bin/llvm-config"
# Hack for Rust stage1 being dynamically linked with LLVM in prefix toolchain
export LD_LIBRARY_PATH="${COOKBOOK_HOST_SYSROOT}/lib:${LD_LIBRARY_PATH}"
# Linker flags for stage1 compiler (host -> host)
export RUSTFLAGS_BOOTSTRAP="\
-Clink-args=-L${COOKBOOK_HOST_SYSROOT}/lib \