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]

don't play symbol value games with plts on alpha


By rights, Alpha should never have been affected by the plt bug
fixed in libjava recently.  This is what slavishly copying from
other ports will get you.

Alpha is different than most 32-bit targets in that it uses a
got for all dynamic addresses, and *never* encodes addresses
that are not provably local into the text segment.  This all
by itself is enough for most 64-bit targets to avoid exposing
plt addresses such that a user might ever see one.

Further, since Alpha uses the got for everything -- including
arrival at the plt (unlike others, we don't use branches,
a plt entry is surpressed if the function's address is used for
anything besides a call.  So the very situation we're supposed
to be protecting against is *impossible* to induce.


r~


        * elf64-alpha.c (struct alpha_elf_link_hash_entry): Remove
        plt_old_section, plt_old_value.
        (elf64_alpha_adjust_dynamic_symbol): Don't set it.
        (elf64_alpha_size_plt_section_1): Don't use it.

Index: elf64-alpha.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-alpha.c,v
retrieving revision 1.137
diff -u -p -d -r1.137 elf64-alpha.c
--- elf64-alpha.c	26 May 2005 07:14:03 -0000	1.137
+++ elf64-alpha.c	26 May 2005 16:08:22 -0000
@@ -69,10 +69,6 @@ struct alpha_elf_link_hash_entry
 #define ALPHA_ELF_LINK_HASH_TLS_IE	0x40
 #define ALPHA_ELF_LINK_HASH_PLT_LOC	0x80
 
-  /* Used to undo the localization of a plt symbol.  */
-  asection *plt_old_section;
-  bfd_vma plt_old_value;
-
   /* Used to implement multiple .got subsections.  */
   struct alpha_elf_got_entry
   {
@@ -2017,20 +2013,6 @@ elf64_alpha_adjust_dynamic_symbol (struc
       h->plt.offset = s->size;
       s->size += PLT_ENTRY_SIZE;
 
-      /* If this symbol is not defined in a regular file, and we are not
-	 generating a shared library, then set the symbol to the location
-	 in the .plt.  This is required to make function pointers compare
-	 equal between the normal executable and the shared library.  */
-      if (! info->shared
-	  && h->root.type != bfd_link_hash_defweak)
-	{
-	  ah->plt_old_section = h->root.u.def.section;
-	  ah->plt_old_value = h->root.u.def.value;
-	  ah->flags |= ALPHA_ELF_LINK_HASH_PLT_LOC;
-	  h->root.u.def.section = s;
-	  h->root.u.def.value = h->plt.offset;
-	}
-
       /* We also need a JMP_SLOT entry in the .rela.plt section.  */
       s = bfd_get_section_by_name (dynobj, ".rela.plt");
       BFD_ASSERT (s != NULL);
@@ -2480,14 +2462,6 @@ elf64_alpha_size_plt_section_1 (struct a
     {
       h->root.needs_plt = 0;
       h->root.plt.offset = -1;
-
-      /* Undo the definition frobbing begun in adjust_dynamic_symbol.  */
-      if (h->flags & ALPHA_ELF_LINK_HASH_PLT_LOC)
-	{
-	  h->root.root.u.def.section = h->plt_old_section;
-	  h->root.root.u.def.value = h->plt_old_value;
-	  h->flags &= ~ALPHA_ELF_LINK_HASH_PLT_LOC;
-	}
     }
 
   return TRUE;


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