<feed xmlns='http://www.w3.org/2005/Atom'>
<title>rust/tests/codegen/sanitizer, branch try</title>
<subtitle>https://github.com/rust-lang/rust
</subtitle>
<id>http://git.dreamy.place/mirrors/rust/atom?h=try</id>
<link rel='self' href='http://git.dreamy.place/mirrors/rust/atom?h=try'/>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/'/>
<updated>2025-07-16T19:38:58+00:00</updated>
<entry>
<title>add `codegen_instance_attrs` query</title>
<updated>2025-07-16T19:38:58+00:00</updated>
<author>
<name>Folkert de Vries</name>
<email>folkert@folkertdev.nl</email>
</author>
<published>2025-07-02T08:46:15+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=ec0ff720d1a89cb51edd90116c6e70051affa95f'/>
<id>urn:sha1:ec0ff720d1a89cb51edd90116c6e70051affa95f</id>
<content type='text'>
and use it for naked functions
</content>
</entry>
<entry>
<title>fix `-Zsanitizer=kcfi` on `#[naked]` functions</title>
<updated>2025-07-16T19:38:48+00:00</updated>
<author>
<name>Folkert de Vries</name>
<email>folkert@folkertdev.nl</email>
</author>
<published>2025-07-01T18:02:31+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=f100767dce1fcc0287047053cc29659ac5321a6b'/>
<id>urn:sha1:f100767dce1fcc0287047053cc29659ac5321a6b</id>
<content type='text'>
And more broadly only codegen `InstanceKind::Item` using the naked
function codegen code. Other instance kinds should follow the normal
path.
</content>
</entry>
<entry>
<title>Fix tests to drop now-skipped codegen</title>
<updated>2025-06-22T16:03:42+00:00</updated>
<author>
<name>Mark Rousskov</name>
<email>mark.simulacrum@gmail.com</email>
</author>
<published>2025-06-14T14:36:53+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=b4568d9135e55cfc8739b465970aa636a0d45c1b'/>
<id>urn:sha1:b4568d9135e55cfc8739b465970aa636a0d45c1b</id>
<content type='text'>
</content>
</entry>
<entry>
<title>KCFI: Add KCFI arity indicator support</title>
<updated>2025-04-05T04:05:04+00:00</updated>
<author>
<name>Ramon de C Valle</name>
<email>rcvalle@users.noreply.github.com</email>
</author>
<published>2025-03-11T19:04:35+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=a98546b961a7fc707155aecbde094fbcecce81fd'/>
<id>urn:sha1:a98546b961a7fc707155aecbde094fbcecce81fd</id>
<content type='text'>
Adds KCFI arity indicator support to the Rust compiler (see rust-lang/rust#138311,
https://github.com/llvm/llvm-project/pull/121070, and
https://lore.kernel.org/lkml/CANiq72=3ghFxy8E=AU9p+0imFxKr5iU3sd0hVUXed5BA+KjdNQ@mail.gmail.com/).
</content>
</entry>
<entry>
<title>Rollup merge of #138349 - 1c3t3a:external-weak-cfi, r=rcvalle</title>
<updated>2025-03-17T15:34:50+00:00</updated>
<author>
<name>Matthias Krüger</name>
<email>476013+matthiaskrgr@users.noreply.github.com</email>
</author>
<published>2025-03-17T15:34:50+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=8f5c09b37cd42bbad105bc6f81eaa681bc157259'/>
<id>urn:sha1:8f5c09b37cd42bbad105bc6f81eaa681bc157259</id>
<content type='text'>
Emit function declarations for functions with `#[linkage="extern_weak"]`

Currently, when declaring an extern weak function in Rust, we use the following syntax:
```rust
unsafe extern "C" {
   #[linkage = "extern_weak"]
   static FOO: Option&lt;unsafe extern "C" fn() -&gt; ()&gt;;
}
```
This allows runtime-checking the extern weak symbol through the Option.

When emitting LLVM-IR, the Rust compiler currently emits this static as an i8, and a pointer that is initialized with the value of the global i8 and represents the nullabilty e.g.
```
`@FOO` = extern_weak global i8
`@_rust_extern_with_linkage_FOO` = internal global ptr `@FOO`
```

This approach does not work well with CFI, where we need to attach CFI metadata to a concrete function declaration, which was pointed out in https://github.com/rust-lang/rust/issues/115199.

This change switches to emitting a proper function declaration instead of a global i8. This allows CFI to work for extern_weak functions. Example:
```
`@_rust_extern_with_linkage_FOO` = internal global ptr `@FOO`
...
declare !type !61 !type !62 !type !63 !type !64 extern_weak void `@FOO(double)` unnamed_addr #6
```

We keep initializing the Rust internal symbol with the function declaration, which preserves the correct behavior for runtime checking the Option.

r? `@rcvalle`

cc `@jakos-sec`

try-job: test-various
</content>
</entry>
<entry>
<title>Emit function declarations for functions with #[linkage="extern_weak"]</title>
<updated>2025-03-17T08:27:53+00:00</updated>
<author>
<name>Bastian Kersting</name>
<email>bkersting@google.com</email>
</author>
<published>2025-03-11T11:00:42+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=b30cf11b9672cf9d938654a75aded1a2084b9980'/>
<id>urn:sha1:b30cf11b9672cf9d938654a75aded1a2084b9980</id>
<content type='text'>
Currently, when declaring an extern weak function in Rust, we use the
following syntax:
```rust
unsafe extern "C" {
   #[linkage = "extern_weak"]
   static FOO: Option&lt;unsafe extern "C" fn() -&gt; ()&gt;;
}
```
This allows runtime-checking the extern weak symbol through the Option.

When emitting LLVM-IR, the Rust compiler currently emits this static
as an i8, and a pointer that is initialized with the value of the global
i8 and represents the nullabilty e.g.
```
@FOO = extern_weak global i8
@_rust_extern_with_linkage_FOO = internal global ptr @FOO
```

This approach does not work well with CFI, where we need to attach CFI
metadata to a concrete function declaration, which was pointed out in
https://github.com/rust-lang/rust/issues/115199.

This change switches to emitting a proper function declaration instead
of a global i8. This allows CFI to work for extern_weak functions.

We keep initializing the Rust internal symbol with the function
declaration, which preserves the correct behavior for runtime checking
the Option.

Co-authored-by: Jakob Koschel &lt;jakobkoschel@google.com&gt;
</content>
</entry>
<entry>
<title>Implement `#[define_opaque]` attribute for functions.</title>
<updated>2025-03-11T12:05:02+00:00</updated>
<author>
<name>Oli Scherer</name>
<email>git-spam-no-reply9815368754983@oli-obk.de</email>
</author>
<published>2024-07-26T10:04:02+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=cb4751d4b87e1c8ebdeb381abe3785486a59968e'/>
<id>urn:sha1:cb4751d4b87e1c8ebdeb381abe3785486a59968e</id>
<content type='text'>
</content>
</entry>
<entry>
<title>tests: use minicore more</title>
<updated>2025-02-24T09:26:54+00:00</updated>
<author>
<name>David Wood</name>
<email>david.wood2@arm.com</email>
</author>
<published>2025-02-24T09:26:54+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=92eb4450fa1ae37a948178c9d14bfb145a69562d'/>
<id>urn:sha1:92eb4450fa1ae37a948178c9d14bfb145a69562d</id>
<content type='text'>
minicore makes it much easier to add new language items to all of the
existing `no_core` tests.
</content>
</entry>
<entry>
<title>Rollup merge of #127483 - BertalanD:no_sanitize-global-var, r=rcvalle</title>
<updated>2024-11-23T12:19:51+00:00</updated>
<author>
<name>许杰友 Jieyou Xu (Joe)</name>
<email>39484203+jieyouxu@users.noreply.github.com</email>
</author>
<published>2024-11-23T12:19:51+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=c6d36256a6e6b7263eef2fa3f5aafef07768ac99'/>
<id>urn:sha1:c6d36256a6e6b7263eef2fa3f5aafef07768ac99</id>
<content type='text'>
Allow disabling ASan instrumentation for globals

AddressSanitizer adds instrumentation to global variables unless the [`no_sanitize_address`](https://llvm.org/docs/LangRef.html#global-attributes) attribute is set on them.

This commit extends the existing `#[no_sanitize(address)]` attribute to set this; previously it only had the desired effect on functions.

(cc https://github.com/rust-lang/rust/issues/39699)
</content>
</entry>
<entry>
<title>CFI: Append debug location to CFI blocks</title>
<updated>2024-11-11T09:17:43+00:00</updated>
<author>
<name>Bastian Kersting</name>
<email>bkersting@google.com</email>
</author>
<published>2024-11-08T08:51:19+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=c2102259a04dd9ede1e7faf01daa0dfcb948c214'/>
<id>urn:sha1:c2102259a04dd9ede1e7faf01daa0dfcb948c214</id>
<content type='text'>
</content>
</entry>
</feed>
