From 09a24cbf399cbb184c7121403d394e3db416ae71 Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Sat, 20 Jun 2009 00:43:21 +0000
Subject: [PATCH] 2009-06-19  H.J. Lu  <hongjiu.lu@intel.com>

	* elf32-i386.c (elf_i386_check_relocs): Properly check local
	symbol on error.
	* elf64-x86-64.c (elf64_x86_64_check_relocs): Likewise.
---
 bfd/ChangeLog      | 6 ++++++
 bfd/elf32-i386.c   | 2 +-
 bfd/elf64-x86-64.c | 6 +++---
 3 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 32a21bee7af..8931e757b2f 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,9 @@
+2009-06-19  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* elf32-i386.c (elf_i386_check_relocs): Properly check local
+	symbol on error.
+	* elf64-x86-64.c (elf64_x86_64_check_relocs): Likewise.
+
 2009-06-19  H.J. Lu  <hongjiu.lu@intel.com>
 
 	* elf32-i386.c (elf_i386_tls_transition): Add a parameter,
diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c
index bac80e327eb..5ce7b2740c2 100644
--- a/bfd/elf32-i386.c
+++ b/bfd/elf32-i386.c
@@ -1538,7 +1538,7 @@ elf_i386_check_relocs (bfd *abfd,
 		  tls_type |= old_tls_type;
 		else
 		  {
-		    if (h->root.root.string)
+		    if (h)
 		      name = h->root.root.string;
 		    else
 		      name = bfd_elf_sym_name (abfd, symtab_hdr, isym,
diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c
index 44149c5bf7d..274b8746b7d 100644
--- a/bfd/elf64-x86-64.c
+++ b/bfd/elf64-x86-64.c
@@ -1232,7 +1232,7 @@ elf64_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info,
 	case R_X86_64_TPOFF32:
 	  if (info->shared)
 	    {
-	      if (h->root.root.string)
+	      if (h)
 		name = h->root.root.string;
 	      else
 		name = bfd_elf_sym_name (abfd, symtab_hdr, isym,
@@ -1327,7 +1327,7 @@ elf64_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info,
 		  tls_type |= old_tls_type;
 		else
 		  {
-		    if (h->root.root.string)
+		    if (h)
 		      name = h->root.root.string;
 		    else
 		      name = bfd_elf_sym_name (abfd, symtab_hdr,
@@ -1402,7 +1402,7 @@ elf64_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info,
 	      && (sec->flags & SEC_ALLOC) != 0
 	      && (sec->flags & SEC_READONLY) != 0)
 	    {
-	      if (h->root.root.string)
+	      if (h)
 		name = h->root.root.string;
 	      else
 		name = bfd_elf_sym_name (abfd, symtab_hdr, isym, NULL);
-- 
GitLab