Skip to content

Commit

Permalink
Update to Rust 1.80.0
Browse files Browse the repository at this point in the history
  • Loading branch information
topjohnwu committed Aug 6, 2024
1 parent c586d09 commit b7c45e1
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 121 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
sudo apt-get -y install cmake ninja-build libzstd-dev binutils-dev
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 17
sudo ./llvm.sh 18
rm llvm.sh
./build.sh
Expand Down
8 changes: 7 additions & 1 deletion build-windows.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,14 @@ clean_storage() {
}

build() {
set_llvm_build_cfg LLVM_USE_SYMLINKS TRUE
set_rust_cfg llvm.static-libstdcpp true
set_rust_cfg llvm.ldflags "\"-s -static-libgcc -static\""
set_rust_cfg dist.include-mingw-linker true

cd rust
python ./x.py --config '../config-windows.toml' --build $TRIPLE install
python ./x.py --config '../config.toml' --build $TRIPLE \
$RUST_CFG "--set=llvm.build-config={ $LLVM_BUILD_CFG }" install
cd ../

cd out
Expand Down
16 changes: 14 additions & 2 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,26 @@ fi

build() {
if [ $OS = "darwin" ]; then
sed "s|BREW_PREFIX|$(brew --prefix)|g" config-darwin-sample.toml > config-darwin.toml
export MACOSX_DEPLOYMENT_TARGET=11.0
# Manually set page size if cross compilation is required (arm64 require 16k page)
# export JEMALLOC_SYS_WITH_LG_PAGE=14

set_llvm_build_cfg LLVM_BINUTILS_INCDIR $(brew --prefix)/opt/binutils/include
set_rust_cfg rust.jemalloc true
else
set_llvm_build_cfg LLVM_BINUTILS_INCDIR /usr/include
set_rust_cfg llvm.static-libstdcpp true
set_rust_cfg rust.use-lld self-contained
fi

set_llvm_build_cfg LLVM_ENABLE_PLUGINS FORCE_ON
set_rust_cfg llvm.thin-lto true
set_rust_cfg llvm.link-shared true
set_rust_cfg rust.lto thin

cd rust
python3 ./x.py --config "../config-${OS}.toml" --host $TRIPLE install
python3 ./x.py --config "../config.toml" --host $TRIPLE \
$RUST_CFG "--set=llvm.build-config={ $LLVM_BUILD_CFG }" install
cd ../

cd out
Expand Down
28 changes: 23 additions & 5 deletions common.sh
Original file line number Diff line number Diff line change
@@ -1,25 +1,39 @@
# Copyright 2022-2024 Google LLC.
# SPDX-License-Identifier: Apache-2.0

RUST_VERSION='1.79.0'
RUST_VERSION='1.80.0'

NDK_VERSION='r27-beta2'
NDK_VERSION='r27'
NDK_DIR_VERSION=$NDK_VERSION

# These revisions are obtained from the NDK's LLVM manifest.xml and clang_source_info.md
# Update in sync with the NDK package
LLVM_VERSION='3c92011b600bdf70424e2547594dd461fe411a41'
LLVM_SVN='522817'
LLVM_ANDROID_VERSION='438b79812959d90a4a9252ddab53f9d90d2d0d98'
TOOLCHAIN_UTILS_VERSION='d865a56cd71d2673038848799595850c8113bbca'
LLVM_ANDROID_VERSION='5ab132bd1afa945695853fa093dfcc839e45f97c'
TOOLCHAIN_UTILS_VERSION='dd1ee45a84cb07337f9d5d0a6769d9b865c6e620'

OUTPUT_VERSION='r27.2'
OUTPUT_VERSION='r27.3'

PYTHON_CMD='python3'

set -e
shopt -s nullglob

# key value
set_llvm_build_cfg() {
if [ -z "$LLVM_BUILD_CFG" ]; then
LLVM_BUILD_CFG="\"$1\" = \"$2\""
else
LLVM_BUILD_CFG="$LLVM_BUILD_CFG, \"$1\" = \"$2\""
fi
}

# key value
set_rust_cfg() {
RUST_CFG="$RUST_CFG --set=$1=$2"
}

# url sha
git_clone_sha() {
local dir=${1##*/}
Expand Down Expand Up @@ -110,6 +124,10 @@ run_cmd() {
;;
build)
rm -rf out
# Set common LLVM configs
set_llvm_build_cfg LLVM_VERSION_SUFFIX
set_llvm_build_cfg LLVM_ENABLE_ZSTD FORCE_ON
set_llvm_build_cfg LLVM_USE_STATIC_ZSTD TRUE
build
;;
ndk)
Expand Down
52 changes: 0 additions & 52 deletions config-linux.toml

This file was deleted.

48 changes: 0 additions & 48 deletions config-windows.toml

This file was deleted.

22 changes: 10 additions & 12 deletions config-darwin-sample.toml → config.toml
Original file line number Diff line number Diff line change
@@ -1,21 +1,12 @@
change-id = 123711
change-id = 125535

[llvm]
thin-lto = true
targets = "AArch64;ARM;X86;RISCV"
experimental-targets = ""
link-shared = true
clang = true
download-ci-llvm = false
version-suffix = ""

[llvm.build-config]
LLVM_VERSION_SUFFIX = ""
LLVM_ENABLE_ZSTD = "FORCE_ON"
LLVM_USE_STATIC_ZSTD = "TRUE"
LLVM_BINUTILS_INCDIR = "BREW_PREFIX/opt/binutils/include"
LLVM_ENABLE_PLUGINS = "FORCE_ON"

[build]
docs = false
submodules = false
Expand All @@ -39,13 +30,20 @@ sysconfdir = "etc"
channel = "nightly"
lld = true
llvm-tools = true
jemalloc = true
lto = "thin"
strip = true
codegen-units = 1

[target.x86_64-unknown-linux-gnu]
llvm-has-rust-patches = false
cc = "clang-18"
cxx = "clang++-18"
linker = "clang-18"

[target.aarch64-apple-darwin]
llvm-has-rust-patches = false

[target.x86_64-apple-darwin]
llvm-has-rust-patches = false

[target.x86_64-pc-windows-gnu]
llvm-has-rust-patches = false

0 comments on commit b7c45e1

Please sign in to comment.