-
Notifications
You must be signed in to change notification settings - Fork 159
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
Symbol Mangling #305
Comments
The hash that is part of the symbol name includes both the crate name and value passed in using |
Thanks for the heads up I didn't realise about -Cmetadata which is a really neat idea. |
Rust has 2 forms of symbol mangling:
I think we will need to support both at some point for now lets implement legacy in the short term. Down the line when rust-lang/rust#60705 is stableized we can implement that which would be ideal. |
This is putting the cart way way way before the horse, but FYI: The Rust-for-Linux project uses the unstable v0 (though I have no recollection of why :-)). We're very interested in the progress of gccrs, for hopefully obvious reasons, so I figured I'd let you know. |
Thanks for the heads up @alex |
For the generics milestone right now I will be implementing basic legacy with a dummy hash for now. |
Rust supports two different symbol mangling methods legacy and V0. V0 is the goal but its not yet stable. This implements the legacy method but with a dummy hash value since it requires a sip128 implementation to generate the apropriate hash which can be done in a sperate change. This change allows us to actually assemble generic functions and avoid bad symbol duplications. Addresses #305
This PR implements the first part for legacy symbol mangling #425 |
Moving this ticket out of the generics milestone, since we have a basic implementation of the legacy form will be enough for that milestone to be completed for now. |
425: Basic implementation of legacy symbol mangling r=philberty a=philberty Implement basic rustc legacy symbol mangling Rust supports two different symbol mangling methods legacy and V0. V0 is the goal but its not yet stable. This implements the legacy method but with a dummy hash value since it requires a sip128 implementation to generate the apropriate hash which can be done in a sperate change. This change allows us to actually assemble generic functions and avoid bad symbol duplications. Addresses #305 Co-authored-by: Philip Herron <[email protected]>
The reason is that the "legacy" mangling scheme uses invalid characters for C identifiers (like |
Rustc uses a SIP128 hash for the legacy symbol mangling but an FNV hash is simpler to implement this is a port of the implementation from golang stdlib hash package. The fingerprint for the hash is simple the function signiture for now. Rustc takes into account options such as -Cmetadata to generate uniqueness. We still need to implement an SIP128 and the V0 symbol mangling but this will do in the interim. Addresses: #305 Fixes: #428
430: Add FNV-128 hash for legacy symbol mangling r=philberty a=philberty Rustc uses a SIP128 hash for the legacy symbol mangling but an FNV hash is simpler to implement. This is a port of the implementation from golang stdlib hash package. The fingerprint for the hash is simply the function signature for now. Rustc takes into account options such as -Cmetadata to generate uniqueness. We still need to implement a SIP128 hasher and the V0 symbol mangling but this will do in the interim. Addresses: #305 Fixes: #428 Co-authored-by: Philip Herron <[email protected]>
Compiling Generics requires us to use symbol mangling to avoid the duplicate symbol error in linking.
This could also be part of a cleanup effort for the backend's handling for mangling in general.
The text was updated successfully, but these errors were encountered: