You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
link_section attribute misleadingly allowed on modules and impls #65128
The #[link_section] attribute seems to be allowed on modules and impl blocks, but it will not do anything. I would expect either all functions/statics within the module/impl to be placed into the specified link_section, but this does not happen.
I've verified the functions are linked in and not just optimized out etc. As-is the functions will be placed into the default .text section, but if I uncomment the link_section attributes then they are properly placed in the .textaux1 section. No compiler errors or warnings are generated
The same seems to be true for extern functions. I would have expected the following code to link the extern function into .data, but it was linked into .text:
Activity
hannobraun commentedon Nov 27, 2019
The same seems to be true for extern functions. I would have expected the following code to link the extern function into
.data, but it was linked into.text:No warning or error was emitted. The
link_sectionattribute was just ignored, it seems.ehuss commentedon Sep 15, 2020
A warning for this has been added in #73461.
bjorn3 commentedon Jul 29, 2023
There is a future compat lint for this. Should this be closed?
bjorn3 commentedon Aug 28, 2025
I'm going to close this given the future compat lint that warns against this.