[PATCH 4/5 v1] LoongArch: Move ifunc info to rela.dyn from rela.plt.

Xi Ruoyao xry111@xry111.site
Mon Jul 18 11:45:17 GMT 2022


On Mon, 2022-07-18 at 16:43 +0800, liuzhensong wrote:
>   Delete R_LARCH_IRELATIVE from dynamic loader (glibc ld.so) when
>   loading lazy function (rela.plt section).
> 
>   In dynamic programes, move ifunc dynamic relocate info to section
>   srelgot from srelplt.
> 
>   bfd/
>     elfnn-loongarch.c
> ---
>  bfd/elfnn-loongarch.c | 322 ++++++++++++++++++++++++++++++++++++++++--
>  1 file changed, 310 insertions(+), 12 deletions(-)
> 
> diff --git a/bfd/elfnn-loongarch.c b/bfd/elfnn-loongarch.c
> index 4eeaeb44eff..5bb7596e5d0 100644
> --- a/bfd/elfnn-loongarch.c
> +++ b/bfd/elfnn-loongarch.c
> @@ -1207,6 +1207,259 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
>    return true;
>  }
>  
> +/* Based function _bfd_elf_allocate_ifunc_dyn_relocs.

"A modified version of _bfd_elf_allocate_ifunc_dyn_relocs."

> +   For local def and ref ifunc,
> +   dynamic relocations are stored in
> +   1.  rel[a].irelifunc section in PIC object.
> +   2.  rel[a].srelgot section in dynamic executable.
> +   3.  rel[a].irelplt section in static executable.

For entire patch, I think it's better to remove those "[]" around "a":
for LoongArch we always use .rela.*, not .rel.* .

> +   Change ifunc dynamic info from srelplt to srelgot.
> +   In loader, remove R_LARCH_IRELACTIVE from rela lazy in ld.so.  */

"Unlike _bfd_elf_allocate_ifunc_dyn_relocs, .rela.srelgot is used
instead of .rela.srelplt.  Glibc ELF loader will not support
R_LARCH_IRELATIVE relocation in .rela.plt."

My English is not good either, but the origin comment is obviously some
Chinglish.  Xuerui: can you help to reword the comments in this series?

-- 
Xi Ruoyao <xry111@xry111.site>
School of Aerospace Science and Technology, Xidian University


More information about the Binutils mailing list