Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ are also provided as separate assets for each supported platform to facilitate
decompression.

Windows builds support Release mode only. The Linux and macOS build scripts also
support Debug mode. macOS builds require Apple silicon (`arm64`).
support Debug mode. macOS builds require macOS 13.3 or newer on Apple silicon
(`arm64`).

## Installation

Expand Down Expand Up @@ -45,3 +46,7 @@ Build scripts accept `LLVM_ENABLE_ASSERTIONS=ON` (the default) or `OFF`; release
CI builds and tests both. Always use headers and libraries from the same
variant. Both variants contain native static libraries and tools, with LLVM
exception handling and RTTI disabled.

Assertion-free Linux SDKs include `llvm-bolt`, `merge-fdata`, and the BOLT
instrumentation runtime. Consumers own profiling, optimization, and validation
of their final binaries. Keep symbols and relocations until BOLT finishes.
13 changes: 9 additions & 4 deletions scripts/toolchain/linux/in-container.sh
Original file line number Diff line number Diff line change
Expand Up @@ -198,14 +198,19 @@ build_mlir() {
local mold_bin_dir="$mold_extract_dir/bin"
export PATH="$mold_bin_dir:$PATH"

local llvm_projects=mlir
if [[ "${LLVM_ENABLE_ASSERTIONS:-ON}" == "OFF" ]]; then
llvm_projects="mlir;bolt"
fi

log_step "CMake configure MLIR (${BUILD_TYPE})"
cmake -S "$repo_dir/llvm" -B "$build_dir" -G Ninja \
-DCMAKE_BUILD_TYPE="$BUILD_TYPE" \
-DCMAKE_INSTALL_PREFIX="$mlir_install_dir" \
-DCMAKE_C_COMPILER=gcc \
-DCMAKE_CXX_COMPILER=g++ \
-DLLVM_TARGETS_TO_BUILD="$HOST_TARGET" \
-DLLVM_ENABLE_PROJECTS=mlir \
-DLLVM_ENABLE_PROJECTS="$llvm_projects" \
-DLLVM_BUILD_EXAMPLES=OFF \
-DLLVM_INCLUDE_EXAMPLES=OFF \
-DLLVM_BUILD_TESTS=OFF \
Expand Down Expand Up @@ -242,9 +247,9 @@ build_mlir() {
fi

log_step "Stripping debug symbols"
if [[ "$BUILD_TYPE" == "Release" ]] && command -v strip >/dev/null 2>&1; then
find "$mlir_install_dir/bin" -type f -executable -exec strip --strip-debug {} + 2>/dev/null || true
find "$llvm_lib_dir" -name "*.a" -exec strip --strip-debug {} + 2>/dev/null || true
if [[ "$BUILD_TYPE" == "Release" ]]; then
find "$mlir_install_dir/bin" -type f -executable -exec "$mlir_install_dir/bin/llvm-strip" --strip-debug {} + 2>/dev/null || true
find "$llvm_lib_dir" -name "*.a" -exec "$mlir_install_dir/bin/llvm-strip" --strip-debug {} + 2>/dev/null || true
fi
log_done

Expand Down
8 changes: 8 additions & 0 deletions scripts/toolchain/linux/test-installation.sh
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,12 @@ log_step "Running integration test binary"
"$TEST_BUILD_DIR/hello_mlir"
log_done

if [[ "${LLVM_ENABLE_ASSERTIONS:-ON}" == "OFF" ]]; then
log_step "Verifying release build tools"
llvm-bolt --version
[[ -x "$TEST_MLIR_DIR/bin/merge-fdata" ]]
[[ -f "$TEST_MLIR_DIR/lib/libbolt_rt_instr.a" ]]
log_done
fi

echo "Integration test passed!"
8 changes: 4 additions & 4 deletions scripts/toolchain/macos/build-mlir.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ done
[[ "$BUILD_TYPE" != "Release" && "$BUILD_TYPE" != "Debug" ]] && { echo "Error: build type must be Release or Debug" >&2; exit 1; }

ensure_ninja "$NINJA_VERSION"
export MACOSX_DEPLOYMENT_TARGET="11.0"
export MACOSX_DEPLOYMENT_TARGET="13.3"

ZSTD_ARCHIVE_PATH="$(resolve_abs_path "$ZSTD_ARCHIVE_PATH")"
MLIR_ARCHIVE_PATH="$(resolve_abs_path "$MLIR_ARCHIVE_PATH")"
Expand Down Expand Up @@ -100,9 +100,9 @@ cmake --build "$build_dir" --target install --config "$BUILD_TYPE"
log_done

log_step "Stripping debug symbols"
if [[ "$BUILD_TYPE" == "Release" ]] && command -v strip >/dev/null 2>&1; then
find "$install_dir/bin" -type f -perm -111 -exec strip -S {} + 2>/dev/null || true
find "$install_dir/lib" -name "*.a" -exec strip -S {} + 2>/dev/null || true
if [[ "$BUILD_TYPE" == "Release" ]]; then
find "$install_dir/bin" -type f -perm -111 -exec "$install_dir/bin/llvm-strip" --strip-debug {} + 2>/dev/null || true
find "$install_dir/lib" -name "*.a" -exec "$install_dir/bin/llvm-strip" --strip-debug {} + 2>/dev/null || true
fi
log_done

Expand Down
2 changes: 1 addition & 1 deletion scripts/toolchain/macos/build-zstd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ done
[[ -z "${ZSTD_ARCHIVE_PATH:-}" ]] && usage

ensure_ninja "$NINJA_VERSION"
export MACOSX_DEPLOYMENT_TARGET="11.0"
export MACOSX_DEPLOYMENT_TARGET="13.3"

ZSTD_ARCHIVE_PATH="$(resolve_abs_path "$ZSTD_ARCHIVE_PATH")"
mkdir -p "$(dirname "$ZSTD_ARCHIVE_PATH")"
Expand Down
Loading