This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
PATCH: Fix ia64 linker crash when reporting non-pic code error
- From: "H. J. Lu" <hjl at lucon dot org>
- To: binutils at sources dot redhat dot com
- Date: Tue, 26 Apr 2005 15:38:53 -0700
- Subject: PATCH: Fix ia64 linker crash when reporting non-pic code error
When we report non-pic code error, we don't check local symbol, which
leads to linker crash. This patch fixes it.
H.J.
-----
2005-04-26 H.J. Lu <hongjiu.lu@intel.com>
* elfxx-ia64.c (elfNN_ia64_relocate_section): Get the local
symbol name when reporting non-pic code error.
--- bfd/elfxx-ia64.c.fptr 2005-04-26 08:25:36.000000000 -0700
+++ bfd/elfxx-ia64.c 2005-04-26 15:34:39.000000000 -0700
@@ -4037,6 +4041,7 @@ elfNN_ia64_relocate_section (output_bfd,
unsigned int dyn_r_type;
long dynindx;
bfd_vma addend;
+ const char *name;
BFD_ASSERT (srel != NULL);
@@ -4047,10 +4052,20 @@ elfNN_ia64_relocate_section (output_bfd,
case R_IA64_IMM64:
/* ??? People shouldn't be doing non-pic code in
shared libraries nor dynamic executables. */
+ if (h)
+ name = h->root.root.string;
+ else
+ {
+ name = bfd_elf_string_from_elf_section
+ (input_bfd, symtab_hdr->sh_link,
+ sym->st_name);
+ BFD_ASSERT (name);
+ if (*name == '\0')
+ name = bfd_section_name (input_bfd, sym_sec);
+ }
(*_bfd_error_handler)
(_("%B: non-pic code with imm relocation against dynamic symbol `%s'"),
- input_bfd,
- h->root.root.string);
+ input_bfd, name);
ret_val = FALSE;
continue;