Navigation Menu

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

backend: handle no_mangle attribute #1149

Merged
merged 2 commits into from Apr 25, 2022
Merged

Conversation

liushuyu
Copy link
Contributor

  • handle the no_mangle attribute

@CohenArthur CohenArthur added this to In progress in Imports and Visbility via automation Apr 22, 2022
@CohenArthur CohenArthur added this to the Imports and visibility milestone Apr 22, 2022
@philberty philberty moved this from In progress to Review in progress in Imports and Visbility Apr 22, 2022
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.

You already spotted the mangle code piece so lets fix that as part of this PR. Otherwise great job again.

gcc/rust/backend/rust-compile-base.cc Outdated Show resolved Hide resolved

namespace Rust {
namespace Compile {

bool inline should_mangle_item (const tree fndecl)
{
return lookup_attribute ("no_mangle", DECL_ATTRIBUTES (fndecl)) == NULL_TREE;
Copy link
Member

Choose a reason for hiding this comment

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

I really like how you did this to split up the logic.

I guess the GCC idiom would be that this should be a macro called SHOULD_MANGLE_ITEM_P and put it over in rust-tree.h not sure what design I want in the code-generation part at the moment so lets stick with this for now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I really like how you did this to split up the logic.

I guess the GCC idiom would be that this should be a macro called SHOULD_MANGLE_ITEM_P and put it over in rust-tree.h not sure what design I want in the code-generation part at the moment so lets stick with this for now.

Noted. I will keep this in mind in the near future.

Imports and Visbility automation moved this from Review in progress to Reviewer approved Apr 22, 2022
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
Copy link
Member

bors r+

@bors
Copy link
Contributor

bors bot commented Apr 25, 2022

Build succeeded:

@bors bors bot merged commit f562d73 into Rust-GCC:master Apr 25, 2022
Imports and Visbility automation moved this from Reviewer approved to Done Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

3 participants