Closed kkysen closed 1 month ago
Do we actually need fvisibility on the address taken functions? I think it's only the wrappers that need it.
Oh it's needed for non-static address taken functions. It might be better to define the call gates in the same .c like we do for static functions that way we don't have to prepend attributes to function definitions.
I'm guessing the issues you're running into probably stem from expansion/spelling loc differences. Doing these kinds of rewrites gets trickier when functions are defined in headers/expanded from macros so I'd like to avoid them if possible.
It might be better to define the call gates in the same .c like we do for static functions
I just realized that these may be referenced from multiple .c files so we need to either:
The first option is kinda ugly but I'm leaning towards that for expediency. @rinon thoughts?
For context I mostly want to avoid prepending attributes to functions with the rewriter to avoid cases like #414 where a function's definition has static
or some attribute expanded from a macro and we can't reliably tell if the macro expansion includes anything else.
Superseded by #451.
I tried copying the similar approach used to insert the
__attribute__((used))
s, and while its finding the right functions to add the__attribute__((visibility("default")))
s to, the replacements are going in totally wrong places places, and I'm not sure what I'm doing wrong or quite how the replacements API is supposed to work. @ayrtonm or anyone else, do you have any suggestions?