diff options
author | Alan Modra <amodra@gmail.com> | 2021-08-28 14:45:53 +0930 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2021-09-18 08:20:11 +0930 |
commit | 54721a930e80a635d3cb47c0ad3899ed9680bd78 (patch) | |
tree | 88b5cd53e547a5a37273303eabeac5bbcc868499 /gold/output.h | |
parent | 973b2b402ebf660e2bbbac60e85469164d76ecfc (diff) | |
download | gdb-54721a930e80a635d3cb47c0ad3899ed9680bd78.zip gdb-54721a930e80a635d3cb47c0ad3899ed9680bd78.tar.gz gdb-54721a930e80a635d3cb47c0ad3899ed9680bd78.tar.bz2 |
[GOLD] Output_data_got tidy
Some Output_data_got methods already have support for addends, but
were implemented as separate methods. This removes unnecessary code
duplication.
Relobj::local_has_got_offset and others there get a similar treatment.
Comments are removed since it should be obvious without a comment, and
the existing comments are not precisely what the code does. For
example, a local_has_got_offset call without an addend does not return
whether the local symbol has *a* GOT offset of type GOT_TYPE, it
returns whether there is a GOT entry of type GOT_TYPE for the symbol
with addend of zero.
PR 28192
* output.h (Output_data_got::add_local): Make addend optional.
(Output_data_got::add_local_with_rel): Likewise.
(Output_data_got::add_local_pair_with_rel): Likewise.
* output.cc (Output_data_got::add_local): Delete overload
without addend.
(Output_data_got::add_local_with_rel): Likewise.
(Output_data_got::add_local_pair_with_rel): Likewise.
* object.h (Relobj::local_has_got_offset): Make addend optional.
Delete overload without addend later. Update comment.
(Relobj::local_got_offset): Likewise.
(Relobj::set_local_got_offset): Likewise.
Diffstat (limited to 'gold/output.h')
-rw-r--r-- | gold/output.h | 30 |
1 files changed, 3 insertions, 27 deletions
diff --git a/gold/output.h b/gold/output.h index 9c44f62..726c93b 100644 --- a/gold/output.h +++ b/gold/output.h @@ -2488,18 +2488,12 @@ class Output_data_got : public Output_data_got_base Output_data_reloc_generic* rel_dyn, unsigned int r_type_1, unsigned int r_type_2); - // Add an entry for a local symbol to the GOT. This returns true if - // this is a new GOT entry, false if the symbol already has a GOT - // entry. - bool - add_local(Relobj* object, unsigned int sym_index, unsigned int got_type); - // Add an entry for a local symbol plus ADDEND to the GOT. This returns // true if this is a new GOT entry, false if the symbol already has a GOT // entry. bool add_local(Relobj* object, unsigned int sym_index, unsigned int got_type, - uint64_t addend); + uint64_t addend = 0); // Like add_local, but use the PLT offset of the local symbol if it // has one. @@ -2512,30 +2506,12 @@ class Output_data_got : public Output_data_got_base add_local_tls(Relobj* object, unsigned int sym_index, unsigned int got_type) { return add_local_plt(object, sym_index, got_type); } - // Add an entry for a local symbol to the GOT, and add a dynamic - // relocation of type R_TYPE for the GOT entry. - void - add_local_with_rel(Relobj* object, unsigned int sym_index, - unsigned int got_type, Output_data_reloc_generic* rel_dyn, - unsigned int r_type); - // Add an entry for a local symbol plus ADDEND to the GOT, and add a dynamic // relocation of type R_TYPE for the GOT entry. void add_local_with_rel(Relobj* object, unsigned int sym_index, unsigned int got_type, Output_data_reloc_generic* rel_dyn, - unsigned int r_type, uint64_t addend); - - // Add a pair of entries for a local symbol to the GOT, and add - // a dynamic relocation of type R_TYPE using the section symbol of - // the output section to which input section SHNDX maps, on the first. - // The first got entry will have a value of zero, the second the - // value of the local symbol. - void - add_local_pair_with_rel(Relobj* object, unsigned int sym_index, - unsigned int shndx, unsigned int got_type, - Output_data_reloc_generic* rel_dyn, - unsigned int r_type); + unsigned int r_type, uint64_t addend = 0); // Add a pair of entries for a local symbol plus ADDEND to the GOT, and add // a dynamic relocation of type R_TYPE using the section symbol of @@ -2546,7 +2522,7 @@ class Output_data_got : public Output_data_got_base add_local_pair_with_rel(Relobj* object, unsigned int sym_index, unsigned int shndx, unsigned int got_type, Output_data_reloc_generic* rel_dyn, - unsigned int r_type, uint64_t addend); + unsigned int r_type, uint64_t addend = 0); // Add a pair of entries for a local symbol to the GOT, and add // a dynamic relocation of type R_TYPE using STN_UNDEF on the first. |