[GOLD] Got_offset_list: addend field

Cary Coutant ccoutant@gmail.com
Fri Sep 3 01:13:57 GMT 2021

> This is the first in a series of patches aimed at supporting GOT
> entries against symbol plus addend generally for PowerPC64 rather than
> just section symbol plus addend as gold has currently.
> This patch adds an addend field to Got_offset_list, so that both local
> and global symbols can have GOT entries with addend.  Note the FIXME
> in incremental.cc, which will need attention if powerpc is to ever
> support incremental linking.

Do you think you'd ever want incremental linking on powerpc? Frankly,
the effort for just the one target platform was pretty high, the
maintenance on it is burdensome, and I'm tempted to deprecate it and
rip it out at some point in the future.

> As per the recommendation in
> https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rf-default-args
> the changes to symtab.h Symbol methods could be done with what looks
> like a good use of default arguments but they seem to be against the
> gold maintainers' coding practice.  So instead we get more overloads.

For the record, I've got nothing against default parameter values, as
long as they're obvious default values that shouldn't ever need to be
changed. I'm not sure what Ian's position was, but he did use a
default parameter value in at least one place (Descriptors::open in
descriptors.h). I wouldn't be surprised to find places where I
probably should have used a default parameter value instead of an

> Tested with a power10 gcc-11 bootstrap and regression test where
> ld.gold was the default linker.  The series cures an enormous number
> of testsuite failures (4656) without introducing regressions other
> than some in the guality testsuite.
>         PR 28192
>         * object.h (Got_offset_list): Add addend_ field, init in both
>         constructors.  Adjust all accessors to suit.
>         (Sized_relobj::do_local_has_got_offset): Adjust to suit.
>         (Sized_relobj::do_local_got_offset): Likewise.
>         (Sized_relobj::do_set_local_got_offset): Likewise.
>         * symtab.h (Symbol::has_got_offset): New overload with addend
>         param.  Make old overload call this one.
>         (Symbol::got_offset, Symbol::set_got_offset): Likewise.
>         * incremental.cc (Local_got_offset_visitor::visit): Add unused
>         uint64_t parameter with FIXME.
>         (Global_got_offset_visitor::visit): Add unused uint64_t parameter.

OK, with or without your suggestion to use a default parameter value
for has_got_offset.



More information about the Binutils mailing list