Files
rust/tests/ui
Matthias Krüger accf61dd42 Rollup merge of #143293 - folkertdev:naked-function-kcfi, r=compiler-errors
fix `-Zsanitizer=kcfi` on `#[naked]` functions

fixes https://github.com/rust-lang/rust/issues/143266

With `-Zsanitizer=kcfi`, indirect calls happen via generated intermediate shim that forwards the call. The generated shim preserves the attributes of the original, including `#[unsafe(naked)]`. The shim is not a naked function though, and violates its invariants (like having a body that consists of a single `naked_asm!` call).

My fix here is to match on the `InstanceKind`, and only use `codegen_naked_asm` when the instance is not a `ReifyShim`. That does beg the question whether there are other `InstanceKind`s that could come up. As far as I can tell the answer is no: calling via `dyn` seems to work find, and `#[track_caller]` is disallowed in combination with `#[naked]`.

r? codegen
````@rustbot```` label +A-naked
cc ````@maurer```` ````@rcvalle````
2025-07-18 04:27:51 +02:00
..
2025-06-11 15:30:15 +01:00
2025-07-13 13:50:01 +00:00
2025-07-15 09:21:27 +02:00
2025-05-21 07:24:43 +00:00
2025-07-10 18:50:35 +05:00
2025-07-13 00:03:31 +05:00
2025-06-11 17:49:03 +05:00
2025-07-15 09:21:27 +02:00
2025-07-15 23:28:15 +02:00
2025-06-18 10:20:43 +02:00
2025-07-05 00:45:24 +05:00
2025-07-05 01:54:04 +05:00
2025-07-05 01:54:04 +05:00
2025-06-16 07:30:09 -04:00
2025-07-06 09:51:35 +02:00
2025-07-13 13:50:01 +00:00
2025-06-06 20:52:34 +00:00
2025-07-01 23:33:59 +05:00
2025-05-31 19:49:19 +05:00
2025-07-10 18:50:35 +05:00
2025-06-11 20:51:49 +05:00
2025-06-29 15:37:33 +05:00
2025-07-08 15:49:00 +00:00
2025-06-13 01:16:36 +02:00
2025-07-10 18:50:35 +05:00
2025-06-03 11:45:58 +02:00
2025-07-10 18:47:20 +05:00
2025-06-18 10:20:43 +02:00
2025-06-18 10:20:43 +02:00
2025-07-01 14:36:28 +02:00
2025-07-05 00:45:24 +05:00
2025-07-13 00:03:31 +05:00
2025-07-10 18:47:20 +05:00
2025-07-01 15:16:56 +05:00
2025-07-10 18:50:35 +05:00
2025-07-05 00:45:24 +05:00
2025-07-13 00:03:31 +05:00
2025-07-10 18:50:35 +05:00
2025-07-13 00:03:31 +05:00
2025-07-06 09:51:35 +02:00
2025-06-08 11:25:09 +05:00
2025-07-05 01:54:04 +05:00
2025-07-05 01:54:04 +05:00
2025-07-15 09:21:27 +02:00
2025-07-17 18:06:26 +08:00
2025-07-07 08:13:12 +00:00
2025-07-13 13:50:01 +00:00
2025-07-05 00:45:24 +05:00
2025-07-05 01:25:48 +05:00
2025-06-30 11:50:19 +05:00
2025-06-26 18:11:14 +00:00
2025-07-13 13:50:01 +00:00
2025-07-13 00:03:31 +05:00
2025-07-05 01:54:04 +05:00
2025-03-27 14:11:11 +01:00
2025-07-01 15:16:56 +05:00
2025-07-17 18:06:26 +08:00
2025-07-13 00:03:31 +05:00
2025-06-18 10:20:43 +02:00
2025-07-10 18:47:20 +05:00
2025-04-25 20:50:57 +09:00
2025-07-13 00:03:31 +05:00
2025-06-08 03:44:44 +05:00
2025-07-10 18:50:35 +05:00
2025-07-15 13:48:30 +00:00
2025-06-18 10:20:43 +02:00
2025-04-03 21:41:58 +00:00
2025-07-04 23:04:56 +08:00
2025-07-14 12:01:41 +03:00