Multiple #[link_section ...]; defined behavior?

#[link_section = ".foo"]
#[link_section = ".bar"]
pub static FOO: u32 = 7;

This appears to put FOO into only the .bar section. This is what I expected. My question is whether this is defined or undefined behavior. No compiler warning is emitted.

I would probably say the behaviour is implementation defined here (probably the same as clang).

So it'll be safe to do, but won't necessarily do what you want.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.