Skip to content

Conversation

@bjorn3
Copy link
Member

@bjorn3 bjorn3 commented Mar 20, 2025

\u{1} is an LLVM specific extension which other rustc codegen backends do not support.

Fixes #2935

@bjorn3 bjorn3 changed the title Avoid \u{1} prefix when the user overrode symbol names Avoid \u{1} prefix when the user overrode item names Mar 20, 2025
@bjorn3 bjorn3 force-pushed the better_link_name_handling branch from fc322e0 to 50eb27f Compare March 20, 2025 15:16
@bjorn3
Copy link
Member Author

bjorn3 commented Mar 20, 2025

Why does the Publish on crates.io workflow get invoked even though this PR hasn't been merged? It gives me a failure notification. https://github.com/rust-lang/rust-bindgen/actions/runs/13972867609

@bjorn3
Copy link
Member Author

bjorn3 commented Mar 20, 2025

Right, for Mach-O all symbols get mangled to add an _ prefix. Is there a way in libclang to get the symbol name before the object file format specific mangling but after C++ mangling? (aka the input LLVM expects then not using \u{1})

@emilio
Copy link
Contributor

emilio commented Apr 4, 2025

Why does the Publish on crates.io workflow get invoked even though this PR hasn't been merged? It gives me a failure notification. https://github.com/rust-lang/rust-bindgen/actions/runs/13972867609

cc @pvdrz . My understanding is that it's not supposed to run, but maybe these fields are an or rather than an and:

on:
workflow_run:
workflows:
- Release
types:
- completed

@bjorn3 bjorn3 marked this pull request as draft April 4, 2025 15:04
@frederikhors
Copy link

What is missing from this PR to be accepted?

\u{1} is an LLVM specific extension which other rustc codegen backends
do not support.
@bjorn3 bjorn3 force-pushed the better_link_name_handling branch from 50eb27f to da9e06b Compare January 7, 2026 19:44
][::std::mem::offset_of!(JNINativeInterface_, __hack) - 8usize];
};
unsafe extern "stdcall" {
#[link_name = "\u{1}_bar@0"]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR causes new \u{1} for extern "stdcall".

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This wouldn't break things further for cg_clif. extern "stdcall" already isn't supported anyway due to cg_clif not implementing the symbol mangling for it anyway.

@bjorn3
Copy link
Member Author

bjorn3 commented Jan 7, 2026

I don't think the CI failure is related to this PR. It seems to be a dylib issue with git.

@bjorn3
Copy link
Member Author

bjorn3 commented Jan 7, 2026

This may be enough of a temporary fix for now. Implementing demangling inside rust-bindgen would be a better long term solution, but also more work.

@bjorn3 bjorn3 marked this pull request as ready for review January 7, 2026 20:44
@frederikhors
Copy link

@emilio do you need more to accept and release this PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Avoid using \u{1} prefixes in symbol names where possible

3 participants