This is the mail archive of the binutils@sourceware.cygnus.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

A ELF_LINK_NON_GOT_REF patch


Hi, Ian,

I need this patch. Otherwise, I get

# cat main.c
extern   char *sys_errlist[] ;

main ()
{
  return sys_errlist[0]== 0;
}
# gcc main.c
/usr/i386-redhat-linux/bin/ld: /tmp/ccZizvat.o: warning: unresolvable
relocation against symbol `sys_errlist@@GLIBC_2.1' from .text section

on Linux/glibc 2.1.

Thanks.


-- 
H.J. Lu (hjl@gnu.org)
---
Thu Sep  9 15:40:15 1999  H.J. Lu  <hjl@gnu.org>

	* elflink.h (elf_link_add_object_symbols): Copy NON_GOT_REF
	for version and weak defined symbols.

Index: elflink.h
===================================================================
RCS file: /work/cvs/gnu/binutils/bfd/elflink.h,v
retrieving revision 1.10
diff -u -p -r1.10 elflink.h
--- elflink.h	1999/09/06 17:57:21	1.10
+++ elflink.h	1999/09/09 22:36:26
@@ -1497,6 +1497,10 @@ elf_link_add_object_symbols (abfd, info)
 			      bfd_ind_section_ptr, (bfd_vma) 0, name, false,
 			      collect, (struct bfd_link_hash_entry **) &hi)))
 			goto error_return;
+
+		      /* Very tricky, we need to copy NON_GOT_REF. */
+		      h->elf_link_hash_flags |=
+		      	hi->elf_link_hash_flags & ELF_LINK_NON_GOT_REF;
 		    }
 		  else
 		    {
@@ -1662,6 +1666,10 @@ elf_link_add_object_symbols (abfd, info)
 			      collect, (struct bfd_link_hash_entry **) &hi)))
 			goto error_return;
 
+		      /* Very tricky, we need to copy NON_GOT_REF. */
+		      h->elf_link_hash_flags |=
+		      	hi->elf_link_hash_flags & ELF_LINK_NON_GOT_REF;
+
 		      /* If there is a duplicate definition somewhere,
                          then HI may not point to an indirect symbol.
                          We will have reported an error to the user in
@@ -1801,6 +1809,10 @@ elf_link_add_object_symbols (abfd, info)
 	      && h->root.u.def.value == vlook)
 	    {
 	      hlook->weakdef = h;
+
+	      /* Very tricky, we need to copy NON_GOT_REF. */
+	      h->elf_link_hash_flags |=
+	      	hlook->elf_link_hash_flags & ELF_LINK_NON_GOT_REF;
 
 	      /* If the weak definition is in the list of dynamic
 		 symbols, make sure the real definition is put there

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]