There's a comment in drti.c that indicates that ld(1) needs to be able to parse SUNW_dof in order to do probe address relocations. As far as I can determine, this isn't the case: our ld(1) handles relocations in .SUNW_dof just fine. Indeed, if we add a .rela.SUNW_dof section containing relocations for each probe, everything just works (modulo some bug fixes/tweaks). Any relocations that can't be done at link time are handled by rtld.
At the moment, we use drti.o to do these relocations at runtime. There are many problems with this:
- it has a performance impact,
- it doesn't work with stripped executables (since it relies on symtab lookups), and to some extent with stripped shared libraries,
- it doesn't work with probes associated with local symbols (dtrace emits mangled global symbols to handle this, but the drti code doesn't know about them)
- other problems that I ran into but never figured out.
This change removes the relocation code from drti.o and fixes a number of bugs. With this change, I'm able to instrument the tcl DTrace probes without running into the "WARNING: number of probes fixed does not match the number of defined probes" message on startup.