[PATCH v3 1/2] RISC-V: PR27916, Support mapping symbols.
Jim Wilson
jimw@sifive.com
Sat Aug 28 03:47:45 GMT 2021
On Tue, Aug 24, 2021 at 6:36 PM Nelson Chu <nelson.chu@sifive.com> wrote:
> ping :)
>
> Thanks
> Nelson
>
> On Tue, Jul 13, 2021 at 6:09 PM Nelson Chu <nelson.chu@sifive.com> wrote:
> >
> > Similar to ARM/AARCH64, we add mapping symbols in the symbol table,
> > to mark the start addresses of data and instructions. The $d means
> > data, and the $x means instruction. Then the disassembler uses these
> > symbols to decide whether we should dump data or instruction.
Looks OK to me. I guess you want an approval because of the readelf.c
change? That is just a minor comment change though.
I did notice one typo in a comment in gas/config/tc-riscv.c in
riscv_check_mapping_symbols where you have fragmnet which should be
fragment.
Same file in riscv_mapping_state you have
+ /* The mapping symbol should be emitted. */
+ if (from_state == to_state)
+ return;
which looks a little funny. Maybe you meant that we should emit it now
that we know that it is a text section. But then you have code to not emit
it if we are already in the right mapping state which is a little
confusing. Could be something like "should be emitted if not in the right
mapping state."
I saw the comment about -D in the disassembler. -D really is supposed to
disassemble data. The arm/aarch64 ports get this right. -D is useful in
rare cases where you have instruction templates in the data section, and
you want to disassemble them to verify that they are correct. Maybe you
are disassembling a compiler so it has instructions in data. Or maybe this
is some self modifying code. Anyways, -D should disassemble data same as
arm/aarch64.
Mapping symbols are still a proposal for the psABI, but I think this is
OK. There was only disagreement on the more complicated stuff that this
patch doesn't attempt to implement.
Jim
More information about the Binutils
mailing list