This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH]: minor cleanup in powerpc.cc, typo in symtab.h


Hi,

This patch makes a few obvious fixes in powerpc.cc.

Nick Lewycky

2008-12-30 Nick Lewycky <nicholas@metrix.on.ca>

* powerpc.cc (Relocate::relocate): Fix copy-pasto where rel16_hi and
rel16_ha were both calling rel16_lo.
* powerpc.cc (rel16_ha): Don't try to invert 0xffff in a 16-bit value. That
triggers a warning that causes a compile failure.
* powerpc.cc: typo fix x+ +4 into x + 4 (C++ interprets this as +4 with the
* symtab.h: relocaiton -> relocation



Index: gold/powerpc.cc
===================================================================
RCS file: /cvs/src/src/gold/powerpc.cc,v
retrieving revision 1.7
diff -u -p -r1.7 powerpc.cc
--- gold/powerpc.cc	16 Sep 2008 17:23:37 -0000	1.7
+++ gold/powerpc.cc	31 Dec 2008 03:53:15 -0000
@@ -665,7 +665,6 @@ public:
   {
     typedef typename elfcpp::Swap<16, true>::Valtype Valtype;
     Valtype* wv = reinterpret_cast<Valtype*>(view);
-    Valtype val = elfcpp::Swap<16, true>::readval(wv);
     typename elfcpp::Elf_types<size>::Elf_Addr reloc;
 
     reloc = (psymval->value(object, addend) - address);
@@ -673,10 +672,9 @@ public:
       reloc += 0x10000;
     reloc >>= 16;
 
-    val &= ~static_cast<Valtype>(0xffff);
     reloc &= static_cast<Valtype>(0xffff);
 
-    elfcpp::Swap<16, true>::writeval(wv, val | reloc);
+    elfcpp::Swap<16, true>::writeval(wv, reloc);
   }
 };
 
@@ -759,7 +757,7 @@ class Output_data_plt_powerpc : public O
 
   // Return the .rela.plt section data.
   const Reloc_section* rel_plt() const
- {
+  {
     return this->rel_;
   }
 
@@ -815,7 +813,7 @@ void
 Output_data_plt_powerpc<size, big_endian>::add_entry(Symbol* gsym)
 {
   gold_assert(!gsym->has_plt_offset());
-  unsigned int index = this->count_+ + 4;
+  unsigned int index = this->count_ + 4;
   section_offset_type plt_offset;
 
   if (index < 8192)
@@ -1677,11 +1675,11 @@ Target_powerpc<size, big_endian>::Reloca
       break;
 
     case elfcpp::R_PPC_REL16_HI:
-      Reloc::rel16_lo(view, object, psymval, addend, address);
+      Reloc::rel16_hi(view, object, psymval, addend, address);
       break;
 
     case elfcpp::R_PPC_REL16_HA:
-      Reloc::rel16_lo(view, object, psymval, addend, address);
+      Reloc::rel16_ha(view, object, psymval, addend, address);
       break;
 
     case elfcpp::R_POWERPC_GOT16:
Index: gold/symtab.h
===================================================================
RCS file: /cvs/src/src/gold/symtab.h,v
retrieving revision 1.83
diff -u -p -r1.83 symtab.h
--- gold/symtab.h	19 Sep 2008 22:54:57 -0000	1.83
+++ gold/symtab.h	31 Dec 2008 03:53:16 -0000
@@ -648,7 +648,7 @@ class Symbol
       return true;
 
     // A reference to a symbol defined in a dynamic object or to a
-    // symbol that is preemptible can not use a RELATIVE relocaiton.
+    // symbol that is preemptible can not use a RELATIVE relocation.
     if (this->is_from_dynobj()
         || this->is_undefined()
         || this->is_preemptible())

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]