Merge from rustc
This commit is contained in:
commit
bd898e38af
269 changed files with 1722 additions and 1675 deletions
|
|
@ -28,13 +28,16 @@ pub struct Std {
|
|||
/// passing `Builder::kind` to cargo invocations would run clippy on the entire compiler and library,
|
||||
/// which is not useful if we only want to lint a few crates with specific rules.
|
||||
override_build_kind: Option<Kind>,
|
||||
/// Never use this from outside calls. It is intended for internal use only within `check::Std::make_run`
|
||||
/// and `check::Std::run`.
|
||||
custom_stage: Option<u32>,
|
||||
}
|
||||
|
||||
impl Std {
|
||||
const CRATE_OR_DEPS: &[&str] = &["sysroot", "coretests", "alloctests"];
|
||||
|
||||
pub fn new(target: TargetSelection) -> Self {
|
||||
Self { target, crates: vec![], override_build_kind: None }
|
||||
Self { target, crates: vec![], override_build_kind: None, custom_stage: None }
|
||||
}
|
||||
|
||||
pub fn build_kind(mut self, kind: Option<Kind>) -> Self {
|
||||
|
|
@ -48,24 +51,29 @@ impl Step for Std {
|
|||
const DEFAULT: bool = true;
|
||||
|
||||
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
|
||||
let builder = run.builder;
|
||||
let stage = if builder.config.is_explicit_stage() || builder.top_stage >= 1 {
|
||||
builder.top_stage
|
||||
} else {
|
||||
1
|
||||
};
|
||||
|
||||
let mut run = run;
|
||||
for c in Std::CRATE_OR_DEPS {
|
||||
run = run.crate_or_deps(c);
|
||||
}
|
||||
|
||||
run.path("library").default_condition(stage != 0)
|
||||
run.path("library")
|
||||
}
|
||||
|
||||
fn make_run(run: RunConfig<'_>) {
|
||||
let crates = std_crates_for_run_make(&run);
|
||||
run.builder.ensure(Std { target: run.target, crates, override_build_kind: None });
|
||||
|
||||
let stage = if run.builder.config.is_explicit_stage() || run.builder.top_stage >= 1 {
|
||||
run.builder.top_stage
|
||||
} else {
|
||||
1
|
||||
};
|
||||
|
||||
run.builder.ensure(Std {
|
||||
target: run.target,
|
||||
crates,
|
||||
override_build_kind: None,
|
||||
custom_stage: Some(stage),
|
||||
});
|
||||
}
|
||||
|
||||
fn run(self, builder: &Builder<'_>) {
|
||||
|
|
@ -78,11 +86,7 @@ impl Step for Std {
|
|||
|
||||
builder.require_submodule("library/stdarch", None);
|
||||
|
||||
let stage = if builder.config.is_explicit_stage() || builder.top_stage >= 1 {
|
||||
builder.top_stage
|
||||
} else {
|
||||
1
|
||||
};
|
||||
let stage = self.custom_stage.unwrap_or(builder.top_stage);
|
||||
|
||||
let target = self.target;
|
||||
let compiler = builder.compiler(stage, builder.config.build);
|
||||
|
|
|
|||
|
|
@ -1878,23 +1878,27 @@ impl Step for Sysroot {
|
|||
// so that any tools relying on `rust-src` also work for local builds,
|
||||
// and also for translating the virtual `/rustc/$hash` back to the real
|
||||
// directory (for running tests with `rust.remap-debuginfo = true`).
|
||||
let sysroot_lib_rustlib_src = sysroot.join("lib/rustlib/src");
|
||||
t!(fs::create_dir_all(&sysroot_lib_rustlib_src));
|
||||
let sysroot_lib_rustlib_src_rust = sysroot_lib_rustlib_src.join("rust");
|
||||
if let Err(e) = symlink_dir(&builder.config, &builder.src, &sysroot_lib_rustlib_src_rust) {
|
||||
eprintln!(
|
||||
"ERROR: creating symbolic link `{}` to `{}` failed with {}",
|
||||
sysroot_lib_rustlib_src_rust.display(),
|
||||
builder.src.display(),
|
||||
e,
|
||||
);
|
||||
if builder.config.rust_remap_debuginfo {
|
||||
if compiler.stage != 0 {
|
||||
let sysroot_lib_rustlib_src = sysroot.join("lib/rustlib/src");
|
||||
t!(fs::create_dir_all(&sysroot_lib_rustlib_src));
|
||||
let sysroot_lib_rustlib_src_rust = sysroot_lib_rustlib_src.join("rust");
|
||||
if let Err(e) =
|
||||
symlink_dir(&builder.config, &builder.src, &sysroot_lib_rustlib_src_rust)
|
||||
{
|
||||
eprintln!(
|
||||
"ERROR: some `tests/ui` tests will fail when lacking `{}`",
|
||||
"ERROR: creating symbolic link `{}` to `{}` failed with {}",
|
||||
sysroot_lib_rustlib_src_rust.display(),
|
||||
builder.src.display(),
|
||||
e,
|
||||
);
|
||||
if builder.config.rust_remap_debuginfo {
|
||||
eprintln!(
|
||||
"ERROR: some `tests/ui` tests will fail when lacking `{}`",
|
||||
sysroot_lib_rustlib_src_rust.display(),
|
||||
);
|
||||
}
|
||||
build_helper::exit!(1);
|
||||
}
|
||||
build_helper::exit!(1);
|
||||
}
|
||||
|
||||
// rustc-src component is already part of CI rustc's sysroot
|
||||
|
|
|
|||
|
|
@ -2707,16 +2707,6 @@ impl Step for Crate {
|
|||
.arg(builder.src.join("library/sysroot/Cargo.toml"));
|
||||
} else {
|
||||
compile::std_cargo(builder, target, compiler.stage, &mut cargo);
|
||||
// `std_cargo` actually does the wrong thing: it passes `--sysroot build/host/stage2`,
|
||||
// but we want to use the force-recompile std we just built in `build/host/stage2-test-sysroot`.
|
||||
// Override it.
|
||||
if builder.download_rustc() && compiler.stage > 0 {
|
||||
let sysroot = builder
|
||||
.out
|
||||
.join(compiler.host)
|
||||
.join(format!("stage{}-test-sysroot", compiler.stage));
|
||||
cargo.env("RUSTC_SYSROOT", sysroot);
|
||||
}
|
||||
}
|
||||
}
|
||||
Mode::Rustc => {
|
||||
|
|
|
|||
|
|
@ -945,7 +945,6 @@ impl<'a> Builder<'a> {
|
|||
clippy::CI,
|
||||
),
|
||||
Kind::Check | Kind::Fix => describe!(
|
||||
check::Std,
|
||||
check::Rustc,
|
||||
check::Rustdoc,
|
||||
check::CodegenBackend,
|
||||
|
|
@ -961,6 +960,13 @@ impl<'a> Builder<'a> {
|
|||
check::Compiletest,
|
||||
check::FeaturesStatusDump,
|
||||
check::CoverageDump,
|
||||
// This has special staging logic, it may run on stage 1 while others run on stage 0.
|
||||
// It takes quite some time to build stage 1, so put this at the end.
|
||||
//
|
||||
// FIXME: This also helps bootstrap to not interfere with stage 0 builds. We should probably fix
|
||||
// that issue somewhere else, but we still want to keep `check::Std` at the end so that the
|
||||
// quicker steps run before this.
|
||||
check::Std,
|
||||
),
|
||||
Kind::Test => describe!(
|
||||
crate::core::build_steps::toolstate::ToolStateCheck,
|
||||
|
|
|
|||
36
src/ci/docker/host-x86_64/dist-sparcv9-solaris/Dockerfile
Normal file
36
src/ci/docker/host-x86_64/dist-sparcv9-solaris/Dockerfile
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
FROM ubuntu:22.04
|
||||
|
||||
COPY scripts/cross-apt-packages.sh /tmp/
|
||||
RUN bash /tmp/cross-apt-packages.sh
|
||||
|
||||
# Required gcc dependencies.
|
||||
RUN apt-get update && \
|
||||
apt-get install -y --no-install-recommends \
|
||||
libgmp-dev \
|
||||
libmpfr-dev \
|
||||
libmpc-dev \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
COPY scripts/shared.sh /tmp/
|
||||
COPY scripts/solaris-toolchain.sh /tmp/
|
||||
|
||||
RUN bash /tmp/solaris-toolchain.sh sparcv9 sysroot
|
||||
RUN bash /tmp/solaris-toolchain.sh sparcv9 binutils
|
||||
RUN bash /tmp/solaris-toolchain.sh sparcv9 gcc
|
||||
|
||||
COPY scripts/sccache.sh /scripts/
|
||||
RUN sh /scripts/sccache.sh
|
||||
|
||||
COPY scripts/cmake.sh /scripts/
|
||||
RUN /scripts/cmake.sh
|
||||
|
||||
ENV \
|
||||
AR_sparcv9_sun_solaris=sparcv9-solaris-ar \
|
||||
RANLIB_sparcv9_sun_solaris=sparcv9-solaris-ranlib \
|
||||
CC_sparcv9_sun_solaris=sparcv9-solaris-gcc \
|
||||
CXX_sparcv9_sun_solaris=sparcv9-solaris-g++
|
||||
|
||||
ENV HOSTS=sparcv9-sun-solaris
|
||||
|
||||
ENV RUST_CONFIGURE_ARGS --enable-extended --disable-docs
|
||||
ENV SCRIPT python3 ../x.py dist --host $HOSTS --target $HOSTS
|
||||
|
|
@ -43,12 +43,6 @@ ENV \
|
|||
CXX_aarch64_unknown_fuchsia=aarch64-unknown-fuchsia-clang++ \
|
||||
CXXFLAGS_aarch64_unknown_fuchsia="--target=aarch64-unknown-fuchsia --sysroot=/usr/local/core-linux-amd64-fuchsia-sdk/arch/arm64/sysroot -I/usr/local/core-linux-amd64-fuchsia-sdk/pkg/fdio/include" \
|
||||
LDFLAGS_aarch64_unknown_fuchsia="--target=aarch64-unknown-fuchsia --sysroot=/usr/local/core-linux-amd64-fuchsia-sdk/arch/arm64/sysroot -L/usr/local/core-linux-amd64-fuchsia-sdk/arch/arm64/lib" \
|
||||
AR_sparcv9_sun_solaris=sparcv9-sun-solaris2.10-ar \
|
||||
CC_sparcv9_sun_solaris=sparcv9-sun-solaris2.10-gcc \
|
||||
CXX_sparcv9_sun_solaris=sparcv9-sun-solaris2.10-g++ \
|
||||
AR_x86_64_pc_solaris=x86_64-pc-solaris2.10-ar \
|
||||
CC_x86_64_pc_solaris=x86_64-pc-solaris2.10-gcc \
|
||||
CXX_x86_64_pc_solaris=x86_64-pc-solaris2.10-g++ \
|
||||
CC_armv7_unknown_linux_gnueabi=arm-linux-gnueabi-gcc-9 \
|
||||
CXX_armv7_unknown_linux_gnueabi=arm-linux-gnueabi-g++-9 \
|
||||
AR_x86_64_fortanix_unknown_sgx=ar \
|
||||
|
|
@ -84,9 +78,6 @@ WORKDIR /tmp
|
|||
COPY scripts/shared.sh /tmp/
|
||||
COPY scripts/build-fuchsia-toolchain.sh /tmp/
|
||||
RUN /tmp/build-fuchsia-toolchain.sh
|
||||
COPY host-x86_64/dist-various-2/build-solaris-toolchain.sh /tmp/
|
||||
RUN /tmp/build-solaris-toolchain.sh x86_64 amd64 solaris-i386 pc
|
||||
RUN /tmp/build-solaris-toolchain.sh sparcv9 sparcv9 solaris-sparc sun
|
||||
COPY host-x86_64/dist-various-2/build-x86_64-fortanix-unknown-sgx-toolchain.sh /tmp/
|
||||
RUN /tmp/build-x86_64-fortanix-unknown-sgx-toolchain.sh
|
||||
|
||||
|
|
@ -118,8 +109,6 @@ ENV TARGETS=$TARGETS,wasm32-wasip1
|
|||
ENV TARGETS=$TARGETS,wasm32-wasip1-threads
|
||||
ENV TARGETS=$TARGETS,wasm32-wasip2
|
||||
ENV TARGETS=$TARGETS,wasm32v1-none
|
||||
ENV TARGETS=$TARGETS,sparcv9-sun-solaris
|
||||
ENV TARGETS=$TARGETS,x86_64-pc-solaris
|
||||
ENV TARGETS=$TARGETS,x86_64-unknown-linux-gnux32
|
||||
ENV TARGETS=$TARGETS,x86_64-fortanix-unknown-sgx
|
||||
ENV TARGETS=$TARGETS,nvptx64-nvidia-cuda
|
||||
|
|
|
|||
|
|
@ -1,111 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -ex
|
||||
source shared.sh
|
||||
|
||||
ARCH=$1
|
||||
LIB_ARCH=$2
|
||||
APT_ARCH=$3
|
||||
MANUFACTURER=$4
|
||||
BINUTILS=2.28.1
|
||||
GCC=6.5.0
|
||||
|
||||
TARGET=${ARCH}-${MANUFACTURER}-solaris2.10
|
||||
|
||||
# First up, build binutils
|
||||
mkdir binutils
|
||||
cd binutils
|
||||
|
||||
curl https://ftp.gnu.org/gnu/binutils/binutils-$BINUTILS.tar.xz | tar xJf -
|
||||
mkdir binutils-build
|
||||
cd binutils-build
|
||||
hide_output ../binutils-$BINUTILS/configure --target=$TARGET
|
||||
hide_output make -j10
|
||||
hide_output make install
|
||||
|
||||
cd ../..
|
||||
rm -rf binutils
|
||||
|
||||
# Next, download and install the relevant solaris packages
|
||||
mkdir solaris
|
||||
cd solaris
|
||||
|
||||
dpkg --add-architecture $APT_ARCH
|
||||
apt-get update
|
||||
apt-get install -y --download-only \
|
||||
libc:$APT_ARCH \
|
||||
liblgrp:$APT_ARCH \
|
||||
libm-dev:$APT_ARCH \
|
||||
libpthread:$APT_ARCH \
|
||||
libresolv:$APT_ARCH \
|
||||
librt:$APT_ARCH \
|
||||
libsendfile:$APT_ARCH \
|
||||
libsocket:$APT_ARCH \
|
||||
system-crt:$APT_ARCH \
|
||||
system-header:$APT_ARCH
|
||||
|
||||
for deb in /var/cache/apt/archives/*$APT_ARCH.deb; do
|
||||
dpkg -x $deb .
|
||||
done
|
||||
apt-get clean
|
||||
|
||||
# The -dev packages are not available from the apt repository we're using.
|
||||
# However, those packages are just symlinks from *.so to *.so.<version>.
|
||||
# This makes all those symlinks.
|
||||
for lib in $(find -name '*.so.*'); do
|
||||
target=${lib%.so.*}.so
|
||||
ln -s ${lib##*/} $target || echo "warning: silenced error symlinking $lib"
|
||||
done
|
||||
|
||||
# Remove Solaris 11 functions that are optionally used by libbacktrace.
|
||||
# This is for Solaris 10 compatibility.
|
||||
rm usr/include/link.h
|
||||
patch -p0 << 'EOF'
|
||||
--- usr/include/string.h
|
||||
+++ usr/include/string10.h
|
||||
@@ -93 +92,0 @@
|
||||
-extern size_t strnlen(const char *, size_t);
|
||||
EOF
|
||||
|
||||
mkdir /usr/local/$TARGET/usr
|
||||
mv usr/include /usr/local/$TARGET/usr/include
|
||||
mv usr/lib/$LIB_ARCH/* /usr/local/$TARGET/lib
|
||||
mv lib/$LIB_ARCH/* /usr/local/$TARGET/lib
|
||||
|
||||
ln -s usr/include /usr/local/$TARGET/sys-include
|
||||
ln -s usr/include /usr/local/$TARGET/include
|
||||
|
||||
cd ..
|
||||
rm -rf solaris
|
||||
|
||||
# Finally, download and build gcc to target solaris
|
||||
mkdir gcc
|
||||
cd gcc
|
||||
|
||||
curl https://ftp.gnu.org/gnu/gcc/gcc-$GCC/gcc-$GCC.tar.xz | tar xJf -
|
||||
cd gcc-$GCC
|
||||
|
||||
mkdir ../gcc-build
|
||||
cd ../gcc-build
|
||||
hide_output ../gcc-$GCC/configure \
|
||||
--enable-languages=c,c++ \
|
||||
--target=$TARGET \
|
||||
--with-gnu-as \
|
||||
--with-gnu-ld \
|
||||
--disable-multilib \
|
||||
--disable-nls \
|
||||
--disable-libgomp \
|
||||
--disable-libquadmath \
|
||||
--disable-libssp \
|
||||
--disable-libvtv \
|
||||
--disable-libcilkrts \
|
||||
--disable-libada \
|
||||
--disable-libsanitizer \
|
||||
--disable-libquadmath-support \
|
||||
--disable-lto
|
||||
|
||||
hide_output make -j10
|
||||
hide_output make install
|
||||
|
||||
cd ../..
|
||||
rm -rf gcc
|
||||
|
|
@ -15,6 +15,7 @@ RUN apt-get update && \
|
|||
python2.7 \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
COPY scripts/shared.sh /tmp/
|
||||
COPY scripts/illumos-toolchain.sh /tmp/
|
||||
|
||||
RUN bash /tmp/illumos-toolchain.sh x86_64 sysroot
|
||||
|
|
|
|||
36
src/ci/docker/host-x86_64/dist-x86_64-solaris/Dockerfile
Normal file
36
src/ci/docker/host-x86_64/dist-x86_64-solaris/Dockerfile
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
FROM ubuntu:22.04
|
||||
|
||||
COPY scripts/cross-apt-packages.sh /tmp/
|
||||
RUN bash /tmp/cross-apt-packages.sh
|
||||
|
||||
# Required gcc dependencies.
|
||||
RUN apt-get update && \
|
||||
apt-get install -y --no-install-recommends \
|
||||
libgmp-dev \
|
||||
libmpfr-dev \
|
||||
libmpc-dev \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
COPY scripts/shared.sh /tmp/
|
||||
COPY scripts/solaris-toolchain.sh /tmp/
|
||||
|
||||
RUN bash /tmp/solaris-toolchain.sh x86_64 sysroot
|
||||
RUN bash /tmp/solaris-toolchain.sh x86_64 binutils
|
||||
RUN bash /tmp/solaris-toolchain.sh x86_64 gcc
|
||||
|
||||
COPY scripts/sccache.sh /scripts/
|
||||
RUN sh /scripts/sccache.sh
|
||||
|
||||
COPY scripts/cmake.sh /scripts/
|
||||
RUN /scripts/cmake.sh
|
||||
|
||||
ENV \
|
||||
AR_x86_64_pc_solaris=x86_64-solaris-ar \
|
||||
RANLIB_x86_64_pc_solaris=x86_64-solaris-ranlib \
|
||||
CC_x86_64_pc_solaris=x86_64-solaris-gcc \
|
||||
CXX_x86_64_pc_solaris=x86_64-solaris-g++
|
||||
|
||||
ENV HOSTS=x86_64-pc-solaris
|
||||
|
||||
ENV RUST_CONFIGURE_ARGS --enable-extended --disable-docs
|
||||
ENV SCRIPT python3 ../x.py dist --host $HOSTS --target $HOSTS
|
||||
|
|
@ -4,6 +4,8 @@ set -o errexit
|
|||
set -o pipefail
|
||||
set -o xtrace
|
||||
|
||||
source /tmp/shared.sh
|
||||
|
||||
ARCH="$1"
|
||||
PHASE="$2"
|
||||
|
||||
|
|
@ -59,52 +61,13 @@ BINUTILS_TAR="$BINUTILS_BASE.tar.bz2"
|
|||
BINUTILS_URL="https://ftp.gnu.org/gnu/binutils/$BINUTILS_TAR"
|
||||
|
||||
|
||||
download_file() {
|
||||
local file="$1"
|
||||
local url="$2"
|
||||
local sum="$3"
|
||||
|
||||
while :; do
|
||||
if [[ -f "$file" ]]; then
|
||||
if ! h="$(sha256sum "$file" | awk '{ print $1 }')"; then
|
||||
printf 'ERROR: reading hash\n' >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ "$h" == "$sum" ]]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
printf 'WARNING: hash mismatch: %s != expected %s\n' \
|
||||
"$h" "$sum" >&2
|
||||
rm -f "$file"
|
||||
fi
|
||||
|
||||
printf 'Downloading: %s\n' "$url"
|
||||
if ! curl -f -L -o "$file" "$url"; then
|
||||
rm -f "$file"
|
||||
sleep 1
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
case "$PHASE" in
|
||||
sysroot)
|
||||
download_file "/tmp/$SYSROOT_TAR" "$SYSROOT_URL" "$SYSROOT_SUM"
|
||||
mkdir -p "$SYSROOT_DIR"
|
||||
cd "$SYSROOT_DIR"
|
||||
tar -xzf "/tmp/$SYSROOT_TAR"
|
||||
rm -f "/tmp/$SYSROOT_TAR"
|
||||
download_tar_and_extract_into_dir "$SYSROOT_URL" "$SYSROOT_SUM" "$SYSROOT_DIR"
|
||||
;;
|
||||
|
||||
binutils)
|
||||
download_file "/tmp/$BINUTILS_TAR" "$BINUTILS_URL" "$BINUTILS_SUM"
|
||||
mkdir -p /ws/src/binutils
|
||||
cd /ws/src/binutils
|
||||
tar -xjf "/tmp/$BINUTILS_TAR"
|
||||
rm -f "/tmp/$BINUTILS_TAR"
|
||||
|
||||
download_tar_and_extract_into_dir "$BINUTILS_URL" "$BINUTILS_SUM" /ws/src/binutils
|
||||
mkdir -p /ws/build/binutils
|
||||
cd /ws/build/binutils
|
||||
"/ws/src/binutils/$BINUTILS_BASE/configure" \
|
||||
|
|
@ -123,12 +86,7 @@ binutils)
|
|||
;;
|
||||
|
||||
gcc)
|
||||
download_file "/tmp/$GCC_TAR" "$GCC_URL" "$GCC_SUM"
|
||||
mkdir -p /ws/src/gcc
|
||||
cd /ws/src/gcc
|
||||
tar -xJf "/tmp/$GCC_TAR"
|
||||
rm -f "/tmp/$GCC_TAR"
|
||||
|
||||
download_tar_and_extract_into_dir "$GCC_URL" "$GCC_SUM" /ws/src/gcc
|
||||
mkdir -p /ws/build/gcc
|
||||
cd /ws/build/gcc
|
||||
export CFLAGS='-fPIC'
|
||||
|
|
|
|||
|
|
@ -40,3 +40,37 @@ function retry {
|
|||
}
|
||||
done
|
||||
}
|
||||
|
||||
download_tar_and_extract_into_dir() {
|
||||
local url="$1"
|
||||
local sum="$2"
|
||||
local dir="$3"
|
||||
local file=$(mktemp -u)
|
||||
|
||||
while :; do
|
||||
if [[ -f "$file" ]]; then
|
||||
if ! h="$(sha256sum "$file" | awk '{ print $1 }')"; then
|
||||
printf 'ERROR: reading hash\n' >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ "$h" == "$sum" ]]; then
|
||||
break
|
||||
fi
|
||||
|
||||
printf 'WARNING: hash mismatch: %s != expected %s\n' "$h" "$sum" >&2
|
||||
rm -f "$file"
|
||||
fi
|
||||
|
||||
printf 'Downloading: %s\n' "$url"
|
||||
if ! curl -f -L -o "$file" "$url"; then
|
||||
rm -f "$file"
|
||||
sleep 1
|
||||
fi
|
||||
done
|
||||
|
||||
mkdir -p "$dir"
|
||||
cd "$dir"
|
||||
tar -xf "$file"
|
||||
rm -f "$file"
|
||||
}
|
||||
|
|
|
|||
162
src/ci/docker/scripts/solaris-toolchain.sh
Normal file
162
src/ci/docker/scripts/solaris-toolchain.sh
Normal file
|
|
@ -0,0 +1,162 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -o errexit
|
||||
set -o pipefail
|
||||
set -o xtrace
|
||||
|
||||
source /tmp/shared.sh
|
||||
|
||||
ARCH="$1"
|
||||
PHASE="$2"
|
||||
|
||||
JOBS="$(getconf _NPROCESSORS_ONLN)"
|
||||
|
||||
case "$ARCH" in
|
||||
x86_64)
|
||||
SYSROOT_MACH='i386'
|
||||
;;
|
||||
sparcv9)
|
||||
SYSROOT_MACH='sparc'
|
||||
;;
|
||||
*)
|
||||
printf 'ERROR: unknown architecture: %s\n' "$ARCH"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
BUILD_TARGET="$ARCH-pc-solaris2.11"
|
||||
|
||||
#
|
||||
# The illumos and the Solaris build both use the same GCC-level host triple,
|
||||
# though different versions of GCC are used and with different configuration
|
||||
# options. To ensure as little accidental cross-pollination as possible, we
|
||||
# build the illumos toolchain in a specific directory tree and just symlink the
|
||||
# expected tools into /usr/local/bin at the end. We omit /usr/local/bin from
|
||||
# PATH here for similar reasons.
|
||||
#
|
||||
PREFIX="/opt/solaris/$ARCH"
|
||||
export PATH="$PREFIX/bin:/usr/bin:/bin:/usr/sbin:/sbin"
|
||||
|
||||
#
|
||||
# NOTE: The compiler version selected here is more specific than might appear.
|
||||
# GCC 7.X releases do not appear to cross-compile correctly for Solaris
|
||||
# targets, at least insofar as they refuse to enable TLS in libstdc++. When
|
||||
# changing the GCC version in future, one must carefully verify that TLS is
|
||||
# enabled in all of the static libraries we intend to include in output
|
||||
# binaries.
|
||||
#
|
||||
GCC_VERSION='8.4.0'
|
||||
GCC_SUM='e30a6e52d10e1f27ed55104ad233c30bd1e99cfb5ff98ab022dc941edd1b2dd4'
|
||||
GCC_BASE="gcc-$GCC_VERSION"
|
||||
GCC_TAR="gcc-$GCC_VERSION.tar.xz"
|
||||
GCC_URL="https://ci-mirrors.rust-lang.org/rustc/$GCC_TAR"
|
||||
|
||||
SYSROOT_VER='2025-02-21'
|
||||
if [ $ARCH = "x86_64" ]; then
|
||||
SYSROOT_SUM='e82b78c14464cc2dc71f3cdab312df3dd63441d7c23eeeaf34d41d8b947688d3'
|
||||
SYSROOT_TAR="solaris-11.4.42.111.0-i386-sysroot-v$SYSROOT_VER.tar.bz2"
|
||||
SYSROOT_DIR="$PREFIX/sysroot-x86_64"
|
||||
else
|
||||
SYSROOT_SUM='e249a7ef781b9b3297419bd014fa0574800703981d84e113d6af3a897a8b4ffc'
|
||||
SYSROOT_TAR="solaris-11.4.42.111.0-sparc-sysroot-v$SYSROOT_VER.tar.bz2"
|
||||
SYSROOT_DIR="$PREFIX/sysroot-sparcv9"
|
||||
fi
|
||||
SYSROOT_URL="https://ci-mirrors.rust-lang.org/rustc/$SYSROOT_TAR"
|
||||
|
||||
BINUTILS_VERSION='2.44'
|
||||
BINUTILS_SUM='ce2017e059d63e67ddb9240e9d4ec49c2893605035cd60e92ad53177f4377237'
|
||||
BINUTILS_BASE="binutils-$BINUTILS_VERSION"
|
||||
BINUTILS_TAR="$BINUTILS_BASE.tar.xz"
|
||||
BINUTILS_URL="https://ci-mirrors.rust-lang.org/rustc/$BINUTILS_TAR"
|
||||
|
||||
|
||||
case "$PHASE" in
|
||||
sysroot)
|
||||
download_tar_and_extract_into_dir "$SYSROOT_URL" "$SYSROOT_SUM" "$SYSROOT_DIR"
|
||||
;;
|
||||
|
||||
binutils)
|
||||
download_tar_and_extract_into_dir "$BINUTILS_URL" "$BINUTILS_SUM" /ws/src/binutils
|
||||
cat > binutils.patch <<EOF
|
||||
Workaround for: https://github.com/rust-lang/rust/issues/137997
|
||||
--- binutils-2.44/bfd/elflink.c
|
||||
+++ binutils-2.44/bfd/elflink.c
|
||||
@@ -5150,7 +5150,7 @@
|
||||
if it is not a function, because it might be the version
|
||||
symbol itself. FIXME: What if it isn't? */
|
||||
if ((iver.vs_vers & VERSYM_HIDDEN) != 0
|
||||
- || (vernum > 1
|
||||
+ || (vernum > 1 && strcmp(name, "logb") != 0
|
||||
&& (!bfd_is_abs_section (sec)
|
||||
|| bed->is_function_type (ELF_ST_TYPE (isym->st_info)))))
|
||||
{
|
||||
EOF
|
||||
f=binutils-$BINUTILS_VERSION/bfd/elflink.c && expand -t 4 "$f" > "$f.exp"
|
||||
mv binutils-$BINUTILS_VERSION/bfd/elflink.c.exp binutils-$BINUTILS_VERSION/bfd/elflink.c
|
||||
patch binutils-$BINUTILS_VERSION/bfd/elflink.c < binutils.patch
|
||||
rm binutils.patch
|
||||
|
||||
mkdir -p /ws/build/binutils
|
||||
cd /ws/build/binutils
|
||||
"/ws/src/binutils/$BINUTILS_BASE/configure" \
|
||||
--prefix="$PREFIX" \
|
||||
--target="$BUILD_TARGET" \
|
||||
--program-prefix="$ARCH-solaris-" \
|
||||
--with-sysroot="$SYSROOT_DIR"
|
||||
|
||||
make -j "$JOBS"
|
||||
|
||||
mkdir -p "$PREFIX"
|
||||
make install
|
||||
|
||||
cd
|
||||
rm -rf /ws/src/binutils /ws/build/binutils
|
||||
;;
|
||||
|
||||
gcc)
|
||||
download_tar_and_extract_into_dir "$GCC_URL" "$GCC_SUM" /ws/src/gcc
|
||||
mkdir -p /ws/build/gcc
|
||||
cd /ws/build/gcc
|
||||
export CFLAGS='-fPIC'
|
||||
export CXXFLAGS='-fPIC'
|
||||
export CXXFLAGS_FOR_TARGET='-fPIC'
|
||||
export CFLAGS_FOR_TARGET='-fPIC'
|
||||
"/ws/src/gcc/$GCC_BASE/configure" \
|
||||
--prefix="$PREFIX" \
|
||||
--target="$BUILD_TARGET" \
|
||||
--program-prefix="$ARCH-solaris-" \
|
||||
--with-sysroot="$SYSROOT_DIR" \
|
||||
--with-gnu-as \
|
||||
--with-gnu-ld \
|
||||
--disable-nls \
|
||||
--disable-libgomp \
|
||||
--disable-libquadmath \
|
||||
--disable-libssp \
|
||||
--disable-libvtv \
|
||||
--disable-libcilkrts \
|
||||
--disable-libada \
|
||||
--disable-libsanitizer \
|
||||
--disable-libquadmath-support \
|
||||
--disable-shared \
|
||||
--enable-tls
|
||||
|
||||
make -j "$JOBS"
|
||||
|
||||
mkdir -p "$PREFIX"
|
||||
make install
|
||||
|
||||
#
|
||||
# Link toolchain commands into /usr/local/bin so that cmake and others
|
||||
# can find them:
|
||||
#
|
||||
(cd "$PREFIX/bin" && ls -U) | grep "^$ARCH-solaris-" |
|
||||
xargs -t -I% ln -s "$PREFIX/bin/%" '/usr/local/bin/'
|
||||
|
||||
cd
|
||||
rm -rf /ws/src/gcc /ws/build/gcc
|
||||
;;
|
||||
|
||||
*)
|
||||
printf 'ERROR: unknown phase "%s"\n' "$PHASE" >&2
|
||||
exit 100
|
||||
;;
|
||||
esac
|
||||
|
|
@ -253,6 +253,12 @@ auto:
|
|||
- name: dist-x86_64-netbsd
|
||||
<<: *job-linux-4c
|
||||
|
||||
- name: dist-x86_64-solaris
|
||||
<<: *job-linux-4c
|
||||
|
||||
- name: dist-sparcv9-solaris
|
||||
<<: *job-linux-4c
|
||||
|
||||
# The i686-gnu job is split into multiple jobs to run tests in parallel.
|
||||
# i686-gnu-1 skips tests that run in i686-gnu-2.
|
||||
- name: i686-gnu-1
|
||||
|
|
|
|||
|
|
@ -192,7 +192,7 @@ to save information after compiling a crate to be reused when recompiling the
|
|||
crate, improving re-compile times. This takes a path to a directory where
|
||||
incremental files will be stored.
|
||||
|
||||
Using incremental compilation inhibits certain optimizations (for example by increasing the amount of codegen units) and is therefore not recommend for release builds.
|
||||
Using incremental compilation inhibits certain optimizations (for example by increasing the amount of codegen units) and is therefore not recommended for release builds.
|
||||
|
||||
## inline-threshold
|
||||
|
||||
|
|
|
|||
|
|
@ -110,6 +110,8 @@ target | notes
|
|||
`x86_64-unknown-linux-musl` | 64-bit Linux with musl 1.2.3
|
||||
[`x86_64-unknown-linux-ohos`](platform-support/openharmony.md) | x86_64 OpenHarmony
|
||||
[`x86_64-unknown-netbsd`](platform-support/netbsd.md) | NetBSD/amd64
|
||||
[`x86_64-pc-solaris`](platform-support/solaris.md) | 64-bit x86 Solaris 11.4
|
||||
[`sparcv9-sun-solaris`](platform-support/solaris.md) | SPARC V9 Solaris 11.4
|
||||
|
||||
## Tier 2 without Host Tools
|
||||
|
||||
|
|
@ -183,7 +185,6 @@ target | std | notes
|
|||
`riscv64gc-unknown-none-elf` | * | Bare RISC-V (RV64IMAFDC ISA)
|
||||
`riscv64imac-unknown-none-elf` | * | Bare RISC-V (RV64IMAC ISA)
|
||||
`sparc64-unknown-linux-gnu` | ✓ | SPARC Linux (kernel 4.4, glibc 2.23)
|
||||
[`sparcv9-sun-solaris`](platform-support/solaris.md) | ✓ | SPARC V9 Solaris 11.4
|
||||
[`thumbv6m-none-eabi`](platform-support/thumbv6m-none-eabi.md) | * | Bare Armv6-M
|
||||
[`thumbv7em-none-eabi`](platform-support/thumbv7em-none-eabi.md) | * | Bare Armv7E-M
|
||||
[`thumbv7em-none-eabihf`](platform-support/thumbv7em-none-eabi.md) | * | Bare Armv7E-M, hardfloat
|
||||
|
|
@ -203,7 +204,6 @@ target | std | notes
|
|||
[`x86_64-apple-ios-macabi`](platform-support/apple-ios-macabi.md) | ✓ | Mac Catalyst on x86_64
|
||||
[`x86_64-fortanix-unknown-sgx`](platform-support/x86_64-fortanix-unknown-sgx.md) | ✓ | [Fortanix ABI] for 64-bit Intel SGX
|
||||
[`x86_64-linux-android`](platform-support/android.md) | ✓ | 64-bit x86 Android
|
||||
[`x86_64-pc-solaris`](platform-support/solaris.md) | ✓ | 64-bit x86 Solaris 11.4
|
||||
[`x86_64-pc-windows-gnullvm`](platform-support/windows-gnullvm.md) | ✓ | 64-bit x86 MinGW (Windows 10+), LLVM ABI
|
||||
[`x86_64-unknown-fuchsia`](platform-support/fuchsia.md) | ✓ | 64-bit x86 Fuchsia
|
||||
`x86_64-unknown-linux-gnux32` | ✓ | 64-bit Linux (x32 ABI) (kernel 4.15, glibc 2.27)
|
||||
|
|
|
|||
|
|
@ -12,7 +12,9 @@ Rust for Solaris operating system.
|
|||
|
||||
## Requirements
|
||||
|
||||
Binary built for this target is expected to run on sparcv9 or x86_64, and Solaris 11.4.
|
||||
The `sparcv9-sun-solaris` and `x86_64-pc-solaris` targets are Tier 2 with host tools.
|
||||
|
||||
Binary built for these targets are expected to run on sparcv9 or x86_64, and Solaris 11.4.
|
||||
|
||||
## Testing
|
||||
|
||||
|
|
|
|||
|
|
@ -2,120 +2,8 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
r"""
|
||||
htmldocck.py is a custom checker script for Rustdoc HTML outputs.
|
||||
|
||||
# How and why?
|
||||
|
||||
The principle is simple: This script receives a path to generated HTML
|
||||
documentation and a "template" script, which has a series of check
|
||||
commands like `@has` or `@matches`. Each command is used to check if
|
||||
some pattern is present or not present in the particular file or in
|
||||
a particular node of the HTML tree. In many cases, the template script
|
||||
happens to be the source code given to rustdoc.
|
||||
|
||||
While it indeed is possible to test in smaller portions, it has been
|
||||
hard to construct tests in this fashion and major rendering errors were
|
||||
discovered much later. This script is designed to make black-box and
|
||||
regression testing of Rustdoc easy. This does not preclude the needs for
|
||||
unit testing, but can be used to complement related tests by quickly
|
||||
showing the expected renderings.
|
||||
|
||||
In order to avoid one-off dependencies for this task, this script uses
|
||||
a reasonably working HTML parser and the existing XPath implementation
|
||||
from Python's standard library. Hopefully, we won't render
|
||||
non-well-formed HTML.
|
||||
|
||||
# Commands
|
||||
|
||||
Commands start with an `@` followed by a command name (letters and
|
||||
hyphens), and zero or more arguments separated by one or more whitespace
|
||||
characters and optionally delimited with single or double quotes. The `@`
|
||||
mark cannot be preceded by a non-whitespace character. Other lines
|
||||
(including every text up to the first `@`) are ignored, but it is
|
||||
recommended to avoid the use of `@` in the template file.
|
||||
|
||||
There are a number of supported commands:
|
||||
|
||||
* `@has PATH` checks for the existence of the given file.
|
||||
|
||||
`PATH` is relative to the output directory. It can be given as `-`
|
||||
which repeats the most recently used `PATH`.
|
||||
|
||||
* `@hasraw PATH PATTERN` and `@matchesraw PATH PATTERN` checks
|
||||
for the occurrence of the given pattern `PATTERN` in the specified file.
|
||||
Only one occurrence of the pattern is enough.
|
||||
|
||||
For `@hasraw`, `PATTERN` is a whitespace-normalized (every consecutive
|
||||
whitespace being replaced by one single space character) string.
|
||||
The entire file is also whitespace-normalized including newlines.
|
||||
|
||||
For `@matchesraw`, `PATTERN` is a Python-supported regular expression.
|
||||
The file remains intact but the regexp is matched without the `MULTILINE`
|
||||
and `IGNORECASE` options. You can still use a prefix `(?m)` or `(?i)`
|
||||
to override them, and `\A` and `\Z` for definitely matching
|
||||
the beginning and end of the file.
|
||||
|
||||
(The same distinction goes to other variants of these commands.)
|
||||
|
||||
* `@has PATH XPATH PATTERN` and `@matches PATH XPATH PATTERN` checks for
|
||||
the presence of the given XPath `XPATH` in the specified HTML file,
|
||||
and also the occurrence of the given pattern `PATTERN` in the matching
|
||||
node or attribute. Only one occurrence of the pattern in the match
|
||||
is enough.
|
||||
|
||||
`PATH` should be a valid and well-formed HTML file. It does *not*
|
||||
accept arbitrary HTML5; it should have matching open and close tags
|
||||
and correct entity references at least.
|
||||
|
||||
`XPATH` is an XPath expression to match. The XPath is fairly limited:
|
||||
`tag`, `*`, `.`, `//`, `..`, `[@attr]`, `[@attr='value']`, `[tag]`,
|
||||
`[POS]` (element located in given `POS`), `[last()-POS]`, `text()`
|
||||
and `@attr` (both as the last segment) are supported. Some examples:
|
||||
|
||||
- `//pre` or `.//pre` matches any element with a name `pre`.
|
||||
- `//a[@href]` matches any element with an `href` attribute.
|
||||
- `//*[@class="impl"]//code` matches any element with a name `code`,
|
||||
which is an ancestor of some element which `class` attr is `impl`.
|
||||
- `//h1[@class="fqn"]/span[1]/a[last()]/@class` matches a value of
|
||||
`class` attribute in the last `a` element (can be followed by more
|
||||
elements that are not `a`) inside the first `span` in the `h1` with
|
||||
a class of `fqn`. Note that there cannot be any additional elements
|
||||
between them due to the use of `/` instead of `//`.
|
||||
|
||||
Do not try to use non-absolute paths, it won't work due to the flawed
|
||||
ElementTree implementation. The script rejects them.
|
||||
|
||||
For the text matches (i.e. paths not ending with `@attr`), any
|
||||
subelements are flattened into one string; this is handy for ignoring
|
||||
highlights for example. If you want to simply check for the presence of
|
||||
a given node or attribute, use an empty string (`""`) as a `PATTERN`.
|
||||
|
||||
* `@count PATH XPATH COUNT` checks for the occurrence of the given XPath
|
||||
in the specified file. The number of occurrences must match the given
|
||||
count.
|
||||
|
||||
* `@count PATH XPATH TEXT COUNT` checks for the occurrence of the given XPath
|
||||
with the given text in the specified file. The number of occurrences must
|
||||
match the given count.
|
||||
|
||||
* `@snapshot NAME PATH XPATH` creates a snapshot test named NAME.
|
||||
A snapshot test captures a subtree of the DOM, at the location
|
||||
determined by the XPath, and compares it to a pre-recorded value
|
||||
in a file. The file's name is the test's name with the `.rs` extension
|
||||
replaced with `.NAME.html`, where NAME is the snapshot's name.
|
||||
|
||||
htmldocck supports the `--bless` option to accept the current subtree
|
||||
as expected, saving it to the file determined by the snapshot's name.
|
||||
compiletest's `--bless` flag is forwarded to htmldocck.
|
||||
|
||||
* `@has-dir PATH` checks for the existence of the given directory.
|
||||
|
||||
* `@files FOLDER_PATH [ENTRIES]`, checks that `FOLDER_PATH` contains exactly
|
||||
`[ENTRIES]`.
|
||||
|
||||
All conditions can be negated with `!`. `@!has foo/type.NoSuch.html`
|
||||
checks if the given file does not exist, for example.
|
||||
|
||||
For documentation and usage instructions, please see
|
||||
https://rustc-dev-guide.rust-lang.org/rustdoc-internals/rustdoc-test-suite.html
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import, print_function, unicode_literals
|
||||
|
|
|
|||
|
|
@ -345,9 +345,7 @@ pub(crate) fn run_global_ctxt(
|
|||
// (see `override_queries` in the `config`)
|
||||
|
||||
// NOTE: These are copy/pasted from typeck/lib.rs and should be kept in sync with those changes.
|
||||
let _ = tcx.sess.time("wf_checking", || {
|
||||
tcx.try_par_hir_for_each_module(|module| tcx.ensure_ok().check_mod_type_wf(module))
|
||||
});
|
||||
let _ = tcx.sess.time("wf_checking", || tcx.ensure_ok().check_type_wf(()));
|
||||
|
||||
tcx.dcx().abort_if_errors();
|
||||
|
||||
|
|
|
|||
|
|
@ -960,5 +960,7 @@ pub fn eq_attr_args(l: &AttrArgs, r: &AttrArgs) -> bool {
|
|||
}
|
||||
|
||||
pub fn eq_delim_args(l: &DelimArgs, r: &DelimArgs) -> bool {
|
||||
l.delim == r.delim && l.tokens.eq_unspanned(&r.tokens)
|
||||
l.delim == r.delim
|
||||
&& l.tokens.len() == r.tokens.len()
|
||||
&& l.tokens.iter().zip(r.tokens.iter()).all(|(a, b)| a.eq_unspanned(b))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -145,10 +145,7 @@ impl IsolatedAlloc {
|
|||
if pinfo.domain_size() < offset_pinfo + size_pinfo {
|
||||
break;
|
||||
}
|
||||
// FIXME: is there a more efficient way to check whether the entire range is unset
|
||||
// in the bitset?
|
||||
let range_avail = !(offset_pinfo..offset_pinfo + size_pinfo).any(|i| pinfo.contains(i));
|
||||
if range_avail {
|
||||
if !pinfo.contains_any(offset_pinfo..offset_pinfo + size_pinfo) {
|
||||
pinfo.insert_range(offset_pinfo..offset_pinfo + size_pinfo);
|
||||
// SAFETY: We checked the available bytes after `idx` in the call
|
||||
// to `domain_size` above and asserted there are at least `idx +
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue