[PATCH 1/5 v1] LoongArch: bfd: Add new reloc types.
刘振松
liuzhensong@loongson.cn
Tue Jul 19 06:31:23 GMT 2022
> -----原始邮件-----
> 发件人: "Xi Ruoyao" <xry111@xry111.site>
> 发送时间: 2022-07-19 13:40:02 (星期二)
> 收件人: liuzhensong <liuzhensong@loongson.cn>, binutils@sourceware.org
> 抄送: xuchenghua@loongson.cn, mengqinggang@loongson.cn, "WANG Xuerui" <i.swmail@xen0n.name>
> 主题: Re: [PATCH 1/5 v1] LoongArch: bfd: Add new reloc types.
>
> On Tue, 2022-07-19 at 12:29 +0800, Xi Ruoyao via Binutils wrote:
> > On Mon, 2022-07-18 at 16:43 +0800, liuzhensong wrote:
> > > @@ -2427,7 +2453,7 @@ loongarch_elf_relocate_section (bfd
> > > *output_bfd,
> > > struct bfd_link_info *info,
> > >
> > > if (h != NULL)
> > > {
> > > - off = h->got.offset;
> > > + off = h->got.offset & (~1);
> > >
> > > if (off == MINUS_ONE
> > > && h->type != STT_GNU_IFUNC)
> > > @@ -2455,79 +2481,76 @@ loongarch_elf_relocate_section (bfd
> > > *output_bfd, struct bfd_link_info *info,
> >
> > This cannot be correct: after "off = h->got.offset & (~1)", how could
> > "off == MINUS_ONE" be true?
> >
> > Either you calculated "off" wrong, or you should remove the dead code.
>
> I guess you need the following changes. With those changes Glibc ifunc
> tests passed:
>
> diff --git a/bfd/elfnn-loongarch.c b/bfd/elfnn-loongarch.c
> index 44b8d6dca9b..4d22ba037c8 100644
> --- a/bfd/elfnn-loongarch.c
> +++ b/bfd/elfnn-loongarch.c
> @@ -2730,7 +2730,7 @@ loongarch_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
> {
> off = h->got.offset & (~1);
>
> - if (off == MINUS_ONE
> + if (h->got.offset == MINUS_ONE
> && h->type != STT_GNU_IFUNC)
> {
> fatal = (loongarch_reloc_is_fatal
> @@ -2742,7 +2742,7 @@ loongarch_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
>
> /* Hidden symbol not has .got entry, only .got.plt entry
> so gprel is (plt - got). */
> - if (off == MINUS_ONE
> + if (h->got.offset == MINUS_ONE
> && h->type == STT_GNU_IFUNC)
> {
> if (h->plt.offset == (bfd_vma) -1)
>
> --
> Xi Ruoyao <xry111@xry111.site>
> School of Aerospace Science and Technology, Xidian University
Thanks for reviews.
Your modification is correct, this code valid for R_LARCH_SOP_PUSH_GPREL.
I have tested glibc testcases, there is no failed testcase about ifunc, does your environment generate new relocations?
Results of glibc with test args "make check subdirs=elf".
UNSUPPORTED: elf/tst-env-setuid
UNSUPPORTED: elf/tst-env-setuid-tunables
XPASS: elf/tst-protected1a
XPASS: elf/tst-protected1b
UNSUPPORTED: elf/tst-valgrind-smoke
Summary of test results:
312 PASS
3 UNSUPPORTED
2 XPASS</xry111@xry111.site></i.swmail@xen0n.name></liuzhensong@loongson.cn></xry111@xry111.site>
本邮件及其附件含有龙芯中科的商业秘密信息,仅限于发送给上面地址中列出的个人或群组。禁止任何其他人以任何形式使用(包括但不限于全部或部分地泄露、复制或散发)本邮件及其附件中的信息。如果您错收本邮件,请您立即电话或邮件通知发件人并删除本邮件。
This email and its attachments contain confidential information from Loongson Technology , which is intended only for the person or entity whose address is listed above. Any use of the information contained herein in any way (including, but not limited to, total or partial disclosure, reproduction or dissemination) by persons other than the intended recipient(s) is prohibited. If you receive this email in error, please notify the sender by phone or email immediately and delete it.
More information about the Binutils
mailing list