summaryrefslogtreecommitdiff
path: root/bfd/elf-m10300.c
diff options
context:
space:
mode:
Diffstat (limited to 'bfd/elf-m10300.c')
-rw-r--r--bfd/elf-m10300.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/bfd/elf-m10300.c b/bfd/elf-m10300.c
index df2d4ab2b5..014ec04f61 100644
--- a/bfd/elf-m10300.c
+++ b/bfd/elf-m10300.c
@@ -1,6 +1,6 @@
/* Matsushita 10300 specific support for 32-bit ELF
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
- 2006 Free Software Foundation, Inc.
+ 2006, 2007 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -1362,9 +1362,6 @@ mn10300_elf_relocate_section (output_bfd, info, input_bfd, input_section,
struct elf_link_hash_entry **sym_hashes;
Elf_Internal_Rela *rel, *relend;
- if (info->relocatable)
- return TRUE;
-
symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
sym_hashes = elf_sym_hashes (input_bfd);
@@ -1440,7 +1437,7 @@ mn10300_elf_relocate_section (output_bfd, info, input_bfd, input_section,
obscure cases sec->output_section will be NULL. */
relocation = 0;
- else if (unresolved_reloc)
+ else if (!info->relocatable && unresolved_reloc)
(*_bfd_error_handler)
(_("%B(%A+0x%lx): unresolvable %s relocation against symbol `%s'"),
input_bfd,
@@ -1450,6 +1447,20 @@ mn10300_elf_relocate_section (output_bfd, info, input_bfd, input_section,
h->root.root.root.string);
}
+ 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 = mn10300_elf_final_link_relocate (howto, input_bfd, output_bfd,
input_section,
contents, rel->r_offset,