[PATCH v2] elf/riscv: Fix relaxation with aliases [PR28021]

Nelson Chu nelson.chu@sifive.com
Tue Jul 6 02:19:05 GMT 2021


Hi Michael,

On Tue, Jul 6, 2021 at 12:22 AM Michael Matz <matz@suse.de> wrote:
> On Tue, 29 Jun 2021, Nelson Chu wrote:
>
> > > > [tested by a testsuite run on a x86-64->riscv64 cross binutils]
> >
> > I get the errors when running the riscv32 regression, since the ld/sd
> > are unrecognized by riscv32 toolchain.  There are two solutions we
> > usually use, one is to support two testcases for riscv32 (use lw/sw)
> > and riscv64 (use ld/sw), or you can merge them into one source by
> > using .ifdef and .endif, and then pass --defsym when assembling them.
> > The other solution is to fix the march, for example, -march=rv64gc.
> > Both of the two solutions are good to me, so it depends on what you
> > think is better.
>
> I opted for hardcoding 64bit in the end.

Thanks, the rv32 binutils tests pass for now.

> I figured something out, thanks Andreas for the ld_nm hint.  See below the
> second version of the patch.  I've verified that it figures out the
> correct entries from the nm output (and indeed fails without the
> elfnn-riscv.c change).  Again, tested with a x86-64 to riscv cross (this
> time to riscv32 and riscv64!).

Wow, your solution should be the right way to check the nm, which I
never noticed.  Thanks, it looks really really good.   Just a minor
thing -

> +    } else {
> +       send_log "foobar_new == $nm_output(foobar_new)\n"
> +       verbose "foobar_new == $nm_output(foobar_new)"
> +       send_log "foobar@@New == $nm_output(foobar@@New)\n"
> +       verbose "foobar@@New == $nm_output(foobar@@New)"
> +       pass $testname
> +    }

showing the results when they are the same looks redundant, but this
is also OK to me.

> > However, except for the minor failures of riscv32 toolchain regressions,
> > the patch looks reasonable and good to me.  Thanks for the fix, you
> > could commit it after the riscv32 problem is resolved.
>
> So, I'll give it some time for comments and commit it tomorrow or so.

Thanks, please commit it when you think it's time.

Nelson


More information about the Binutils mailing list