Re: [PATCH] dl-runtime: reloc_{offset,index} now functions arch overide'able

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 5/29/20 5:58 AM, Adhemerval Zanella via Libc-alpha wrote:
> 
> 
> On 28/05/2020 16:43, Vineet Gupta wrote:
>> The existing macros are fragile and expect local variables with a
>> certain name. Fix this by defining them as functions with defaul
>> timplementation in a new header dl-runtime.h which arches can overrid
>> eif need be.
>>
>> This came up during ARC port review.
>>
>> This patch potentially only affects hppa/x86 ports,
>> build tested for both those configs and a few more.
>>
>> Suggested-by: Adhemerval Zanella <adhemerval.zanella@xxxxxxxxxx>
> 
> LGTM, thanks.
> 
> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@xxxxxxxxxx>

Sorry I didn't think through this before, but ARC port needs pltgot arg (runtime
address of plt0) in reloc_index not reloc_offset. I'll swap them and repost.

>>  /* This function is called through a special trampoline from the PLT the
>>     first time each PLT entry is called.  We must perform the relocation
>>     specified in the PLT of the given shared object, and return the resolved
>> @@ -68,8 +62,11 @@ _dl_fixup (
>>      = (const void *) D_PTR (l, l_info[DT_SYMTAB]);
>>    const char *strtab = (const void *) D_PTR (l, l_info[DT_STRTAB]);
>>  
>> +  const uintptr_t pltgot = (uintptr_t) D_PTR (l, l_info[DT_PLTGOT]);
>> +
>>    const PLTREL *const reloc
>> -    = (const void *) (D_PTR (l, l_info[DT_JMPREL]) + reloc_offset);
>> +    = (const void *) (D_PTR (l, l_info[DT_JMPREL])
>> +		      + reloc_offset (pltgot, reloc_arg));
>>    const ElfW(Sym) *sym = &symtab[ELFW(R_SYM) (reloc->r_info)];
>>    const ElfW(Sym) *refsym = sym;
>>    void *const rel_addr = (void *)(l->l_addr + reloc->r_offset);
> 
> Ok (it should be dead code eliminated by compiler if reloc_offset does not
> use the pltgot field, as for default implementation).

Yep.

> 
>> diff --git a/elf/dl-runtime.h b/elf/dl-runtime.h
>> new file mode 100644
>> index 000000000000..ed5db3ba51b7
>> --- /dev/null
>> +++ b/elf/dl-runtime.h
>> @@ -0,0 +1,30 @@
>> +/* Helpers for On-demand PLT fixup for shared objects, Generic version.
> 
> Maybe period here?

OK


>> diff --git a/sysdeps/hppa/dl-runtime.h b/sysdeps/hppa/dl-runtime.h
>> new file mode 100644
>> index 000000000000..cfde0ec991e3
>> --- /dev/null
>> +++ b/sysdeps/hppa/dl-runtime.h
>> @@ -0,0 +1,31 @@
>> +/* Helpers for On-demand PLT fixup for shared objects, HPAA version.
> 
> Maybe period instead of comma here?

OK.
_______________________________________________
linux-snps-arc mailing list
linux-snps-arc@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/linux-snps-arc



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux