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
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 On Aug 5, 2010, at 4:31 PM, Rui Paulo wrote:> 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 > dtrace-discuss at opensolaris.org-- Adam Leventhal, Fishworks http://blogs.sun.com/ahl
On 6 Aug 2010, at 16:46, Adam Leventhal wrote:> 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 binaryYes, 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
> 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
On 6 Aug 2010, at 17:39, Adam Leventhal wrote:>> 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).> 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