* elf32-xtensa (elf_xtensa_relocate_section): After finding an invalid
authorBob Wilson <bob.wilson@acm.org>
Mon, 4 Feb 2008 23:13:24 +0000 (23:13 +0000)
committerBob Wilson <bob.wilson@acm.org>
Mon, 4 Feb 2008 23:13:24 +0000 (23:13 +0000)
relocation, do not continue processing it.  Ignore R_XTENSA_ASM_EXPAND
relocations against dynamic symbols.
(elf_xtensa_finish_dynamic_sections): Do not fail if there is no
.xt.lit section.

bfd/ChangeLog
bfd/elf32-xtensa.c

index 4bf8ef74dafe6d3a49465bc8a6bba785eac55492..6c9e79908a0171b09a71429ea3817886153cc157 100644 (file)
@@ -1,3 +1,11 @@
+2008-02-04  Bob Wilson  <bob.wilson@acm.org>
+       
+       * elf32-xtensa (elf_xtensa_relocate_section): After finding an invalid
+       relocation, do not continue processing it.  Ignore R_XTENSA_ASM_EXPAND
+       relocations against dynamic symbols.
+       (elf_xtensa_finish_dynamic_sections): Do not fail if there is no
+       .xt.lit section.
+       
 2008-02-04  Kai Tietz  <kai.tietz@onevision.com>
            H.J. Lu  <hongjiu.lu@intel.com>
 
index 43ef7d802d05c13c8c54976e1bc41917fe95f900..05ee9dfcf385c8f1f2ef0a1097fb887d0a3bd55f 100644 (file)
@@ -2164,6 +2164,7 @@ elf_xtensa_relocate_section (bfd *output_bfd,
                    (info, error_message, input_bfd, input_section,
                     rel->r_offset)))
                return FALSE;
+             continue;
            }
          else if ((r_type == R_XTENSA_32 || r_type == R_XTENSA_PLT)
                   && (input_section->flags & SEC_ALLOC) != 0
@@ -2244,6 +2245,13 @@ elf_xtensa_relocate_section (bfd *output_bfd,
              BFD_ASSERT (sizeof (Elf32_External_Rela) * srel->reloc_count
                          <= srel->size);
            }
+         else if (r_type == R_XTENSA_ASM_EXPAND && dynamic_symbol)
+           {
+             /* This should only happen for non-PIC code, which is not
+                supposed to be used on systems with dynamic linking.
+                Just ignore these relocations.  */
+             continue;
+           }
        }
 
       /* Dynamic relocs are not propagated for SEC_DEBUGGING sections
@@ -2467,7 +2475,7 @@ elf_xtensa_finish_dynamic_sections (bfd *output_bfd,
   bfd *dynobj;
   asection *sdyn, *srelplt, *sgot, *sxtlit, *sgotloc;
   Elf32_External_Dyn *dyncon, *dynconend;
-  int num_xtlit_entries;
+  int num_xtlit_entries = 0;
 
   if (! elf_hash_table (info)->dynamic_sections_created)
     return TRUE;
@@ -2592,11 +2600,14 @@ elf_xtensa_finish_dynamic_sections (bfd *output_bfd,
   BFD_ASSERT (! info->relocatable);
   sxtlit = bfd_get_section_by_name (output_bfd, ".xt.lit");
   sgotloc = htab->sgotloc;
-  BFD_ASSERT (sxtlit && sgotloc);
-  num_xtlit_entries =
-    elf_xtensa_combine_prop_entries (output_bfd, sxtlit, sgotloc);
-  if (num_xtlit_entries < 0)
-    return FALSE;
+  BFD_ASSERT (sgotloc);
+  if (sxtlit)
+    {
+      num_xtlit_entries =
+       elf_xtensa_combine_prop_entries (output_bfd, sxtlit, sgotloc);
+      if (num_xtlit_entries < 0)
+       return FALSE;
+    }
 
   dyncon = (Elf32_External_Dyn *) sdyn->contents;
   dynconend = (Elf32_External_Dyn *) (sdyn->contents + sdyn->size);