-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Open
Labels
A-attributesArea: Attributes (`#[…]`, `#![…]`)Area: Attributes (`#[…]`, `#![…]`)A-linkageArea: linking into static, shared libraries and binariesArea: linking into static, shared libraries and binariesC-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
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.
Code used:
#[link_section = ".textaux1"]
mod foo{
//#[link_section = ".textaux1"]
pub fn testing() -> u32{
20
}
}
mod foo2{
pub struct Whatever{}
#[link_section = ".textaux1"]
impl Whatever{
//#[link_section = ".textaux1"]
pub fn watt(&self) -> u32{
50
}
}
}
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
rustc version:
rustc 1.40.0-nightly (2daa404 2019-10-02)
binary: rustc
commit-hash: 2daa404
commit-date: 2019-10-02
host: x86_64-apple-darwin
release: 1.40.0-nightly
LLVM version: 9.0
boozookboozook
Metadata
Metadata
Assignees
Labels
A-attributesArea: Attributes (`#[…]`, `#![…]`)Area: Attributes (`#[…]`, `#![…]`)A-linkageArea: linking into static, shared libraries and binariesArea: linking into static, shared libraries and binariesC-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.