Bugs in recent snapshots on Solaris

Manfred Hollstein manfred@s-direktnet.de
Fri Mar 13 01:21:00 GMT 1998


On Fri, 13 March 1998, 09:46:33, manfred@s-direktnet.de wrote:

 > Didn't anybody else see this? When make check is running the shared
 > tests in the ld directory, it'll never stop. Instead I'll get a CPU
 > hungry process tmpdir/shp running and running and ... I have no idea
 > what it's doing, size won't change (increase or decrease), but it
 > really hogs my CPU (top reports right now 0.0% idle!).
 > 
 > This is with yesterday's snapshot (gas-980312), but I've observed it
 > with 0303 as well. I haven't investigated, when this problem has been
 > introduced, but at least 980219 is working without problems.
 > 
 > Interestingly, this only happens on sparc-sun-solaris2.5.1, not on
 > sparc-sun-sunos4.1.4.

In the meantime I tracked this down to this change from 980224:

Sun Feb 22 20:39:00 1998  Richard Henderson  <rth@cygnus.com>

	* elf32-sparc.c (elf32_sparc_adjust_dynamic_symbol): Don't create
 	a plt entry when we can determine that we authoritatively define
 	the symbol.

diff -u -r --new-file --show-function-line=^[A-Za-z_] /home/raeburn/offsite/snap/old/gas-980219/bfd/elf32-sparc.c ./bfd/elf32-sparc.c
--- /home/raeburn/offsite/snap/old/gas-980219/bfd/elf32-sparc.c	Thu Feb 19 01:14:03 1998
+++ ./bfd/elf32-sparc.c	Tue Feb 24 01:14:08 1998
@@ -593,14 +593,22 @@ elf32_sparc_adjust_dynamic_symbol (info,
 	      || h->root.type == bfd_link_hash_defweak)
 	  && (h->root.u.def.section->flags & SEC_CODE) != 0))
     {
-      if (! elf_hash_table (info)->dynamic_sections_created)
+      if (! elf_hash_table (info)->dynamic_sections_created
+	  || ((!info->shared || info->symbolic || h->dynindx == -1)
+	      && (h->elf_link_hash_flags
+		  & ELF_LINK_HASH_DEF_REGULAR) != 0))
 	{
 	  /* This case can occur if we saw a WPLT30 reloc in an input
-             file, but none of the input files were dynamic objects.
-             In such a case, we don't actually need to build a
-             procedure linkage table, and we can just do a WDISP30
-             reloc instead.  */
-	  BFD_ASSERT ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0);
+	     file, but none of the input files were dynamic objects.
+	     Or, when linking the main application or a -Bsymbolic
+	     shared library against PIC code.  Or when a global symbol
+	     has been made private, e.g. via versioning.
+
+	     In these cases we know what value the symbol will resolve
+	     to, so we don't actually need to build a procedure linkage
+	     table, and we can just do a WDISP30 reloc instead.  */
+
+	  h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
 	  return true;
 	}
 
@@ -618,17 +626,11 @@ elf32_sparc_adjust_dynamic_symbol (info,
 	  return false;
 	}
 
-      /* If this symbol is not defined in a regular file, and we are
-	 not generating a shared library, then set the symbol to this
-	 location in the .plt.  This is required to make function
-	 pointers compare as equal between the normal executable and
-	 the shared library.  */
-      if (! info->shared
-	  && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
-	{
-	  h->root.u.def.section = s;
-	  h->root.u.def.value = s->_raw_size;
-	}
+      /* Set the symbol to this location in the .plt.  This is
+	 required to make function pointers compare as equal between
+	 the normal executable and the shared library.  */
+      h->root.u.def.section = s;
+      h->root.u.def.value = s->_raw_size;
 
       h->plt_offset = s->_raw_size;
 

I reverted this patch, re-built and did make check - now it runs!
Richard, can you please take a look at it?

Thanks

manfred



More information about the Bfd mailing list