Initial commit

This commit is contained in:
2026-03-21 12:43:00 -05:00
commit 83bf16823c
438 changed files with 33617 additions and 0 deletions
+59
View File
@@ -0,0 +1,59 @@
# See bootstrap.toml.example for more possible options,
# and see src/bootstrap/defaults/bootstrap.dist.toml for a few options
# automatically set when building from a release tarball
# (unfortunately, we have to override many of them).
# Tell x.py that the editors have reviewed the content of this file
# and updated it to follow the major changes of the building system,
# so x.py will not warn users to review that information.
change-id = 148795
[llvm]
# When using the system installed copy of LLVM, prefer the shared libraries
link-shared = true
use-libcxx = true
static-libstdcpp = false
# If building the shipped LLVM source, only enable the x86 target
# instead of all the targets supported by LLVM.
targets = "X86"
[build]
description = "for Vertex Linux"
# Omit the documentation to save time and space (the default is to build them).
docs = false
# Do not look for new versions of the dependencies online.
locked-deps = true
# Only install these extended tools. Cargo, clippy, rustdoc, and rustfmt
# are installed by a default rustup installation, and rust-src is needed
# to build the Rust code in Linux kernel (in case you need such a kernel
# feature).
tools = ["cargo", "clippy", "rustdoc", "rustfmt", "src"]
target = ["x86_64-unknown-linux-gnu", "x86_64-unknown-uefi"]
[install]
prefix = "/usr"
docdir = "share/doc/rust"
[rust]
channel = "stable"
bootstrap-override-lld = "external"
# Enable the same optimizations as the official upstream build.
lto = "thin"
codegen-units = 1
# Don't build llvm-bitcode-linker which is only useful for the NVPTX
# backend that we don't enable.
llvm-bitcode-linker = true
[target.x86_64-unknown-linux-gnu]
llvm-config = "/usr/bin/llvm-config"
default-linker-linux-override = "off"
[target.x86_64-unknown-uefi]
llvm-config = "/usr/bin/llvm-config"
default-linker-linux-override = "off"
+8
View File
@@ -0,0 +1,8 @@
export LIBSSH2_SYS_USE_PKG_CONFIG=1
export LIBSQLITE3_SYS_USE_PKG_CONFIG=1
cp $DEPOT_SPECDIR/bootstrap.toml .
./x.py build
DESTDIR=$DESTDIR ./x.py install -j "$(nproc)"
mkdir -pv $DESTDIR/usr/share/bash-completion/completions
mv -v $DESTDIR/etc/bash_completion.d/cargo $DESTDIR/usr/share/bash-completion/completions
rm -v $DESTDIR/usr/lib/rustlib/uninstall.sh
+42
View File
@@ -0,0 +1,42 @@
[build]
type = "custom"
[dependencies]
build = [
"cmake",
"libffi",
"llvm",
"python",
"perl",
"ninja",
]
runtime = [
"sh",
"libunwind",
"curl",
"clang",
"libcxx",
"glibc",
"libssh2",
"llvm-libs",
"openssl",
"zlib-ng",
"sqlite"
]
test = ["procps-ng"]
[package]
description = "Systems programming language focused on safety, speed and concurrency"
homepage = "https://www.rust-lang.org/"
license = "Apache-2.0 OR MIT"
name = "rust"
version = "1.94.0"
[[source]]
extract_dir = "$name-$version"
sha256 = "sha512:8397fa68055827363bff5a1dd228a05e4c4ca5a179d072ecc1b330a874c183529cb9346ec9c531fb3f066b7b6094fc8711d7c341a49755af7b50d63bf0ecff2b"
url = "https://static.rust-lang.org/dist/rustc-$version-src.tar.xz"
patches = [ "rustc-1.93.1-uefi-use-lld-link.patch", "rustc-1.93.1-external-llvm-bootstrap-lld-fallback.patch" ]
[[manual_sources]]
files = [ "bootstrap.toml", "rustc-1.93.1-uefi-use-lld-link.patch", "rustc-1.93.1-external-llvm-bootstrap-lld-fallback.patch" ]
@@ -0,0 +1,74 @@
--- a/src/bootstrap/src/core/config/config.rs
+++ b/src/bootstrap/src/core/config/config.rs
@@ -628,7 +628,7 @@
);
}
- let bootstrap_override_lld =
+ let mut bootstrap_override_lld =
rust_bootstrap_override_lld.or(rust_bootstrap_override_lld_legacy).unwrap_or_default();
if rust_optimize.as_ref().is_some_and(|v| matches!(v, RustOptimize::Bool(false))) {
@@ -978,6 +978,20 @@
let is_host_system_llvm =
is_system_llvm(&target_config, llvm_from_ci, host_target, host_target);
+ // Self-contained bootstrap LLD comes from the stage0 sysroot (`rust-lld`), whose LLVM
+ // version may differ from an externally configured host LLVM. In that case, linking LLVM
+ // bitcode objects can fail with "Unknown attribute kind".
+ if is_host_system_llvm
+ && matches!(bootstrap_override_lld, BootstrapOverrideLld::SelfContained)
+ {
+ eprintln!(
+ "WARNING: `rust.bootstrap-override-lld = \"self-contained\"` with external host \
+ `llvm-config` can cause LLVM bitcode version mismatches; falling back to \
+ `rust.bootstrap-override-lld = \"external\"` for bootstrap linking."
+ );
+ bootstrap_override_lld = BootstrapOverrideLld::External;
+ }
+
if llvm_from_ci {
let warn = |option: &str| {
println!(
@@ -1042,21 +1056,27 @@
let default_linux_linker_override = match linker_override {
DefaultLinuxLinkerOverride::Off => continue,
DefaultLinuxLinkerOverride::SelfContainedLldCc => {
- // If we automatically default to the self-contained LLD linker,
- // we also need to handle the rust.lld option.
- match rust_lld_enabled {
- // If LLD was not enabled explicitly, we enable it, unless LLVM config has
- // been set
- None if !is_host_system_llvm => {
- lld_enabled = true;
- Some(DefaultLinuxLinkerOverride::SelfContainedLldCc)
+ // If bootstrap is explicitly using an external `lld` binary, do not also
+ // embed a self-contained rust-lld default into rustc's Linux target spec.
+ if matches!(bootstrap_override_lld, BootstrapOverrideLld::External) {
+ None
+ } else {
+ // If we automatically default to the self-contained LLD linker,
+ // we also need to handle the rust.lld option.
+ match rust_lld_enabled {
+ // If LLD was not enabled explicitly, we enable it, unless LLVM config has
+ // been set
+ None if !is_host_system_llvm => {
+ lld_enabled = true;
+ Some(DefaultLinuxLinkerOverride::SelfContainedLldCc)
+ }
+ None => None,
+ // If it was enabled already, we don't need to do anything
+ Some(true) => Some(DefaultLinuxLinkerOverride::SelfContainedLldCc),
+ // If it was explicitly disabled, we do not apply the
+ // linker override
+ Some(false) => None,
}
- None => None,
- // If it was enabled already, we don't need to do anything
- Some(true) => Some(DefaultLinuxLinkerOverride::SelfContainedLldCc),
- // If it was explicitly disabled, we do not apply the
- // linker override
- Some(false) => None,
}
}
};
@@ -0,0 +1,14 @@
--- a/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp
+++ b/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp
@@ -23,7 +23,11 @@
#include "llvm/MC/TargetRegistry.h"
#include "llvm/Object/ObjectFile.h"
#include "llvm/Passes/PassBuilder.h"
+#if LLVM_VERSION_GE(22, 0)
+#include "llvm/Plugins/PassPlugin.h"
+#else
#include "llvm/Passes/PassPlugin.h"
+#endif
#include "llvm/Passes/StandardInstrumentations.h"
#include "llvm/Support/CBindingWrapping.h"
#include "llvm/Support/FileSystem.h"
@@ -0,0 +1,13 @@
--- a/compiler/rustc_target/src/spec/base/uefi_msvc.rs
+++ b/compiler/rustc_target/src/spec/base/uefi_msvc.rs
@@ -45,7 +45,9 @@
// "Windows".
stack_probes: StackProbeType::Call,
singlethread: true,
- linker: Some("rust-lld".into()),
+ // Use the system LLD frontend name. Distro/toolchain builds that use an external LLVM
+ // often do not ship a `rust-lld` wrapper binary.
+ linker: Some("lld-link".into()),
entry_name: "efi_main".into(),
..base
}