2018-11-29 22:05:23 +00:00
|
|
|
// compile-flags: -C no-prepopulate-passes
|
2018-11-27 02:59:49 +00:00
|
|
|
// `#[no_mangle]`d functions always have external linkage, i.e., no `internal` in their `define`s
|
2018-09-21 22:58:11 +00:00
|
|
|
|
|
|
|
#![crate_type = "lib"]
|
|
|
|
#![no_std]
|
|
|
|
|
2021-03-27 22:11:24 +00:00
|
|
|
// CHECK: define{{( dso_local)?}} void @a()
|
2018-09-21 22:58:11 +00:00
|
|
|
#[no_mangle]
|
|
|
|
fn a() {}
|
|
|
|
|
2021-03-27 22:11:24 +00:00
|
|
|
// CHECK: define{{( dso_local)?}} void @b()
|
2018-09-21 22:58:11 +00:00
|
|
|
#[no_mangle]
|
|
|
|
pub fn b() {}
|
|
|
|
|
|
|
|
mod private {
|
2021-03-27 22:11:24 +00:00
|
|
|
// CHECK: define{{( dso_local)?}} void @c()
|
2018-09-21 22:58:11 +00:00
|
|
|
#[no_mangle]
|
|
|
|
fn c() {}
|
|
|
|
|
2021-03-27 22:11:24 +00:00
|
|
|
// CHECK: define{{( dso_local)?}} void @d()
|
2018-09-21 22:58:11 +00:00
|
|
|
#[no_mangle]
|
|
|
|
pub fn d() {}
|
|
|
|
}
|
|
|
|
|
|
|
|
const HIDDEN: () = {
|
2021-03-27 22:11:24 +00:00
|
|
|
// CHECK: define{{( dso_local)?}} void @e()
|
2018-09-21 22:58:11 +00:00
|
|
|
#[no_mangle]
|
|
|
|
fn e() {}
|
|
|
|
|
2021-03-27 22:11:24 +00:00
|
|
|
// CHECK: define{{( dso_local)?}} void @f()
|
2018-09-21 22:58:11 +00:00
|
|
|
#[no_mangle]
|
|
|
|
pub fn f() {}
|
|
|
|
};
|
|
|
|
|
|
|
|
// The surrounding item should not accidentally become external
|
2019-04-13 16:03:02 +00:00
|
|
|
// CHECK-LABEL: ; external_no_mangle_fns::x
|
|
|
|
// CHECK-NEXT: ; Function Attrs:
|
|
|
|
// CHECK-NEXT: define internal
|
2018-09-21 22:58:11 +00:00
|
|
|
#[inline(never)]
|
|
|
|
fn x() {
|
2021-03-27 22:11:24 +00:00
|
|
|
// CHECK: define{{( dso_local)?}} void @g()
|
2018-09-21 22:58:11 +00:00
|
|
|
#[no_mangle]
|
|
|
|
fn g() {
|
|
|
|
x();
|
|
|
|
}
|
|
|
|
|
2021-03-27 22:11:24 +00:00
|
|
|
// CHECK: define{{( dso_local)?}} void @h()
|
2018-09-21 22:58:11 +00:00
|
|
|
#[no_mangle]
|
|
|
|
pub fn h() {}
|
|
|
|
|
|
|
|
// side effect to keep `x` around
|
|
|
|
unsafe {
|
|
|
|
core::ptr::read_volatile(&42);
|
|
|
|
}
|
|
|
|
}
|
2020-06-08 08:37:11 +00:00
|
|
|
|
2021-03-27 22:11:24 +00:00
|
|
|
// CHECK: define{{( dso_local)?}} void @i()
|
2020-06-08 08:37:11 +00:00
|
|
|
#[no_mangle]
|
|
|
|
#[inline]
|
|
|
|
fn i() {}
|
|
|
|
|
2021-03-27 22:11:24 +00:00
|
|
|
// CHECK: define{{( dso_local)?}} void @j()
|
2020-06-08 08:37:11 +00:00
|
|
|
#[no_mangle]
|
|
|
|
#[inline]
|
|
|
|
pub fn j() {}
|
2020-06-09 14:49:59 +00:00
|
|
|
|
2021-03-27 22:11:24 +00:00
|
|
|
// CHECK: define{{( dso_local)?}} void @k()
|
2020-06-09 14:49:59 +00:00
|
|
|
#[no_mangle]
|
|
|
|
#[inline(always)]
|
|
|
|
fn k() {}
|
|
|
|
|
2021-03-27 22:11:24 +00:00
|
|
|
// CHECK: define{{( dso_local)?}} void @l()
|
2020-06-09 14:49:59 +00:00
|
|
|
#[no_mangle]
|
|
|
|
#[inline(always)]
|
|
|
|
pub fn l() {}
|