Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 6ab2f39

Browse files
committedJul 22, 2024
Auto merge of #127990 - Oneirical:ii-the-high-priestest, r=<try>
Migrate `lto-linkage-used-attr`, `no-duplicate-libs` and `pgo-gen-no-imp-symbols` `run-make` tests to rmake Part of #121876 and the associated [Google Summer of Code project](https://blog.rust-lang.org/2024/05/01/gsoc-2024-selected-projects.html). try-job: x86_64-msvc try-job: aarch64-apple try-job: armhf-gnu try-job: test-various try-job: x86_64-gnu-llvm-18
2 parents aee3dc4 + 6d9d605 commit 6ab2f39

File tree

7 files changed

+64
-33
lines changed

7 files changed

+64
-33
lines changed
 

‎src/tools/tidy/src/allowed_run_make_makefiles.txt

-3
Original file line numberDiff line numberDiff line change
@@ -47,18 +47,15 @@ run-make/link-cfg/Makefile
4747
run-make/link-framework/Makefile
4848
run-make/long-linker-command-lines-cmd-exe/Makefile
4949
run-make/long-linker-command-lines/Makefile
50-
run-make/lto-linkage-used-attr/Makefile
5150
run-make/macos-deployment-target/Makefile
5251
run-make/min-global-align/Makefile
5352
run-make/native-link-modifier-bundle/Makefile
5453
run-make/native-link-modifier-whole-archive/Makefile
5554
run-make/no-alloc-shim/Makefile
5655
run-make/no-builtins-attribute/Makefile
57-
run-make/no-duplicate-libs/Makefile
5856
run-make/panic-abort-eh_frame/Makefile
5957
run-make/pdb-buildinfo-cl-cmd/Makefile
6058
run-make/pgo-gen-lto/Makefile
61-
run-make/pgo-gen-no-imp-symbols/Makefile
6259
run-make/pgo-indirect-call-promotion/Makefile
6360
run-make/pointer-auth-link-with-c/Makefile
6461
run-make/print-calling-conventions/Makefile

‎tests/run-make/lto-linkage-used-attr/Makefile

-8
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Link time optimizations (LTO) used to snip away some important symbols
2+
// when setting optimization level to 3 or higher.
3+
// This is an LLVM, not a rustc bug, fixed here: https://reviews.llvm.org/D145293
4+
// This test checks that the impl_* symbols are preserved as they should.
5+
// See https://github.com/rust-lang/rust/issues/108030
6+
7+
//@ only-x86_64-unknown-linux-gnu
8+
// Reason: some of the inline assembly directives are architecture-specific.
9+
10+
use run_make_support::rustc;
11+
12+
fn main() {
13+
rustc().arg("-Cdebuginfo=0").opt_level("3").input("lib.rs").run();
14+
rustc().arg("-Clto=fat").arg("-Cdebuginfo=0").opt_level("3").input("main.rs").run();
15+
}

‎tests/run-make/no-duplicate-libs/Makefile

-11
This file was deleted.
+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// The rust compiler used to try to detect duplicated libraries in
2+
// the linking order and remove the duplicates... but certain edge cases,
3+
// such as the one presented in `foo` and `bar` in this test, demand precise
4+
// control over the link order, including duplicates. As the anti-duplication
5+
// filter was removed, this test should now successfully see main be compiled
6+
// and executed.
7+
// See https://github.com/rust-lang/rust/pull/12688
8+
9+
//@ ignore-cross-compile
10+
// Reason: the compiled binary is executed
11+
12+
//@ ignore-msvc
13+
// Reason: native compilation results in an unresolved external symbol
14+
15+
use run_make_support::{build_native_static_lib, run, rustc};
16+
17+
fn main() {
18+
build_native_static_lib("foo");
19+
build_native_static_lib("bar");
20+
rustc().input("main.rs").run();
21+
run("main");
22+
}

‎tests/run-make/pgo-gen-no-imp-symbols/Makefile

-11
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// LLVM's profiling instrumentation adds a few symbols that are used by the profiler runtime.
2+
// Since these show up as globals in the LLVM IR, the compiler generates dllimport-related
3+
// __imp_ stubs for them. This can lead to linker errors because the instrumentation
4+
// symbols have weak linkage or are in a comdat section, but the __imp_ stubs aren't.
5+
// Since profiler-related symbols were excluded from stub-generation in #59812, this has
6+
// been fixed, and this test checks that the llvm profile symbol appear, but without the
7+
// anomalous __imp_ stubs.
8+
// See https://github.com/rust-lang/rust/pull/59812
9+
10+
use run_make_support::{cwd, rfs, rustc};
11+
12+
fn main() {
13+
rustc()
14+
.input("test.rs")
15+
.emit("llvm-ir")
16+
.opt()
17+
.codegen_units(1)
18+
.profile_generate(cwd())
19+
.arg("-Zno-profiler-runtime")
20+
.run();
21+
let out = rfs::read_to_string("test.ll");
22+
// We expect symbols starting with "__llvm_profile_".
23+
assert!(out.contains("__llvm_profile_"));
24+
// We do NOT expect the "__imp_" version of these symbols.
25+
assert!(!out.contains("__imp___llvm_profile_")); // 64 bit
26+
assert!(!out.contains("__imp____llvm_profile_")); // 32 bit
27+
}

0 commit comments

Comments
 (0)
Failed to load comments.