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)


> > > 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.

> > > +                   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.

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,
Roland


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