Skip to content

Commit 9a520f8

Browse files
authored
Rollup merge of rust-lang#139667 - 1c3t3a:remove-no-sanitize, r=m-ou-se
cfi: Remove #[no_sanitize(cfi)] for extern weak functions Previously (rust-lang#115200, rust-lang#138002), we added `#[no_sanitize(cfi)]` to all code paths that call to a weakly linked function. In rust-lang#138349 we fixed the root cause for this issue, which means we can now remove the corresponding attributes. r? `@rcvalle`
2 parents 5d82f7a + 26513b9 commit 9a520f8

File tree

8 files changed

+0
-41
lines changed

8 files changed

+0
-41
lines changed

Diff for: std/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,6 @@
312312
#![feature(needs_panic_runtime)]
313313
#![feature(negative_impls)]
314314
#![feature(never_type)]
315-
#![feature(no_sanitize)]
316315
#![feature(optimize_attribute)]
317316
#![feature(prelude_import)]
318317
#![feature(rustc_attrs)]

Diff for: std/src/sys/fd/unix.rs

-3
Original file line numberDiff line numberDiff line change
@@ -259,9 +259,6 @@ impl FileDesc {
259259
}
260260

261261
#[cfg(all(target_os = "android", target_pointer_width = "32"))]
262-
// FIXME(#115199): Rust currently omits weak function definitions
263-
// and its metadata from LLVM IR.
264-
#[no_sanitize(cfi)]
265262
pub fn read_vectored_at(&self, bufs: &mut [IoSliceMut<'_>], offset: u64) -> io::Result<usize> {
266263
weak!(
267264
fn preadv64(

Diff for: std/src/sys/fs/unix.rs

-14
Original file line numberDiff line numberDiff line change
@@ -1463,20 +1463,6 @@ impl File {
14631463
Ok(())
14641464
}
14651465

1466-
// FIXME(#115199): Rust currently omits weak function definitions
1467-
// and its metadata from LLVM IR.
1468-
#[cfg_attr(
1469-
any(
1470-
target_os = "android",
1471-
all(
1472-
target_os = "linux",
1473-
target_env = "gnu",
1474-
target_pointer_width = "32",
1475-
not(target_arch = "riscv32")
1476-
)
1477-
),
1478-
no_sanitize(cfi)
1479-
)]
14801466
pub fn set_times(&self, times: FileTimes) -> io::Result<()> {
14811467
#[cfg(not(any(
14821468
target_os = "redox",

Diff for: std/src/sys/pal/unix/thread.rs

-3
Original file line numberDiff line numberDiff line change
@@ -194,9 +194,6 @@ impl Thread {
194194
}
195195

196196
#[cfg(any(target_os = "solaris", target_os = "illumos", target_os = "nto"))]
197-
// FIXME(#115199): Rust currently omits weak function definitions
198-
// and its metadata from LLVM IR.
199-
#[no_sanitize(cfi)]
200197
pub fn set_name(name: &CStr) {
201198
weak!(
202199
fn pthread_setname_np(

Diff for: std/src/sys/pal/unix/time.rs

-11
Original file line numberDiff line numberDiff line change
@@ -96,17 +96,6 @@ impl Timespec {
9696
}
9797
}
9898

99-
// FIXME(#115199): Rust currently omits weak function definitions
100-
// and its metadata from LLVM IR.
101-
#[cfg_attr(
102-
all(
103-
target_os = "linux",
104-
target_env = "gnu",
105-
target_pointer_width = "32",
106-
not(target_arch = "riscv32")
107-
),
108-
no_sanitize(cfi)
109-
)]
11099
pub fn now(clock: libc::clockid_t) -> Timespec {
111100
use crate::mem::MaybeUninit;
112101
use crate::sys::cvt;

Diff for: std/src/sys/pal/unix/weak.rs

-3
Original file line numberDiff line numberDiff line change
@@ -155,9 +155,6 @@ unsafe fn fetch(name: &str) -> *mut libc::c_void {
155155
#[cfg(not(any(target_os = "linux", target_os = "android")))]
156156
pub(crate) macro syscall {
157157
(fn $name:ident($($param:ident : $t:ty),* $(,)?) -> $ret:ty;) => (
158-
// FIXME(#115199): Rust currently omits weak function definitions
159-
// and its metadata from LLVM IR.
160-
#[no_sanitize(cfi)]
161158
unsafe fn $name($($param: $t),*) -> $ret {
162159
weak!(fn $name($($param: $t),*) -> $ret;);
163160

Diff for: std/src/sys/process/unix/unix.rs

-3
Original file line numberDiff line numberDiff line change
@@ -434,9 +434,6 @@ impl Command {
434434
target_os = "nto",
435435
target_vendor = "apple",
436436
))]
437-
// FIXME(#115199): Rust currently omits weak function definitions
438-
// and its metadata from LLVM IR.
439-
#[cfg_attr(target_os = "linux", no_sanitize(cfi))]
440437
fn posix_spawn(
441438
&mut self,
442439
stdio: &ChildPipes,

Diff for: std/src/sys/thread_local/destructors/linux_like.rs

-3
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@
1212
1313
use crate::mem::transmute;
1414

15-
// FIXME: The Rust compiler currently omits weakly function definitions (i.e.,
16-
// __cxa_thread_atexit_impl) and its metadata from LLVM IR.
17-
#[no_sanitize(cfi, kcfi)]
1815
pub unsafe fn register(t: *mut u8, dtor: unsafe extern "C" fn(*mut u8)) {
1916
/// This is necessary because the __cxa_thread_atexit_impl implementation
2017
/// std links to by default may be a C or C++ implementation that was not

0 commit comments

Comments
 (0)