This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[patch] cr16-elf target: discard linkonce sections
- From: "M R Swami Reddy" <MR dot Swami dot Reddy at nsc dot com>
- To: "binutils at sourceware dot org" <binutils at sourceware dot org>
- Date: Tue, 08 Sep 2009 18:01:39 +0530
- Subject: [patch] cr16-elf target: discard linkonce sections
Hi,
Below patch included in elf32-cr16.c:elf32_cr16_relocate_section to
discard the linkonce sections:
Ran "make check-gas", "make check-binutils" and make check-ld". No
regression and 2 linkonce tests
passed from ld test suite. Is it ok for check-in?
ChangeLog:
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.
Index: elf32-cr16.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-cr16.c,v
retrieving revision 1.9
diff -u -r1.9 elf32-cr16.c
--- elf32-cr16.c 2 Sep 2009 07:18:36 -0000 1.9
+++ elf32-cr16.c 8 Sep 2009 12:27:50 -0000
@@ -1473,6 +1473,20 @@
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,