Skip to content

Commit d137e71

Browse files
authored
Unrolled build for rust-lang#115757
Rollup merge of rust-lang#115757 - DianQK:lto-linkage-used-attr, r=wesleywiser Add a test for rust-lang#108030 Closes rust-lang#108030. This issue has been resolved in LLVM 17. I can verify that this test fails on 63a81b0. r? compiler
2 parents e2b3676 + b99ace4 commit d137e71

File tree

3 files changed

+69
-0
lines changed

3 files changed

+69
-0
lines changed

Diff for: tests/run-make/lto-linkage-used-attr/Makefile

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
include ../tools.mk
2+
3+
# Verify that the impl_* symbols are preserved. #108030
4+
# only-x86_64-unknown-linux-gnu
5+
# min-llvm-version: 17
6+
7+
all:
8+
$(RUSTC) -Cdebuginfo=0 -Copt-level=3 lib.rs
9+
$(RUSTC) -Clto=fat -Cdebuginfo=0 -Copt-level=3 main.rs

Diff for: tests/run-make/lto-linkage-used-attr/lib.rs

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#![crate_type = "rlib"]
2+
#![crate_type = "cdylib"]
3+
4+
#[macro_export]
5+
macro_rules! asm_func {
6+
($name:expr, $body:expr $(, $($args:tt)*)?) => {
7+
core::arch::global_asm!(
8+
concat!(
9+
".p2align 4\n",
10+
".hidden ", $name, "\n",
11+
".global ", $name, "\n",
12+
".type ", $name, ",@function\n",
13+
$name, ":\n",
14+
$body,
15+
".size ", $name, ",.-", $name,
16+
)
17+
$(, $($args)*)?
18+
);
19+
};
20+
}
21+
22+
macro_rules! libcall_trampoline {
23+
($libcall:ident ; $libcall_impl:ident) => {
24+
asm_func!(
25+
stringify!($libcall),
26+
concat!(
27+
"
28+
.cfi_startproc simple
29+
.cfi_def_cfa_offset 0
30+
jmp {}
31+
.cfi_endproc
32+
",
33+
),
34+
sym $libcall_impl
35+
);
36+
};
37+
}
38+
39+
pub mod trampolines {
40+
extern "C" {
41+
pub fn table_fill_funcref();
42+
pub fn table_fill_externref();
43+
}
44+
45+
unsafe extern "C" fn impl_table_fill_funcref() {}
46+
unsafe extern "C" fn impl_table_fill_externref() {}
47+
48+
libcall_trampoline!(table_fill_funcref ; impl_table_fill_funcref);
49+
libcall_trampoline!(table_fill_externref ; impl_table_fill_externref);
50+
}

Diff for: tests/run-make/lto-linkage-used-attr/main.rs

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
extern crate lib;
2+
3+
use lib::trampolines::*;
4+
5+
fn main() {
6+
unsafe {
7+
table_fill_externref();
8+
table_fill_funcref();
9+
}
10+
}

0 commit comments

Comments
 (0)