-
Notifications
You must be signed in to change notification settings - Fork 185
Handle link_name
attribute
#4031
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
base: master
Are you sure you want to change the base?
Conversation
This also makes some tweaks to how we handle the no_mangle attribute. gcc/rust/ChangeLog: * backend/rust-compile-base.cc: Include "rust-gcc.h". (should_mangle_item): Remove function. (get_unmangled_item): Add function. (HIRCompileBase::setup_fndecl): Remove handling of no_mangle. (HIRCompileBase::handle_no_mangle_attribute_on_fndecl): Remove function definition. (HIRCompileBase::compile_function): Use get_unmangled_name instead of should_mangle_name. * backend/rust-compile-base.h (HIRCompileBase::handle_no_mangle_attribute_on_fndecl): Remove function declaration. * util/rust-attribute-values.h (Attributes::LINK_NAME): New constexpr member variable. * util/rust-attributes.cc (__definitions): Add LINK_NAME. Signed-off-by: Owen Avery <[email protected]>
Fixes #3867 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is partly there but there is special handling for the function declarations in: ust-compile-extern.h: void visit (HIR::ExternalFunctionItem &function) override
Also you should put the Fixes into the commit message too since this is almost it finished |
|
||
if (input->get_attr_input_type () | ||
!= AST::AttrInput::AttrInputType::LITERAL) | ||
goto err_link_name; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a fan of this goto. You could have split the code in multiple functions and I don't want newcomers to grep the codebase, find this goto and sprinkle some everywhere nor be confused about it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch yeah avoid goto's please
Now depends on #4044 |
Unless I'm mistaken, we don't need to put
no_mangle
inDECL_ATTRIBUTES (fndecl)
, right? Since we do all of the mangling, and gcc doesn't seem to have ano_mangle
attribute?