Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gccrs: Fix legacy mangling to use Unicode escape #2547

Merged
merged 1 commit into from
Aug 12, 2023

Conversation

tamaroning
Copy link
Contributor

@tamaroning tamaroning commented Aug 12, 2023

Fix #2545

Changlog

gccrs: Fix legacy mangling to use Unicode escape
gcc/rust/ChangeLog:

	* backend/rust-mangle.cc (legacy_mangle_name): Use Unicode escape

Result of mangling:

input:

pub fn () {}
mod Module {
    pub fn function_日本語_русский() {}
}
fn main() {
    ();
    Module::function_日本語_русский();
}

output:

...
_ZN1a7$u3042$17hae3ccdfa81d818e4E:
	.cfi_startproc
...
_ZN1a6Module79function_$u65e5$$u672c$$u8a9e$_$u440$$u443$$u441$$u441$$u43a$$u438$$u438$$u439$17hae3ccdfa81d818e4E:
	.cfi_startproc
...
main:
.LFB2:
	.cfi_startproc
...

Demangle result:

_ZN1a6Module79function_$u65e5$$u672c$$u8a9e$_$u440$$u443$$u441$$u441$$u43a$$u438$$u438$$u439$17hae3ccdfa81d818e4E
=> a::Module::function_日本語_русскиий::hae3ccdfa81d818e4
_ZN1a7$u3042$17hae3ccdfa81d818e4E:
=> a::あ::hae3ccdfa81d818e4

Checked with https://online-demangler-iv5u2bxxb-tamaroning.vercel.app/

gcc/rust/ChangeLog:

	* backend/rust-mangle.cc (legacy_mangle_name): Use Unicode escape

Signed-off-by: Raiki Tamura <[email protected]>
Copy link
Member

@philberty philberty left a comment

Choose a reason for hiding this comment

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

LGTM

@philberty philberty added this pull request to the merge queue Aug 12, 2023
Merged via the queue into Rust-GCC:master with commit 5668095 Aug 12, 2023
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.

Legacy name mangling does not encode unicode characters
2 participants