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 }}
This repository has been archived by the owner on Jan 24, 2022. It is now read-only.
In some not-yet-open-sourced code, we have used #[link_section] to place 2 functions, one of which is an #[exception] handler, in the same section so they're closer together, in order to link correctly (one of them calls the other using inline assembly with limited jump range).
With #205, this code broke because #[link_section] does not get applied to the trampoline, and the compiler decides to inline the function with the #[link_section] attribute into the trampoline. Whether this inlining decision makes sense is another question, but this still broke code that one should reasonably expect to work.
There's a few ways to fix this or work around the issue:
Put #[inline(never)] on the user code (this is what I've done for now, and it fixes linkage, but wastes code space because this really should be inlined)
Declare the inlining as a rustc bug, report it, and forget about it.
Have the #[exception] macro (and the others) duplicate some attributes and apply them to both function in the output.
The last solution would be ideal, since it fixes the user-visible regression in behavior without preventing the inlining, and makes attributes on #[exception] functions behave more similarly to how they behave on regular, single functions. I don't know which other linkage-related attributes need to be duplicated though.
The text was updated successfully, but these errors were encountered:
In some not-yet-open-sourced code, we have used
#[link_section]
to place 2 functions, one of which is an#[exception]
handler, in the same section so they're closer together, in order to link correctly (one of them calls the other using inline assembly with limited jump range).With #205, this code broke because
#[link_section]
does not get applied to the trampoline, and the compiler decides to inline the function with the#[link_section]
attribute into the trampoline. Whether this inlining decision makes sense is another question, but this still broke code that one should reasonably expect to work.There's a few ways to fix this or work around the issue:
#[inline(never)]
on the user code (this is what I've done for now, and it fixes linkage, but wastes code space because this really should be inlined)#[exception]
macro (and the others) duplicate some attributes and apply them to both function in the output.The last solution would be ideal, since it fixes the user-visible regression in behavior without preventing the inlining, and makes attributes on
#[exception]
functions behave more similarly to how they behave on regular, single functions. I don't know which other linkage-related attributes need to be duplicated though.The text was updated successfully, but these errors were encountered: