From 00d962d155e1cff6ce144f60f81a416e0f9b872e Mon Sep 17 00:00:00 2001
From: Nick Clifton <nickc@redhat.com>
Date: Mon, 18 Oct 2004 08:06:31 +0000
Subject: [PATCH] Compute	'name' for relocs against both local and
 global symbols.

---
 bfd/ChangeLog         |  5 +++++
 bfd/elf32-xstormy16.c | 14 ++++++++++----
 2 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 888c9202555..de596386d90 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,8 @@
+2004-10-18  Nick Clifton  <nickc@redhat.com>
+
+	* elf32-xstormy16.c (xstormy16_elf_relocate_section): Compute
+	'name' for relocs against both local and global symbols.
+
 2004-10-16  Daniel Jacobowitz  <dan@debian.org>
 
 	* bfd-in2.h: Regenerate.
diff --git a/bfd/elf32-xstormy16.c b/bfd/elf32-xstormy16.c
index e03cc77190d..8c96348ac49 100644
--- a/bfd/elf32-xstormy16.c
+++ b/bfd/elf32-xstormy16.c
@@ -840,10 +840,6 @@ xstormy16_elf_relocate_section (output_bfd, info, input_bfd, input_section,
 	  sym = local_syms + r_symndx;
 	  sec = local_sections [r_symndx];
 	  relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
-
-	  name = bfd_elf_string_from_elf_section
-	    (input_bfd, symtab_hdr->sh_link, sym->st_name);
-	  name = (name == NULL) ? bfd_section_name (input_bfd, sec) : name;
 	}
       else
 	{
@@ -855,6 +851,16 @@ xstormy16_elf_relocate_section (output_bfd, info, input_bfd, input_section,
 				   unresolved_reloc, warned);
 	}
 
+      if (h != NULL)
+	name = h->root.root.string;
+      else
+	{
+	  name = (bfd_elf_string_from_elf_section
+		  (input_bfd, symtab_hdr->sh_link, sym->st_name));
+	  if (name == NULL || *name == '\0')
+	    name = bfd_section_name (input_bfd, sec);
+	}
+
       switch (ELF32_R_TYPE (rel->r_info))
 	{
 	case R_XSTORMY16_24: