public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] VAX/ELF: Do not allocate GOT space for local symbols
@ 2009-06-05  0:10 Maciej W. Rozycki
  2009-06-15 13:55 ` Nick Clifton
  0 siblings, 1 reply; 2+ messages in thread
From: Maciej W. Rozycki @ 2009-06-05  0:10 UTC (permalink / raw)
  To: binutils; +Cc: Jan-Benedict Glaw, linux-vax

Hello,

 Here is a fix to exclude local symbols from GOT space calculation.  
These GOT entries would never be used anyway, because the VAX supports 
unlimited PC-relative addressing for all kinds of memory references.

 Regression-tested successfully with the vax-linux target; running
dynamically-linked `bash' on the target system (about the best native
testing possible atm) revealed no problems either.

bfd/
2009-06-04  Maciej W. Rozycki  <macro@linux-mips.org>

	* elf32-vax.c (elf_vax_instantiate_got_entries): Skip local 
	symbols in GOT space calculation.
	(elf_vax_relocate_section): Adjust accordingly.

 OK to apply?

  Maciej

binutils-2.19.51-20090531-vax-got-rel.patch
diff -up --recursive --new-file binutils-2.19.51-20090531.macro/bfd/elf32-vax.c binutils-2.19.51-20090531/bfd/elf32-vax.c
--- binutils-2.19.51-20090531.macro/bfd/elf32-vax.c	2009-04-02 04:25:18.000000000 +0000
+++ binutils-2.19.51-20090531/bfd/elf32-vax.c	2009-06-03 02:19:19.000000000 +0000
@@ -1322,6 +1322,8 @@ elf_vax_instantiate_got_entries (struct 
     }
   else if (h->got.refcount > 0)
     {
+      bfd_boolean dyn;
+
       /* Make sure this symbol is output as a dynamic symbol.  */
       if (h->dynindx == -1)
 	{
@@ -1329,9 +1331,15 @@ elf_vax_instantiate_got_entries (struct 
 	    return FALSE;
 	}
 
+      dyn = elf_hash_table (info)->dynamic_sections_created;
       /* Allocate space in the .got and .rela.got sections.  */
-      sgot->size += 4;
-      srelgot->size += sizeof (Elf32_External_Rela);
+      if (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
+	  && (info->shared
+	      || WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, 0, h)))
+	{
+	  sgot->size += 4;
+	  srelgot->size += sizeof (Elf32_External_Rela);
+	}
     }
 
   return TRUE;
@@ -1472,6 +1480,7 @@ elf_vax_relocate_section (bfd *output_bf
 	     the global offset table.  */
 
 	  {
+	    bfd_boolean dyn;
 	    bfd_vma off;
 
 	    if (sgot == NULL)
@@ -1485,9 +1494,10 @@ elf_vax_relocate_section (bfd *output_bf
 	    BFD_ASSERT (off != (bfd_vma) -1);
 	    BFD_ASSERT (off < sgot->size);
 
-	    if (info->shared
-		&& h->dynindx == -1
-		&& h->def_regular)
+	    dyn = elf_hash_table (info)->dynamic_sections_created;
+	    if (! WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, h)
+		|| (info->shared
+		    && SYMBOL_REFERENCES_LOCAL (info, h)))
 	      {
 		/* The symbol was forced to be local
 		   because of a version file..  We must initialize

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] VAX/ELF: Do not allocate GOT space for local symbols
  2009-06-05  0:10 [PATCH] VAX/ELF: Do not allocate GOT space for local symbols Maciej W. Rozycki
@ 2009-06-15 13:55 ` Nick Clifton
  0 siblings, 0 replies; 2+ messages in thread
From: Nick Clifton @ 2009-06-15 13:55 UTC (permalink / raw)
  To: Maciej W. Rozycki; +Cc: binutils, Jan-Benedict Glaw, linux-vax

Hi Maciej,

> bfd/
> 2009-06-04  Maciej W. Rozycki  <macro@linux-mips.org>
> 
> 	* elf32-vax.c (elf_vax_instantiate_got_entries): Skip local 
> 	symbols in GOT space calculation.
> 	(elf_vax_relocate_section): Adjust accordingly.

Approved - please apply.

Cheers
   Nick

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-06-15 13:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-05  0:10 [PATCH] VAX/ELF: Do not allocate GOT space for local symbols Maciej W. Rozycki
2009-06-15 13:55 ` Nick Clifton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).