[RFC PATCH] LoongArch: Add parameters to DWARF2_USE_FIXED_ADVANCE_PC macro

Alan Modra amodra@gmail.com
Wed Aug 12 03:46:56 GMT 2026


On Tue, Aug 11, 2026 at 03:09:33PM +0800, mengqinggang wrote:
> Hi Alan,
> Could you please take a look at this patch?
> Any feedback is welcome.
> Thanks.

I'm a little concerned about dwarf2dbg_convert_frag, whether the
second DWARF2_USE_FIXED_ADVANCE_PC invocation is valid.  If the first
one is true, fr_symbol shouldn't be modified so the second one will
be OK and give the same result, but if the first is false then
resolve_symbol_value may modify fr_symbol in a way that it is no
longer valid to pass the old X_add_symbol and X_op_symbol to
DWARF2_USE_FIXED_ADVANCE_PC.  I haven't done a deep enough dive into
the code to see all possible expressions that might appear here so my
concern might be unfounded, but it doesn't look robust to me.

I think the correct thing to do here is to delete the first
DWARF2_USE_FIXED_ADVANCE_PC and always call resolve_symbol_value with
finalize_syms zero.

The only other thing about your patch is that in
dwarf2dbg_convert_frag and dwarf2dbg_estimate_size_before_relax we now
get two unnecessary calls to symbol_get_value_expression for every
target other than loongarch.  If symbol_get_value_expression was
__attribute__ ((__const__)) everything would be good.

-- 
Alan Modra


More information about the Binutils mailing list