2009-09-09 M R Swami Reddy <MR.Swami.Reddy@nsc.com>
authorM R Swami Reddy <MR.Swami.Reddy@nsc.com>
Wed, 9 Sep 2009 04:49:09 +0000 (04:49 +0000)
committerM R Swami Reddy <MR.Swami.Reddy@nsc.com>
Wed, 9 Sep 2009 04:49:09 +0000 (04:49 +0000)
       * elf32-cr16.c (elf32_cr16_relocate_section): Add code to discard the
       linkonce or linker script discarded section.

bfd/ChangeLog
bfd/elf32-cr16.c

index b0122766619571f13889a4db806a80f56c47a20b..9fd34c2e8ea4b29b01ce9fcc1a69ec8bca4497b6 100644 (file)
@@ -1,3 +1,8 @@
+2009-09-09  M R Swami Reddy <MR.Swami.Reddy@nsc.com>
+
+       * elf32-cr16.c (elf32_cr16_relocate_section): Add code to discard the
+       linkonce or linker script discarded section.
+
 2009-09-09  Alan Modra  <amodra@bigpond.net.au>
 
        * elf32-xtensa.c (elf_xtensa_relax_section): Delete -r check.
index f5e561e7dd1bf8c37abe878acf883f506e96dc5b..17be1ff562179ea6202e336ef4f326ff47347b18 100644 (file)
@@ -1473,6 +1473,20 @@ elf32_cr16_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
                                    unresolved_reloc, warned);
         }
 
+      if (sec != NULL && elf_discarded_section (sec))
+       {
+         /* For relocs against symbols from removed linkonce sections,
+            or sections discarded by a linker script, we just want the
+            section contents zeroed.  Avoid any special processing.  */
+         _bfd_clear_contents (howto, input_bfd, contents + rel->r_offset);
+         rel->r_info = 0;
+         rel->r_addend = 0;
+         continue;
+       }
+
+      if (info->relocatable)
+        continue;
+
       r = cr16_elf_final_link_relocate (howto, input_bfd, output_bfd,
                                         input_section,
                                         contents, rel->r_offset,