Discussion:
DOF sections
Rui Paulo
2010-08-05 22:31:44 UTC
Permalink
Hi,
I'm wondering how Open Solaris creates the DOF section. I've search everywhere.. I know that dtrace creates a data file with the contents of the DOF section, but how does ld insert this section inside the ELF file?

Thanks,
--
Rui Paulo
Adam Leventhal
2010-08-06 15:46:40 UTC
Permalink
Take a look at these:

http://blogs.sun.com/ahl/entry/user_land_tracing_gets_better
http://blogs.sun.com/ahl/entry/pid_provider_exposed

In short, 'dtrace -G' processes a provider description (.d file) and the compiled object files to generate a new object file (ELF) that contains a DOF section. When the program is linked, the DOF gets stuck into the final binary.

Adam
Post by Rui Paulo
Hi,
I'm wondering how Open Solaris creates the DOF section. I've search everywhere.. I know that dtrace creates a data file with the contents of the DOF section, but how does ld insert this section inside the ELF file?
Thanks,
--
Rui Paulo
_______________________________________________
dtrace-discuss mailing list
--
Adam Leventhal, Fishworks http://blogs.sun.com/ahl
Rui Paulo
2010-08-06 15:57:33 UTC
Permalink
Post by Adam Leventhal
http://blogs.sun.com/ahl/entry/user_land_tracing_gets_better
http://blogs.sun.com/ahl/entry/pid_provider_exposed
In short, 'dtrace -G' processes a provider description (.d file) and the compiled object files to generate a new object file (ELF) that contains a DOF section. When the program is linked, the DOF gets stuck into the final binary
Yes, exactly, but our ld (GNU) seems to remove the .SUWN_dof section.. I'm writing code to add the section using libelf. Also, our ld ignores SUNW_dof section types, so I'm using SHT_PROGBITS as an interim solution (drti.c needs changes for this to work).

Regards,
--
Rui Paulo
Adam Leventhal
2010-08-06 16:39:34 UTC
Permalink
Post by Rui Paulo
Yes, exactly, but our ld (GNU) seems to remove the .SUWN_dof section.. I'm writing code to add the section using libelf. Also, our ld ignores SUNW_dof section types, so I'm using SHT_PROGBITS as an interim solution (drti.c needs changes for this to work).
We've modified our linker to understand the new section. Would it be reasonable to do the same for GNU ld? Do you have a suggestion for how we might have designed the interaction between DTrace and the linker differently?

Adam

--
Adam Leventhal, Fishworks http://blogs.sun.com/ahl
Rui Paulo
2010-08-06 19:18:18 UTC
Permalink
Post by Adam Leventhal
Post by Rui Paulo
Yes, exactly, but our ld (GNU) seems to remove the .SUWN_dof section.. I'm writing code to add the section using libelf. Also, our ld ignores SUNW_dof section types, so I'm using SHT_PROGBITS as an interim solution (drti.c needs changes for this to work).
We've modified our linker to understand the new section. Would it be reasonable to do the same for GNU ld?
Maybe, but I don't know if I'll do that now. Touching vendor sources in FreeBSD is not the best idea. This is also ld's fault as it should not be removing OS specific sections from the object files (initially I used ld + objcopy).
Post by Adam Leventhal
Do you have a suggestion for how we might have designed the interaction between DTrace and the linker differently?
I would have expected the SUNW_dof section to be just like a SUNW_ctf section. I.e., a PROGBITS section with a special name (SUNW_dof). I don't know the history of the SUNW_dof section so I can't comment on how easy / feasible this would be.

Regards,
--
Rui Paulo

Loading...