[Ltrace-devel] irelative test issue with ppc64

Thierry Fauck ( thierry @ linux.vnet.ibm.com ) thierry at linux.vnet.ibm.com
Tue Mar 18 16:12:35 UTC 2014


On 03/17/14 17:39, Petr Machata wrote:
> "Thierry at vnet" <thierry at linux.vnet.ibm.com> writes:
>
>> Still working on the port, the first test from
>> ltrace.main/trace-irelative.exp fails because the current implementation
>> I have
>> scan for STUB symbols and had them to the plt_stub table.
>> When I populate, I am properly checking over these symbols.
>> The problem is that the plt_relocs vector used to populate plt is not
>> updated (so I don't have any breakpoint to the symbol xyz in that
>> case).  Should I review the complete logic, or at end of 
>> arch_elf_init() should I
>> look for all names in plt_stub area and check if it matches an entry in
>> relocate vector ?
>> Any better idea ?
> plt_relocs is an interface between frontend and backend.  The structure
> is primed from the .rela.plt, but the backend is free to add more.  The
> PPC backend in particular looks into .rela.dyn, and copies any IRELATIVE
> relocations found there to the plt_relocs structure.
>
> Later on, it can tell an irelative relocation by looking at its type,
> and for those, it puts breakpoints to the IFUNC resolver instead to a
> PLT entry (because there is none).
>
> I'm not sure how ELFv2 does things on PPC, but similar approach should
> work there as well.  You can put what you need to plt_relocs, and
> adjust arch_plt_sym_val and arch_elf_add_plt_entry (or possibly other
> backend hooks) to answer what you need them to.
>
> Hope this helps,
> PM
>
Great thanks,
I now understand better the structure ... and found
The code was there, but as the symbol is in .text, the flag for
irelative is like in EM_PPC, it is R_PPC64_IRELATIVE
so I will add the following patch.
Still one hfa bug to follow (when we get more than 13 floating point
entries in structure I need to get the value from the stack
but I still have a bug ;-)
Thanks again
News coming soon.
Thierry

reloc_is_irelative(int machine, GElf_Rela *rela)
{
        bool irelative = false;
        if (machine == EM_PPC64) {
#ifdef __LITTLE_ENDIAN__
#ifdef R_PPC64_IRELATIVE
                irelative = GELF_R_TYPE(rela->r_info) == R_PPC64_IRELATIVE;
#endif
#else
#ifdef R_PPC64_JMP_IREL
                irelative = GELF_R_TYPE(rela->r_info) == R_PPC64_JMP_IREL;
#endif
#endif
 

-- 
Thierry Fauck (thierry at linux.vnet.ibm.com)




More information about the Ltrace-devel mailing list