public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: liuzhensong <liuzhensong@loongson.cn>
To: Xi Ruoyao <xry111@xry111.site>, binutils@sourceware.org
Cc: xuchenghua@loongson.cn, mengqinggang@loongson.cn,
	WANG Xuerui <i.swmail@xen0n.name>
Subject: Re: [PATCH 4/5 v1] LoongArch: Move ifunc info to rela.dyn from rela.plt.
Date: Tue, 19 Jul 2022 15:26:30 +0800	[thread overview]
Message-ID: <cced7764-dc76-6a7e-bde6-44421c7fb240@loongson.cn> (raw)
In-Reply-To: <3e53c1fcc7b4599340f341988e07b86d7a911ab8.camel@xry111.site>


在 2022/7/19 上午12:27, Xi Ruoyao 写道:
> 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.
> The main point of this change is allowing us to enable ifunc support for
> Glibc, right?
>
> But have you tested building Glibc using a ld with this series applied?
> It does not work well for me:
>
> FAIL: elf/ifuncmain1
> FAIL: elf/ifuncmain1pic
> FAIL: elf/ifuncmain1pie
> FAIL: elf/ifuncmain1staticpic
> FAIL: elf/ifuncmain1staticpie
> FAIL: elf/ifuncmain1vis
> FAIL: elf/ifuncmain1vispic
> FAIL: elf/ifuncmain1vispie
> FAIL: elf/ifuncmain3
> FAIL: elf/ifuncmain4
> FAIL: elf/ifuncmain5staticpic
> FAIL: elf/ifuncmain7
> FAIL: elf/ifuncmain7pic
> FAIL: elf/ifuncmain7pie
>
> Note that Binutils test suite is far from complete.  For example, the
> ifunc handling for LoongArch target in master branch (with or w/o this
> patch) can pass all ld tests, but it just blows up with a simple test
> case:
>
> $ cat c.s
> .global ifunc
> .type ifunc, @gnu_indirect_function
> .set ifunc, resolver
>
> resolver:
>    la.local $a0, impl
>    jr $ra
>
> impl:
>    li.w $a0, 42
>    jr $ra
>
> .data
> .global x
> .type x, @object
> x:
>    .dword ifunc
>
> $ cc c.s -shared
> collect2: fatal error: ld terminated with signal 11 [Segmentation fault], core dumped
> compilation terminated.
>
> So I think you'll at least need to build kernel/glibc/gcc using a ld
> with your patches to make sure it works correctly.

This is a bug, will be triggered:
1. a pointer point to a global ifunc,
2. compiling into a shared dynamic library.

We will fix and test this issue soon.


  reply	other threads:[~2022-07-19  7:26 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-18  8:43 [PATCH 1/5 v1] LoongArch: bfd: Add new reloc types liuzhensong
2022-07-18  8:43 ` [PATCH 2/5 v1] LoongArch:opcodes: " liuzhensong
2022-07-18  8:43 ` [PATCH 3/5 v1] LoongArch: gas: " liuzhensong
2022-07-18  8:43 ` [PATCH 4/5 v1] LoongArch: Move ifunc info to rela.dyn from rela.plt liuzhensong
2022-07-18 11:45   ` Xi Ruoyao
2022-07-18 16:27   ` Xi Ruoyao
2022-07-19  7:26     ` liuzhensong [this message]
2022-07-18  8:43 ` [PATCH 5/5 v1] LoongArch: Delete R_LARCH_NONE from dynamic info liuzhensong
2022-07-18 10:06 ` [PATCH 1/5 v1] LoongArch: bfd: Add new reloc types WANG Xuerui
2022-07-18 11:33   ` Xi Ruoyao
2022-07-18 12:11     ` WANG Xuerui
2022-07-18 12:18       ` WANG Xuerui
2022-07-19  3:57       ` Fangrui Song
2022-07-20  7:47         ` liuzhensong
2022-07-20  2:07       ` liuzhensong
2022-07-20  4:03         ` WANG Xuerui
2022-07-20  5:19           ` Xi Ruoyao
2022-07-20 12:54           ` liuzhensong
2022-07-19  7:32   ` liuzhensong
2022-07-20  2:42   ` liuzhensong
2022-07-19  4:29 ` Xi Ruoyao
2022-07-19  5:40   ` Xi Ruoyao
2022-07-19  6:31     ` 刘振松
2022-07-19  6:34       ` Xi Ruoyao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cced7764-dc76-6a7e-bde6-44421c7fb240@loongson.cn \
    --to=liuzhensong@loongson.cn \
    --cc=binutils@sourceware.org \
    --cc=i.swmail@xen0n.name \
    --cc=mengqinggang@loongson.cn \
    --cc=xry111@xry111.site \
    --cc=xuchenghua@loongson.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).