summaryrefslogtreecommitdiff
path: root/bfd/elf32-mcore.c
diff options
context:
space:
mode:
Diffstat (limited to 'bfd/elf32-mcore.c')
-rw-r--r--bfd/elf32-mcore.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/bfd/elf32-mcore.c b/bfd/elf32-mcore.c
index 9034671c6e0..4c961bb7b9e 100644
--- a/bfd/elf32-mcore.c
+++ b/bfd/elf32-mcore.c
@@ -1,6 +1,6 @@
/* Motorola MCore specific support for 32-bit ELF
- Copyright 1994, 1995, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
- Free Software Foundation, Inc.
+ Copyright 1994, 1995, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -387,9 +387,6 @@ mcore_elf_relocate_section (bfd * output_bfd,
(info->relocatable) ? " (relocatable)" : "");
#endif
- if (info->relocatable)
- return TRUE;
-
if (! mcore_elf_howto_table [R_MCORE_PCRELIMM8BY4]) /* Initialize howto table if needed */
mcore_elf_howto_init ();
@@ -452,6 +449,20 @@ mcore_elf_relocate_section (bfd * output_bfd,
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;
+
switch (r_type)
{
default: