aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2013-10-14 02:53:01 +0000
committerAlan Modra <amodra@gmail.com>2013-10-14 02:53:01 +0000
commite84fe78fbc4573769e4e96baf38696354718b382 (patch)
tree2e5ca7f25129ef868454f6539e6f1e3c30ecdd5e
parent0b76b0cedbc4b4c8ffd366e30683a3ab871888bc (diff)
downloadgdb-e84fe78fbc4573769e4e96baf38696354718b382.zip
gdb-e84fe78fbc4573769e4e96baf38696354718b382.tar.gz
gdb-e84fe78fbc4573769e4e96baf38696354718b382.tar.bz2
* output.h (Output_data_got::add_constant): Tidy.
(Output_data_got::add_constant_pair): New function. * powerpc.cc (Output_data_got_powerpc): Override all Output_data_got methods used so as to first call reserve_ent().
-rw-r--r--gold/ChangeLog7
-rw-r--r--gold/output.h11
-rw-r--r--gold/powerpc.cc81
3 files changed, 92 insertions, 7 deletions
diff --git a/gold/ChangeLog b/gold/ChangeLog
index 59015a0..2d16bbc 100644
--- a/gold/ChangeLog
+++ b/gold/ChangeLog
@@ -1,3 +1,10 @@
+2013-10-14 Alan Modra <amodra@gmail.com>
+
+ * output.h (Output_data_got::add_constant): Tidy.
+ (Output_data_got::add_constant_pair): New function.
+ * powerpc.cc (Output_data_got_powerpc): Override all Output_data_got
+ methods used so as to first call reserve_ent().
+
2013-10-11 Roland McGrath <mcgrathr@google.com>
* powerpc.cc (Output_data_got_powerpc): Remove unused methods
diff --git a/gold/output.h b/gold/output.h
index a689a44..574d270 100644
--- a/gold/output.h
+++ b/gold/output.h
@@ -2380,10 +2380,13 @@ class Output_data_got : public Output_data_got_base
// entry from the start of the GOT.
unsigned int
add_constant(Valtype constant)
- {
- unsigned int got_offset = this->add_got_entry(Got_entry(constant));
- return got_offset;
- }
+ { return this->add_got_entry(Got_entry(constant)); }
+
+ // Add a pair of constants to the GOT. This returns the offset of
+ // the new entry from the start of the GOT.
+ unsigned int
+ add_constant_pair(Valtype c1, Valtype c2)
+ { return this->add_got_entry_pair(Got_entry(c1), Got_entry(c2)); }
// Replace GOT entry I with a new constant.
void
diff --git a/gold/powerpc.cc b/gold/powerpc.cc
index 36745ea..880b367 100644
--- a/gold/powerpc.cc
+++ b/gold/powerpc.cc
@@ -1987,13 +1987,88 @@ public:
header_index_(size == 32 ? 0x2000 : 0)
{ }
+ // Override all the Output_data_got methods we use so as to first call
+ // reserve_ent().
+ bool
+ add_global(Symbol* gsym, unsigned int got_type)
+ {
+ this->reserve_ent();
+ return Output_data_got<size, big_endian>::add_global(gsym, got_type);
+ }
+
+ bool
+ add_global_plt(Symbol* gsym, unsigned int got_type)
+ {
+ this->reserve_ent();
+ return Output_data_got<size, big_endian>::add_global_plt(gsym, got_type);
+ }
+
+ bool
+ add_global_tls(Symbol* gsym, unsigned int got_type)
+ { return this->add_global_plt(gsym, got_type); }
+
+ void
+ add_global_with_rel(Symbol* gsym, unsigned int got_type,
+ Output_data_reloc_generic* rel_dyn, unsigned int r_type)
+ {
+ this->reserve_ent();
+ Output_data_got<size, big_endian>::
+ add_global_with_rel(gsym, got_type, rel_dyn, r_type);
+ }
+
+ void
+ add_global_pair_with_rel(Symbol* gsym, unsigned int got_type,
+ Output_data_reloc_generic* rel_dyn,
+ unsigned int r_type_1, unsigned int r_type_2)
+ {
+ this->reserve_ent(2);
+ Output_data_got<size, big_endian>::
+ add_global_pair_with_rel(gsym, got_type, rel_dyn, r_type_1, r_type_2);
+ }
+
+ bool
+ add_local(Relobj* object, unsigned int sym_index, unsigned int got_type)
+ {
+ this->reserve_ent();
+ return Output_data_got<size, big_endian>::add_local(object, sym_index,
+ got_type);
+ }
+
+ bool
+ add_local_plt(Relobj* object, unsigned int sym_index, unsigned int got_type)
+ {
+ this->reserve_ent();
+ return Output_data_got<size, big_endian>::add_local_plt(object, sym_index,
+ got_type);
+ }
+
+ bool
+ add_local_tls(Relobj* object, unsigned int sym_index, unsigned int got_type)
+ { return this->add_local_plt(object, sym_index, got_type); }
+
+ void
+ add_local_tls_pair(Relobj* object, unsigned int sym_index,
+ unsigned int got_type,
+ Output_data_reloc_generic* rel_dyn,
+ unsigned int r_type)
+ {
+ this->reserve_ent(2);
+ Output_data_got<size, big_endian>::
+ add_local_tls_pair(object, sym_index, got_type, rel_dyn, r_type);
+ }
+
+ unsigned int
+ add_constant(Valtype constant)
+ {
+ this->reserve_ent();
+ return Output_data_got<size, big_endian>::add_constant(constant);
+ }
+
unsigned int
add_constant_pair(Valtype c1, Valtype c2)
{
this->reserve_ent(2);
- unsigned int got_offset = this->add_constant(c1);
- this->add_constant(c2);
- return got_offset;
+ return Output_data_got<size, big_endian>::add_constant_pair(c1, c2);
}
// Offset of _GLOBAL_OFFSET_TABLE_.