In ELF, symbols of type STT_GNU_IFUNC need to be resolved by calling the
function at the symbol's address. This is implemented by adding special
stubs for all symbols of that type.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Unit Tests
Event Timeline
This is really cool.
Does the Indirect flag really need to go onto JITSymbolFlags? My mental model of ifuncs (very limited -- I haven't used them myself) is "self-updating PLT" -- its ifunc-ness is opaque to callers right?
Yes, you are right, ifuncs are completely opaque to callers, so we probably shouldn't add that flag. I will change that.
Fixed a failing test: In ELFObjectFile I added a case to set the symbol type to
ST_Function also for ifunc symbols. As far as I know, ifunc symbols can only be
functions, but even objdump from binutils doesn't print those symbols with the
function type. I removed that case again, ifunc symbols now have type ST_Other.
Fixed an unchecked Expected<T> which lead to several test failures. All tests should run now, hopefully.
The only failing "test" is clang-format. Should I reformat the complete files? Because my additions are formatted correctly, but the rest of the file is not.
LGTM, and sorry for the very delayed review!
What are your blockers to moving over to ORC/JITLink these days? This is excellent work -- if there's something that I can do to unblock you so that you can work on the new JIT linker I'd be keen to know. ;)
The only failing "test" is clang-format. Should I reformat the complete files? Because my additions are formatted correctly, but the rest of the file is not.
Only your additions should be reformatted. Reformatting the rest of the files will obscure the commit history. It's better to let them be updated to the correct format over time as patches come in. (Though my hope is that we can kill RuntimeDyld in the not too distant future and just move everyone over to JITLink)