gas: Use udata for DW_AT_high_pc when emitting DWARF4 (Was: Broken GAS DWARF tests)

Mark Wielaard mark@klomp.org
Thu Aug 6 11:49:56 GMT 2020


Hi,

On Wed, Aug 05, 2020 at 11:09:12PM -0700, Fangrui Song wrote:
> On 2020-08-04, Alan Modra via Binutils wrote:
> > On Mon, Aug 03, 2020 at 10:11:27PM +0200, Mark Wielaard wrote:
> > >        * dwarf2dbg.c (out_debug_abbrev): When DWARF2_VERSION >= 4, use
> > >        DW_FORM_udata for DW_AT_high_pc.
> > >        (out_debug_info): Use emit_leb128_expr for DW_AT_high_pc, when
> > >        DWARF2_VERSION >= 4.
> > >        * read.c (emit_leb128_exp): No longer static.
> > >        * read.h (emit_leb128_exp): Define.
> > 
> > OK, looks good.  Note that there have been problems in the past
> > resolving leb128 expressions (eg. see 38cf168be581), so please keep an
> > eye out for regressions.
> 
> Using DWARF v3 attribute class 'address' for DW_AT_high_pc can save a
> relocation on RISC-V in -mrelax mode

DW_FORM_addr is the default for DWARF2_VERSION < 4 (for both
DW_AT_low_pc and DW_AT_high_pc). Before this patch it was
DW_FORM_data4 (or DW_FORM_data8) for DW_AT_high_pc. Using data instead
of addr already did prevent a relocation (the data is an offset from
the low_pc address). Using DW_FORM_udata instead means the data
representation usually smaller (especially for 64bit arches).

How does -mrelax mode work to prevent having to generate a relocation
even when generating an address against a different section?

Thanks,

Mark


More information about the Binutils mailing list