Lower #[no_mangle] to #[symbol_name]/#[link_name] - #159374
Conversation
|
cc @rust-lang/miri |
|
r? @jackh726 rustbot has assigned @jackh726. Use Why was this reviewer chosen?The reviewer was selected based on:
|
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
| } else if codegen_fn_attrs.symbol_name.is_some() { | ||
| // * This can be overridden with the `#[link_name]` attribute | ||
| } else if codegen_fn_attrs.link_ordinal.is_some() { | ||
| // * `#[link_ordinal]` and `#[link_name]` are incompatible with each other |
There was a problem hiding this comment.
This is a behavior change. We no longer keep the symbol that Rust code refers to unmangled when #[link_ordinal] is used. This matches the behavior on wasm for #[wasm_import_section], but prevents overriding the symbol using a definition with an #[export_name] matching the name we have imported it as in the raw-dylib block. And it is inconsistent with non-ordinal imports through raw-dylib where we could also have used mangled names on our side.
This comment has been minimized.
This comment has been minimized.
85e13aa to
d86eb41
Compare
This reduces the amount of special casing #[no_mangle] needs in the rest of the compiler.
#[link_ordinal] is not compatible with #[link_name] and items in extern blocks now have an implicit #[link_name] with the item name. Alternatively it would be possible to suppress the error message for this implicit #[link_name].
d86eb41 to
22ac858
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
|
@rustbot reroll |
This reduces the amount of special casing #[no_mangle] needs in the rest of the compiler.