Skip to content

Commit 767aeeb

Browse files
authored
rust: use our compiler builtins library (#26999)
every time std is built there is a `compiler-builtins` crate being built. it compiles specific LLVM sources (compiler-rt part) to get optimized intrinsics. make the build faster a bit by using our own library
1 parent eb11e59 commit 767aeeb

File tree

2 files changed

+15
-62
lines changed

2 files changed

+15
-62
lines changed

mingw-w64-rust/PKGBUILD

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}"
2323
"${MINGW_PACKAGE_PREFIX}-rust-wasm" \
2424
"${MINGW_PACKAGE_PREFIX}-rust-emscripten"))
2525
pkgver=1.92.0
26-
pkgrel=1
26+
pkgrel=2
2727
pkgdesc="Systems programming language focused on safety, speed and concurrency (mingw-w64)"
2828
arch=('any')
2929
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clangarm64')
@@ -39,6 +39,7 @@ license=('spdx:Apache-2.0 AND MIT')
3939
makedepends=("${MINGW_PACKAGE_PREFIX}-cc"
4040
"${MINGW_PACKAGE_PREFIX}-clang"
4141
"${MINGW_PACKAGE_PREFIX}-cmake"
42+
"${MINGW_PACKAGE_PREFIX}-compiler-rt"
4243
"${MINGW_PACKAGE_PREFIX}-curl"
4344
"${MINGW_PACKAGE_PREFIX}-libffi"
4445
"${MINGW_PACKAGE_PREFIX}-libgit2"
@@ -57,9 +58,7 @@ makedepends=("${MINGW_PACKAGE_PREFIX}-cc"
5758
"${MINGW_PACKAGE_PREFIX}-emscripten" \
5859
"${MINGW_PACKAGE_PREFIX}-wasi-libc" \
5960
"${MINGW_PACKAGE_PREFIX}-wasm-component-ld")
60-
$((( _pgo )) && echo \
61-
"${MINGW_PACKAGE_PREFIX}-compiler-rt" \
62-
"${MINGW_PACKAGE_PREFIX}-lld"))
61+
$((( _pgo )) && echo "${MINGW_PACKAGE_PREFIX}-lld"))
6362
source=("${rust_dist_server}/${_realname}c-${pkgver}-src.tar.xz"{,.asc}
6463
"bootstrap.toml"
6564
"bootstrap-wasm.toml"
@@ -73,7 +72,7 @@ source=("${rust_dist_server}/${_realname}c-${pkgver}-src.tar.xz"{,.asc}
7372
noextract=(${_realname}c-${pkgver}-src.tar.xz)
7473
sha256sums=('ebee170bfe4c4dfc59521a101de651e5534f4dae889756a5c97ca9ea40d0c307'
7574
'SKIP'
76-
'575e47859d2ff5dbc73291a2f976bc682338e323b6e6c5858bc40955bbbb7005'
75+
'107e2bba21a572a020d34dceba3b2c0ae18976ad67e91254b85b290d8db32a6a'
7776
'd693577fabe39a3046cd44fd002adf9557de6883eaea9007eae7f8372295ea0e'
7877
'7cb1773c288ffb1c1e751edc49b1890c84bf9c362742bc5225d19d474edb73a0'
7978
'56882f1a0f1404c10c7726d6cc37444f2b343e72b969badfcb43760f80db0f32'
@@ -145,6 +144,16 @@ build() {
145144
export LIBSQLITE3_SYS_USE_PKG_CONFIG=1
146145
export LIBSSH2_SYS_USE_PKG_CONFIG=1
147146

147+
# use our compiler-rt for host target
148+
local _clangdir="$(clang -print-resource-dir)"
149+
local _rt_arch
150+
if [ $CARCH = i686 ]; then
151+
_rt_arch=i386
152+
else
153+
_rt_arch=${CARCH}
154+
fi
155+
export COMPILER_RT_PATH="${_clangdir}/lib/windows/libclang_rt.builtins-${_rt_arch}.a"
156+
148157
# substitute the values in bootstrap.toml
149158
export MSYS2_ENV_CONV_EXCL='INSTALL_PREFIX'
150159
export INSTALL_PREFIX="${MINGW_PREFIX}"

mingw-w64-rust/bootstrap.toml

Lines changed: 1 addition & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -69,60 +69,4 @@ ar = "$MINGW_PREFIX/bin/llvm-ar.exe"
6969
ranlib = "$MINGW_PREFIX/bin/llvm-ranlib.exe"
7070
linker = "$MINGW_PREFIX/bin/clang.exe"
7171
llvm-config = "$MINGW_PREFIX/bin/llvm-config.exe"
72-
73-
[target.wasm32-unknown-unknown]
74-
cc = "$MINGW_PREFIX/bin/clang.exe"
75-
cxx = "$MINGW_PREFIX/bin/clang++.exe"
76-
ar = "$MINGW_PREFIX/bin/llvm-ar.exe"
77-
ranlib = "$MINGW_PREFIX/bin/llvm-ranlib.exe"
78-
linker = "$MINGW_PREFIX/bin/wasm-ld.exe"
79-
default-linker = "wasm-ld.exe"
80-
profiler = false
81-
82-
[target.wasm32-unknown-emscripten]
83-
cc = "$MINGW_PREFIX/lib/emscripten/emcc.bat"
84-
cxx = "$MINGW_PREFIX/lib/emscripten/em++.bat"
85-
ar = "$MINGW_PREFIX/lib/emscripten/emar.bat"
86-
ranlib = "$MINGW_PREFIX/lib/emscripten/emranlib.bat"
87-
linker = "$MINGW_PREFIX/bin/wasm-ld.exe"
88-
default-linker = "wasm-ld.exe"
89-
profiler = false
90-
91-
[target.wasm32v1-none]
92-
cc = "$MINGW_PREFIX/bin/clang.exe"
93-
cxx = "$MINGW_PREFIX/bin/clang++.exe"
94-
ar = "$MINGW_PREFIX/bin/llvm-ar.exe"
95-
ranlib = "$MINGW_PREFIX/bin/llvm-ranlib.exe"
96-
linker = "$MINGW_PREFIX/bin/wasm-ld.exe"
97-
default-linker = "wasm-ld.exe"
98-
profiler = false
99-
100-
[target.wasm32-wasip1]
101-
cc = "$MINGW_PREFIX/bin/clang.exe"
102-
cxx = "$MINGW_PREFIX/bin/clang++.exe"
103-
ar = "$MINGW_PREFIX/bin/llvm-ar.exe"
104-
ranlib = "$MINGW_PREFIX/bin/llvm-ranlib.exe"
105-
linker = "$MINGW_PREFIX/bin/wasm-ld.exe"
106-
default-linker = "wasm-ld.exe"
107-
profiler = false
108-
wasi-root = "$MINGW_PREFIX/share/wasi-sysroot"
109-
110-
[target.wasm32-wasip1-threads]
111-
cc = "$MINGW_PREFIX/bin/clang.exe"
112-
cxx = "$MINGW_PREFIX/bin/clang++.exe"
113-
ar = "$MINGW_PREFIX/bin/llvm-ar.exe"
114-
ranlib = "$MINGW_PREFIX/bin/llvm-ranlib.exe"
115-
linker = "$MINGW_PREFIX/bin/wasm-ld.exe"
116-
default-linker = "wasm-ld.exe"
117-
profiler = false
118-
wasi-root = "$MINGW_PREFIX/share/wasi-sysroot"
119-
120-
[target.wasm32-wasip2]
121-
cc = "$MINGW_PREFIX/bin/clang.exe"
122-
cxx = "$MINGW_PREFIX/bin/clang++.exe"
123-
ar = "$MINGW_PREFIX/bin/llvm-ar.exe"
124-
ranlib = "$MINGW_PREFIX/bin/llvm-ranlib.exe"
125-
linker = "$MINGW_PREFIX/bin/wasm-ld.exe"
126-
default-linker = "wasm-ld.exe"
127-
profiler = false
128-
wasi-root = "$MINGW_PREFIX/share/wasi-sysroot"
72+
optimized-compiler-builtins = "$COMPILER_RT_PATH"

0 commit comments

Comments
 (0)