This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] RISC-V: Optimize lui and auipc relaxations for undefweak symbols
- From: Jim Wilson <jimw at sifive dot com>
- To: Nelson Chu <nelson dot chu at sifive dot com>
- Cc: Binutils <binutils at sourceware dot org>, Yi-Hsiu Hsu <yihsiu dot hsu at sifive dot com>, Kito Cheng <kito dot cheng at sifive dot com>
- Date: Thu, 19 Sep 2019 15:22:56 -0700
- Subject: Re: [PATCH] RISC-V: Optimize lui and auipc relaxations for undefweak symbols
- References: <CAJYME4HUU5vE=9R1xKUTTTFWehmMZVvxqzCzd74FWEs+vko1Jg@mail.gmail.com> <CAFyWVabpegD6j3FAV4nsi8HbUFkTVSY0pYDMx4LiHbE2p2uFsQ@mail.gmail.com> <CAJYME4GA__ntEfSOKTdRp2bp=zko0-43eZWQerqO3AWLNv8XMQ@mail.gmail.com>
On Thu, Sep 19, 2019 at 3:37 AM Nelson Chu <nelson.chu@sifive.com> wrote:
>
>
> *At first I thought that toolchain will use GOT and PLT if creating a
> shared library.Therefore, there is no harm without checking the above case
> I thought.But you are right, there may have some exceptions, and caution is
> the parent of safety :)*
>
Now that I had a little more time to look at this, it turns out that the
RISC-V port doesn't support the -z [no]dynamic-undefined-weak option. This
is an optional feature, and only the x86 and ppc ports provide it. I
hacked support for it in, and then noticed that we don't relax pcrel relocs
when creating shared libraries and pie output. Also, the auipc sequence
used in pic code results in a local symbol for the addi, and you are only
setting undefined_weak for global symbols. So the problem I was worried
about can't happen, even if we did have support for -z
[no]dynamic-undefined-weak. So you can forget about the
UNDEF_NO_DYNAMIC_RELOC comment, it isn't relevant to your patch.
Jim