Check if a bfd is NULL before accessing its flags field.
authorH.J. Lu <hjl.tools@gmail.com>
Wed, 5 Jan 2011 14:25:26 +0000 (14:25 +0000)
committerH.J. Lu <hjl.tools@gmail.com>
Wed, 5 Jan 2011 14:25:26 +0000 (14:25 +0000)
2011-01-05  H.J. Lu  <hongjiu.lu@intel.com>

PR ld/12364
* plugin.c (get_symbols): Check if owner_sec->owner is NULL
before accessing its flags field.

ld/ChangeLog
ld/plugin.c

index 8644b45d227591d395b2ec271e8d4d02a8809be8..e9e88989f558c4aa1d7867a739105c018eb2ddf1 100644 (file)
@@ -1,3 +1,9 @@
+2011-01-05  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR ld/12364
+       * plugin.c (get_symbols): Check if owner_sec->owner is NULL
+       before accessing its flags field.
+
 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
 
        * ldver.c (ldversion): Update copyright to 2011.
index e4943c2bdd5b588ca618177541ee834c56f275d0..10314a4d485fc4d22a30a67d9bce1af0ee72e594 100644 (file)
@@ -511,7 +511,8 @@ get_symbols (const void *handle, int nsyms, struct ld_plugin_symbol *syms)
                                  : LDPR_PREVAILING_DEF);
          else if (is_ir_dummy_bfd (owner_sec->owner))
            syms[n].resolution = LDPR_RESOLVED_IR;
-         else if (owner_sec->owner->flags & DYNAMIC)
+         else if (owner_sec->owner != NULL
+                  && (owner_sec->owner->flags & DYNAMIC) != 0)
            syms[n].resolution =  LDPR_RESOLVED_DYN;
          else
            syms[n].resolution = LDPR_RESOLVED_EXEC;