This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Failures with exelib.exp testcase (was Re: minutes 2010-08-19)


On Thu, 2011-02-03 at 10:59 -0800, Roland McGrath wrote:
> > > > So, I see it doesn't even compile. Which must mean the #ifdef
> > > > __powerpc__ is the wrong guard. What should be tested for to see whether
> > > > we are compiling on powerpc?
> 
> That is not the right thing to test anyway.  Firstly, don't assume the
> translator host is the same as the target at all.  We do support cross
> compilation.  Second, even on powerpc, you can't assume that the target is
> always 64-bit.  32-bit powerpc does not need this indirection.  The right
> is a runtime test of the translator's record of what machine this module is
> built for.

I see your point, but do we really need a runtime test? Can't we just
have a check when reading in the elf file symbols, that just looks
whether or not there is an .odp section?

> 
> > > > +                   sym_addr = *((Dwarf_Addr *) sym_addr);
> > 
> > Have to ponder why that is too naive. Anybody with some powerpc elf .odp
> > section knowledge see immediately why?
> 
> There is nothing target-specific about why that's wrong.  It's just generic
> fuzzy thinking, sorry.  This address is in the target module, not in the
> translator's own address space.

o, right. I was treating the address as an address inside the systemtap
memory space, while obviously (in hindsight) it should be done in the
address space libdwfl creates for us.

> What you need to do is:
> 
> 	Elf64_Addr opd_addr;
> 	Dwarf_Addr bias;
> 	Elf_Scn *opd = dwfl_module_address_section (mod, &sym_addr, &bias);
> 	if (opd == NULL) ...;
> 	Elf_Data *data = elf_rawdata (opd, NULL);
> 	if (data == NULL) ...;
> 	Elf_Data in, out;
> 	out.d_buf = &final_addr;
> 	in.d_buf = (char *) data->d_buf + sym_addr;
> 	out.d_size = in.d_size = sizeof (Elf64_Addr);
> 	out.d_type = in.d_type = ELF_T_ADDR;
> 	if (elf64_xlatetom (elf, &out, &in, e_ident[EI_DATA]) == NULL) ...;
> 	sym_addr = opd_addr + bias;

Thanks for the pseudocode example. Prasad, is that enough for you to
take a stab at hacking up a solution for the powerpc symbol lookup
issue?

Cheers,

Mark


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]