This is the mail archive of the binutils@sources.redhat.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]
Other format: [Raw text]

PATCH: Re: hppa64-hp-hpux11.00: invalid string offset for section .dynstr


Ross,

> /opt/dev64/lib/gcc-lib/hppa64-hp-hpux11.00/3.1/../../../../hppa64-hp-hpux11.00/bin/ld: generate.sl: invalid string offset 6180 >= 129 for section
> `.dynstr'

Could you try the following patch?  I believe it will fix the above problem.
It fixes the problem in final executables and I believe that it will also
work for shared libraries.

I have tested it with builds of binutils and gcc.  There are no binutils
regressions.  Gcc regression testing is in progress.

The patch is modelled after what is done in elf32-hppa.c although I
didn't force millicode symbols to be local.  The HP compiler doesn't
do this, so I thought it best to leave them as global symbols.

Jeff, would you please install if OK?

Dave
-- 
J. David Anglin                                  dave.anglin@nrc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6605)

2002-06-21  John David Anglin  <dave@hiauly1.hia.nrc.ca>

	* elf64-hppa.c (clobber_millicode_symbols): New function.
	(allocate_global_data_dlt):  Don't add millicode symbols to dynamic
	symbol table.
	(allocate_global_data_opd, allocate_dynrel_entries): Likewise.
	(elf64_hppa_size_dynamic_sections): Traverse hash table to keep
	millicode symbols out of dynamic symbol table.
	(elf64_hppa_finish_dynamic_symbol): Remove code to keep millicode
	symbols out of dynamic symbol table.

Index: elf64-hppa.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-hppa.c,v
retrieving revision 1.23
diff -u -3 -p -r1.23 elf64-hppa.c
--- elf64-hppa.c	16 Jun 2002 15:32:08 -0000	1.23
+++ elf64-hppa.c	21 Jun 2002 19:32:08 -0000
@@ -195,6 +195,9 @@ static boolean elf64_hppa_create_dynamic
 static boolean elf64_hppa_adjust_dynamic_symbol
   PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *));
 
+static boolean clobber_millicode_symbols
+  PARAMS ((struct elf_link_hash_entry *, struct bfd_link_info *));
+
 static boolean elf64_hppa_size_dynamic_sections
   PARAMS ((bfd *, struct bfd_link_info *));
 
@@ -1073,7 +1076,7 @@ allocate_global_data_dlt (dyn_h, data)
 	     table since we might need to create a dynamic relocation
 	     against it.  */
 	  if (! h
-	      || (h && h->dynindx == -1))
+	      || (h->dynindx == -1 && h->type != STT_PARISC_MILLI))
 	    {
 	      bfd *owner;
 	      owner = (h ? h->root.u.def.section->owner : dyn_h->owner);
@@ -1168,7 +1171,7 @@ allocate_global_data_opd (dyn_h, data)
 	 we have to create an opd descriptor.  */
       else if (x->info->shared
 	       || h == NULL
-	       || h->dynindx == -1
+	       || (h->dynindx == -1 && h->type != STT_PARISC_MILLI)
 	       || (h->root.type == bfd_link_hash_defined
 		   || h->root.type == bfd_link_hash_defweak))
 	{
@@ -1542,7 +1545,8 @@ allocate_dynrel_entries (dyn_h, data)
       /* Make sure this symbol gets into the dynamic symbol table if it is
 	 not already recorded.  ?!? This should not be in the loop since
 	 the symbol need only be added once.  */
-      if (dyn_h->h == 0 || dyn_h->h->dynindx == -1)
+      if (dyn_h->h == 0
+	  || (dyn_h->h->dynindx == -1 && dyn_h->h->type != STT_PARISC_MILLI))
 	if (!_bfd_elf64_link_record_local_dynamic_symbol
 	    (x->info, rent->sec->owner, dyn_h->sym_indx))
 	  return false;
@@ -1610,6 +1614,26 @@ elf64_hppa_adjust_dynamic_symbol (info, 
   return true;
 }
 
+/* This function is called via elf_link_hash_traverse to keep millicode
+   symbols out of the dynamic symbol table.  */
+
+static boolean
+clobber_millicode_symbols (h, info)
+     struct elf_link_hash_entry *h;
+     struct bfd_link_info *info;
+{
+  if (h->root.type == bfd_link_hash_warning)
+    h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
+  if (h->type == STT_PARISC_MILLI && h->dynindx != -1)
+    {
+      h->dynindx = -1;
+      _bfd_elf_strtab_delref (elf_hash_table (info)->dynstr, h->dynstr_index);
+    }
+
+  return true;
+}
+
 /* Set the final sizes of the dynamic sections and allocate memory for
    the contents of our special sections.  */
 
@@ -1641,6 +1665,11 @@ elf64_hppa_size_dynamic_sections (output
 	  s->_raw_size = sizeof ELF_DYNAMIC_INTERPRETER;
 	  s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER;
 	}
+
+      /* Keep millicode symbols out of the dynamic symbol table.  */
+      elf_link_hash_traverse (elf_hash_table (info),
+                              clobber_millicode_symbols,
+                              info);
     }
   else
     {
@@ -2098,11 +2127,6 @@ elf64_hppa_finish_dynamic_symbol (output
       bfd_put_32 (stub->owner, (bfd_vma) insn,
 		  stub->contents + dyn_h->stub_offset + 8);
     }
-
-  /* Millicode symbols should not be put in the dynamic
-     symbol table under any circumstances.  */
-  if (ELF_ST_TYPE (sym->st_info) == STT_PARISC_MILLI)
-    h->dynindx = -1;
 
   return true;
 }


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