[LV] [PATCH] VAX/ELF: Do not allocate GOT space for local symbols
Maciej W. Rozycki
macro at linux-mips.org
Fri Jun 5 02:15:52 CEST 2009
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 at 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
_______________________________________________
Linux-Vax mailing list
Linux-Vax at mail.pergamentum.com
http://mail.pergamentum.com/mailman/listinfo/linux-vax
More information about the Vax-linux
mailing list