Register all hidden local symbols as globals, since they are
still unique in the context of the input binary BOLT is
processing. This is used to fetch a single definition of
_GLOBAL_OFFSET_TABLE_.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
bolt/lib/Rewrite/RewriteInstance.cpp | ||
---|---|---|
769 | Maybe something like isSymbolDSOUnique? The global is a bit frustrating for me, e.g. only means SymbolRef::SF_Global. | |
770 | BTW the WEAK symbols are visible outside the component, shoudn't we add check here too? | |
774 | As I know the global hidden symbols are usually transformed to local default. If they are not transformed we would just return from the if global condition above. If the symbols stays local hidden for some reason (I think it is totally possible and does not contradicts anything, but I'm unable to generate it right now with my compilers and linkers) - is there any guaranties that the symbol was not generated by compiler like local (e.g. static symbol) and hidden due to fvisibility=hidden flag for example? I mean if the symbol is marked local I don't think we have guarantees that it is unique in DSO, are we? |
Thanks for the review!
bolt/lib/Rewrite/RewriteInstance.cpp | ||
---|---|---|
774 | That's fair. Another option is to hardcode and promote only _GLOBAL_OFFSET_TABLE_ if it is local hidden, and leave other symbols alone. |
bolt/lib/Rewrite/RewriteInstance.cpp | ||
---|---|---|
774 | IMO It is better solution :) Please also consider to stay with this lambda and checking for WEAK symbols as I mentioned before, I think their handling might be missed before :) |
bolt/lib/Rewrite/RewriteInstance.cpp | ||
---|---|---|
774 | If the change is just for the lookup of _GLOBAL_OFFSET_TABLE_, then it's better to encapsulate the lookup and maybe check for the global version first and then the local, or fix the naming just for that symbol as yota9 suggests. Changing the internal naming may have an unintended consequence of missing/mismatching hidden functions in existing profiles. |
Maybe something like isSymbolDSOUnique? The global is a bit frustrating for me, e.g. only means SymbolRef::SF_Global.