2010-06-29 Doug Kwan <dougkwan@google.com>
authorDoug Kwan <dougkwan@google.com>
Wed, 30 Jun 2010 06:41:09 +0000 (06:41 +0000)
committerDoug Kwan <dougkwan@google.com>
Wed, 30 Jun 2010 06:41:09 +0000 (06:41 +0000)
* arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
Initialize USE_SYMBOL_.
* arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
definition.
(Arm_reloc_property::uses_symbol_): New data member declaration.
* arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
uses symbol value and symbol is undefined but not weakly undefined.

gold/ChangeLog
gold/arm-reloc-property.cc
gold/arm-reloc-property.h
gold/arm.cc

index c7f4a5f9bd6523944d11c16943a7062700819672..188cb32ccf2cbe0ac95e2217d872fc32b32cff93 100644 (file)
@@ -1,3 +1,13 @@
+2010-06-29  Doug Kwan  <dougkwan@google.com>
+
+       * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
+       Initialize USE_SYMBOL_.
+       * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
+       definition.
+       (Arm_reloc_property::uses_symbol_): New data member declaration.
+       * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
+       uses symbol value and symbol is undefined but not weakly undefined.
+
 2010-06-28  Rafael Espindola  <espindola@google.com>
 
        * plugin.cc (Plugin::load): Use dlerror.
index 4f8fa9e458276626b0e1f4b7782d8810ed93f20e..007653cb4e1a1ab803b606bdb00c3d99ebfcc962 100644 (file)
@@ -104,7 +104,8 @@ Arm_reloc_property::Arm_reloc_property(
     relative_address_base_(RAB_NONE), is_deprecated_(is_deprecated),
     is_implemented_(is_implemented), checks_overflow_(checks_overflow),
     uses_got_entry_(false), uses_got_origin_(false), uses_plt_entry_(false),
-    uses_thumb_bit_(false), uses_symbol_base_(false), uses_addend_(false)
+    uses_thumb_bit_(false), uses_symbol_base_(false), uses_addend_(false),
+    uses_symbol_(false)
 {
   // Set size and alignment of static and dynamic relocations.
   if (rtype == RT_STATIC)
@@ -246,6 +247,7 @@ Arm_reloc_property::Arm_reloc_property(
     }
 
   gold_assert(node->is_leaf() && node->name() == "S");
+  this->uses_symbol_ = true;
 
   delete root_node;
 }
index 349d8629deb8d40f0c8dcb74bb7a5cb2db5f5f3c..e7d7f5094159053eb34c619215465f9e651f1f35 100644 (file)
@@ -132,6 +132,11 @@ class Arm_reloc_property
   uses_symbol_base() const
   { return this->uses_symbol_base_; }
 
+  // Whether relocation uses the symbol.
+  bool
+  uses_symbol() const
+  { return this->uses_symbol_; }
+
   // Return the type of relative address base or RAB_NONE if this
   // is not a relative addressing relocation.
   Relative_address_base
@@ -273,6 +278,8 @@ class Arm_reloc_property
   bool uses_symbol_base_ : 1;
   // Whether this uses an addend.
   bool uses_addend_ : 1;
+  // Whether this uses the symbol.
+  bool uses_symbol_ : 1;
 };
 
 // Arm_reloc_property_table.  This table is used for looking up propeties
index d19d04c4bc25de52d934a254a9639bc765b0e8e1..76d466b97d4aa782617c8787df4c7c0a90179e79 100644 (file)
@@ -8410,6 +8410,13 @@ Target_arm<big_endian>::Relocate::relocate(
              // be converted into an NOP.
              is_weakly_undefined_without_plt = true;
            }
+         else if (gsym->is_undefined() && reloc_property->uses_symbol())
+           {
+             // This relocation uses the symbol value but the symbol is
+             // undefined.  Exit early and have the caller reporting an
+             // error.
+             return true;
+           }
          else
            {
              // Set thumb bit if symbol:
This page took 0.038297 seconds and 4 git commands to generate.