Skip to content

Commit a3b1fd2

Browse files
committed
Auto merge of rust-lang#107651 - Kobzol:ci-single-cgu, r=<try>
[WIP] Build `rustc` with a single CGU on x64 Linux Follow-up attempt to rust-lang#87650. I wonder if anything changed with the addition of LTO. I also enabled a single CGU only for the actual build of the compiler on CI, so that we can better see the perf. effects on the bootstrap benchmark.
2 parents e7f9f48 + dba68fa commit a3b1fd2

27 files changed

+29
-40
lines changed

.github/workflows/ci.yml

-1
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,6 @@ jobs:
529529
try:
530530
name: "try - ${{ matrix.name }}"
531531
env:
532-
DIST_TRY_BUILD: 1
533532
CI_JOB_NAME: "${{ matrix.name }}"
534533
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
535534
HEAD_SHA: "${{ github.event.pull_request.head.sha || github.sha }}"

.gitmodules

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
[submodule "src/llvm-project"]
3434
path = src/llvm-project
3535
url = https://github.com/rust-lang/llvm-project.git
36-
branch = rustc/17.0-2023-07-29
36+
branch = rustc/16.0-2023-06-05
3737
shallow = true
3838
[submodule "src/doc/embedded-book"]
3939
path = src/doc/embedded-book

compiler/rustc_codegen_llvm/src/context.rs

-11
Original file line numberDiff line numberDiff line change
@@ -146,17 +146,6 @@ pub unsafe fn create_module<'ll>(
146146
target_data_layout = target_data_layout.replace("-n32:64-", "-n64-");
147147
}
148148
}
149-
if llvm_version < (17, 0, 0) {
150-
if sess.target.arch.starts_with("powerpc") {
151-
// LLVM 17 specifies function pointer alignment for ppc:
152-
// https://reviews.llvm.org/D147016
153-
target_data_layout = target_data_layout
154-
.replace("-Fn32", "")
155-
.replace("-Fi32", "")
156-
.replace("-Fn64", "")
157-
.replace("-Fi64", "");
158-
}
159-
}
160149

161150
// Ensure the data-layout values hardcoded remain the defaults.
162151
if sess.target.is_builtin {

compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,8 @@ extern "C" void LLVMRustPrintTargetCPUs(LLVMTargetMachineRef TM,
333333
#if LLVM_VERSION_GE(17, 0)
334334
const MCSubtargetInfo *MCInfo = Target->getMCSubtargetInfo();
335335
const ArrayRef<SubtargetSubTypeKV> CPUTable = MCInfo->getAllProcessorDescriptions();
336+
#elif defined(LLVM_RUSTLLVM)
337+
const ArrayRef<SubtargetSubTypeKV> CPUTable = MCInfo->getCPUTable();
336338
#else
337339
Buf << "Full target CPU help is not supported by this LLVM version.\n\n";
338340
SubtargetSubTypeKV TargetCPUKV = { TargetCPU, {{}}, {{}} };
@@ -1199,7 +1201,7 @@ struct LLVMRustThinLTOData {
11991201

12001202
// Not 100% sure what these are, but they impact what's internalized and
12011203
// what's inlined across modules, I believe.
1202-
#if LLVM_VERSION_GE(18, 0)
1204+
#if LLVM_VERSION_GE(17, 0)
12031205
DenseMap<StringRef, FunctionImporter::ImportMapTy> ImportLists;
12041206
DenseMap<StringRef, FunctionImporter::ExportSetTy> ExportLists;
12051207
DenseMap<StringRef, GVSummaryMapTy> ModuleToDefinedGVSummaries;

compiler/rustc_target/src/spec/powerpc64_ibm_aix.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ pub fn target() -> Target {
1111
Target {
1212
llvm_target: "powerpc64-ibm-aix".into(),
1313
pointer_width: 64,
14-
data_layout: "E-m:a-Fi64-i64:64-n32:64-S128-v256:256:256-v512:512:512".into(),
14+
data_layout: "E-m:a-i64:64-n32:64-S128-v256:256:256-v512:512:512".into(),
1515
arch: "powerpc64".into(),
1616
options: base,
1717
}

compiler/rustc_target/src/spec/powerpc64_unknown_freebsd.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ pub fn target() -> Target {
1111
Target {
1212
llvm_target: "powerpc64-unknown-freebsd".into(),
1313
pointer_width: 64,
14-
data_layout: "E-m:e-Fn32-i64:64-n32:64".into(),
14+
data_layout: "E-m:e-i64:64-n32:64".into(),
1515
arch: "powerpc64".into(),
1616
options: TargetOptions { endian: Endian::Big, mcount: "_mcount".into(), ..base },
1717
}

compiler/rustc_target/src/spec/powerpc64_unknown_linux_gnu.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ pub fn target() -> Target {
1111
Target {
1212
llvm_target: "powerpc64-unknown-linux-gnu".into(),
1313
pointer_width: 64,
14-
data_layout: "E-m:e-Fi64-i64:64-n32:64-S128-v256:256:256-v512:512:512".into(),
14+
data_layout: "E-m:e-i64:64-n32:64-S128-v256:256:256-v512:512:512".into(),
1515
arch: "powerpc64".into(),
1616
options: TargetOptions { endian: Endian::Big, mcount: "_mcount".into(), ..base },
1717
}

compiler/rustc_target/src/spec/powerpc64_unknown_linux_musl.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ pub fn target() -> Target {
1111
Target {
1212
llvm_target: "powerpc64-unknown-linux-musl".into(),
1313
pointer_width: 64,
14-
data_layout: "E-m:e-Fi64-i64:64-n32:64-S128-v256:256:256-v512:512:512".into(),
14+
data_layout: "E-m:e-i64:64-n32:64-S128-v256:256:256-v512:512:512".into(),
1515
arch: "powerpc64".into(),
1616
options: TargetOptions { endian: Endian::Big, mcount: "_mcount".into(), ..base },
1717
}

compiler/rustc_target/src/spec/powerpc64_unknown_openbsd.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ pub fn target() -> Target {
1111
Target {
1212
llvm_target: "powerpc64-unknown-openbsd".into(),
1313
pointer_width: 64,
14-
data_layout: "E-m:e-Fn32-i64:64-n32:64".into(),
14+
data_layout: "E-m:e-i64:64-n32:64".into(),
1515
arch: "powerpc64".into(),
1616
options: TargetOptions { endian: Endian::Big, mcount: "_mcount".into(), ..base },
1717
}

compiler/rustc_target/src/spec/powerpc64_wrs_vxworks.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ pub fn target() -> Target {
1111
Target {
1212
llvm_target: "powerpc64-unknown-linux-gnu".into(),
1313
pointer_width: 64,
14-
data_layout: "E-m:e-Fi64-i64:64-n32:64-S128-v256:256:256-v512:512:512".into(),
14+
data_layout: "E-m:e-i64:64-n32:64-S128-v256:256:256-v512:512:512".into(),
1515
arch: "powerpc64".into(),
1616
options: TargetOptions { endian: Endian::Big, ..base },
1717
}

compiler/rustc_target/src/spec/powerpc64le_unknown_freebsd.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ pub fn target() -> Target {
1010
Target {
1111
llvm_target: "powerpc64le-unknown-freebsd".into(),
1212
pointer_width: 64,
13-
data_layout: "e-m:e-Fn32-i64:64-n32:64".into(),
13+
data_layout: "e-m:e-i64:64-n32:64".into(),
1414
arch: "powerpc64".into(),
1515
options: TargetOptions { mcount: "_mcount".into(), ..base },
1616
}

compiler/rustc_target/src/spec/powerpc64le_unknown_linux_gnu.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ pub fn target() -> Target {
1010
Target {
1111
llvm_target: "powerpc64le-unknown-linux-gnu".into(),
1212
pointer_width: 64,
13-
data_layout: "e-m:e-Fn32-i64:64-n32:64-S128-v256:256:256-v512:512:512".into(),
13+
data_layout: "e-m:e-i64:64-n32:64-S128-v256:256:256-v512:512:512".into(),
1414
arch: "powerpc64".into(),
1515
options: TargetOptions { mcount: "_mcount".into(), ..base },
1616
}

compiler/rustc_target/src/spec/powerpc64le_unknown_linux_musl.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ pub fn target() -> Target {
1010
Target {
1111
llvm_target: "powerpc64le-unknown-linux-musl".into(),
1212
pointer_width: 64,
13-
data_layout: "e-m:e-Fn32-i64:64-n32:64-S128-v256:256:256-v512:512:512".into(),
13+
data_layout: "e-m:e-i64:64-n32:64-S128-v256:256:256-v512:512:512".into(),
1414
arch: "powerpc64".into(),
1515
options: TargetOptions { mcount: "_mcount".into(), ..base },
1616
}

compiler/rustc_target/src/spec/powerpc_unknown_freebsd.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ pub fn target() -> Target {
1414
Target {
1515
llvm_target: "powerpc-unknown-freebsd13.0".into(),
1616
pointer_width: 32,
17-
data_layout: "E-m:e-p:32:32-Fn32-i64:64-n32".into(),
17+
data_layout: "E-m:e-p:32:32-i64:64-n32".into(),
1818
arch: "powerpc".into(),
1919
options: TargetOptions {
2020
endian: Endian::Big,

compiler/rustc_target/src/spec/powerpc_unknown_linux_gnu.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ pub fn target() -> Target {
1010
Target {
1111
llvm_target: "powerpc-unknown-linux-gnu".into(),
1212
pointer_width: 32,
13-
data_layout: "E-m:e-p:32:32-Fn32-i64:64-n32".into(),
13+
data_layout: "E-m:e-p:32:32-i64:64-n32".into(),
1414
arch: "powerpc".into(),
1515
options: TargetOptions { endian: Endian::Big, mcount: "_mcount".into(), ..base },
1616
}

compiler/rustc_target/src/spec/powerpc_unknown_linux_gnuspe.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ pub fn target() -> Target {
1010
Target {
1111
llvm_target: "powerpc-unknown-linux-gnuspe".into(),
1212
pointer_width: 32,
13-
data_layout: "E-m:e-p:32:32-Fn32-i64:64-n32".into(),
13+
data_layout: "E-m:e-p:32:32-i64:64-n32".into(),
1414
arch: "powerpc".into(),
1515
options: TargetOptions {
1616
abi: "spe".into(),

compiler/rustc_target/src/spec/powerpc_unknown_linux_musl.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ pub fn target() -> Target {
1010
Target {
1111
llvm_target: "powerpc-unknown-linux-musl".into(),
1212
pointer_width: 32,
13-
data_layout: "E-m:e-p:32:32-Fn32-i64:64-n32".into(),
13+
data_layout: "E-m:e-p:32:32-i64:64-n32".into(),
1414
arch: "powerpc".into(),
1515
options: TargetOptions { endian: Endian::Big, mcount: "_mcount".into(), ..base },
1616
}

compiler/rustc_target/src/spec/powerpc_unknown_netbsd.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ pub fn target() -> Target {
1010
Target {
1111
llvm_target: "powerpc-unknown-netbsd".into(),
1212
pointer_width: 32,
13-
data_layout: "E-m:e-p:32:32-Fn32-i64:64-n32".into(),
13+
data_layout: "E-m:e-p:32:32-i64:64-n32".into(),
1414
arch: "powerpc".into(),
1515
options: TargetOptions { endian: Endian::Big, mcount: "__mcount".into(), ..base },
1616
}

compiler/rustc_target/src/spec/powerpc_unknown_openbsd.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ pub fn target() -> Target {
1010
Target {
1111
llvm_target: "powerpc-unknown-openbsd".into(),
1212
pointer_width: 32,
13-
data_layout: "E-m:e-p:32:32-Fn32-i64:64-n32".into(),
13+
data_layout: "E-m:e-p:32:32-i64:64-n32".into(),
1414
arch: "powerpc".into(),
1515
options: base,
1616
}

compiler/rustc_target/src/spec/powerpc_wrs_vxworks.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ pub fn target() -> Target {
1010
Target {
1111
llvm_target: "powerpc-unknown-linux-gnu".into(),
1212
pointer_width: 32,
13-
data_layout: "E-m:e-p:32:32-Fn32-i64:64-n32".into(),
13+
data_layout: "E-m:e-p:32:32-i64:64-n32".into(),
1414
arch: "powerpc".into(),
1515
options: TargetOptions { endian: Endian::Big, features: "+secure-plt".into(), ..base },
1616
}

compiler/rustc_target/src/spec/powerpc_wrs_vxworks_spe.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ pub fn target() -> Target {
1010
Target {
1111
llvm_target: "powerpc-unknown-linux-gnuspe".into(),
1212
pointer_width: 32,
13-
data_layout: "E-m:e-p:32:32-Fn32-i64:64-n32".into(),
13+
data_layout: "E-m:e-p:32:32-i64:64-n32".into(),
1414
arch: "powerpc".into(),
1515
options: TargetOptions {
1616
abi: "spe".into(),

src/bootstrap/llvm.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1160,8 +1160,8 @@ impl Step for CrtBeginEnd {
11601160
return out_dir;
11611161
}
11621162

1163-
let crtbegin_src = builder.src.join("src/llvm-project/compiler-rt/lib/builtins/crtbegin.c");
1164-
let crtend_src = builder.src.join("src/llvm-project/compiler-rt/lib/builtins/crtend.c");
1163+
let crtbegin_src = builder.src.join("src/llvm-project/compiler-rt/lib/crt/crtbegin.c");
1164+
let crtend_src = builder.src.join("src/llvm-project/compiler-rt/lib/crt/crtend.c");
11651165
if up_to_date(&crtbegin_src, &out_dir.join("crtbegin.o"))
11661166
&& up_to_date(&crtend_src, &out_dir.join("crtendS.o"))
11671167
{

src/ci/docker/host-x86_64/dist-riscv64-linux/riscv64-unknown-linux-gnu.defconfig

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ CT_ARCH_64=y
1010
CT_ARCH_ARCH="rv64gc"
1111
CT_KERNEL_LINUX=y
1212
CT_LINUX_V_4_20=y
13-
CT_BINUTILS_V_2_36=y
13+
CT_BINUTILS_V_2_32=y
1414
CT_GLIBC_V_2_29=y
1515
CT_GCC_V_8=y
1616
CT_CC_LANG_CXX=y

src/ci/docker/host-x86_64/dist-various-2/Dockerfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,8 @@ ENV TARGETS=$TARGETS,x86_64-unknown-uefi
135135
# As per https://bugs.launchpad.net/ubuntu/+source/gcc-defaults/+bug/1300211
136136
# we need asm in the search path for gcc-9 (for gnux32) but not in the search path of the
137137
# cross compilers.
138-
# Luckily one of the folders is /usr/local/include so symlink /usr/include/x86_64-linux-gnu/asm there
139-
RUN ln -s /usr/include/x86_64-linux-gnu/asm /usr/local/include/asm
138+
# Luckily one of the folders is /usr/local/include so symlink /usr/include/asm-generic there
139+
RUN ln -s /usr/include/asm-generic /usr/local/include/asm
140140

141141
ENV RUST_CONFIGURE_ARGS --enable-extended --enable-lld --disable-docs \
142142
--set target.wasm32-wasi.wasi-root=/wasm32-wasi \

src/ci/docker/host-x86_64/dist-x86_64-linux/Dockerfile

+2-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@ ENV RUST_CONFIGURE_ARGS \
8484
--set llvm.ninja=false \
8585
--set rust.jemalloc \
8686
--set rust.use-lld=true \
87-
--set rust.lto=thin
87+
--set rust.lto=thin \
88+
--set rust.codegen-units=1
8889

8990
ENV SCRIPT python3 ../x.py build --set rust.debug=true opt-dist && \
9091
./build/$HOSTS/stage0-tools-bin/opt-dist python3 ../x.py dist \

src/ci/github-actions/ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -689,7 +689,7 @@ jobs:
689689
<<: *base-ci-job
690690
name: try - ${{ matrix.name }}
691691
env:
692-
DIST_TRY_BUILD: 1
692+
# DIST_TRY_BUILD: 1
693693
<<: [*shared-ci-variables, *prod-variables]
694694
if: github.event_name == 'push' && (github.ref == 'refs/heads/try' || github.ref == 'refs/heads/try-perf') && github.repository == 'rust-lang-ci/rust'
695695
strategy:

tests/ui/abi/stack-protector.rs

-2
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@ fn vulnerable_function() {
4040
// Overwrite the on-stack return address with the address of `malicious_code()`,
4141
// thereby jumping to that function when returning from `vulnerable_function()`.
4242
unsafe { fill(stackaddr, bad_code_ptr, 20); }
43-
// Capture the address, so the write is not optimized away.
44-
std::hint::black_box(stackaddr);
4543
}
4644

4745
// Use an uninlined function with its own stack frame to make sure that we don't

0 commit comments

Comments
 (0)