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]

visibility patch for alpha and ia64


Both of these targets emit better code when they know that
the symbol must bind locally.


r~


        * elfxx-ia64.c (elfNN_ia64_dynamic_symbol_p): Return false
        for non-default visibility. 
        * elf64-alpha.c (alpha_elf_dynamic_symbol_p): Likewise, but
        delete ugly macro and replace with pretty function.

Index: elf64-alpha.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-alpha.c,v
retrieving revision 1.18
diff -c -p -d -r1.18 elf64-alpha.c
*** elf64-alpha.c	2001/01/23 11:45:53	1.18
--- elf64-alpha.c	2001/01/26 23:59:07
*************** Foundation, Inc., 59 Temple Place - Suit
*** 46,52 ****
  #define ECOFF_64
  #include "ecoffswap.h"
  
! static boolean elf64_alpha_mkobject PARAMS ((bfd *));
  static struct bfd_hash_entry * elf64_alpha_link_hash_newfunc
    PARAMS((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
  static struct bfd_link_hash_table * elf64_alpha_bfd_link_hash_table_create
--- 46,53 ----
  #define ECOFF_64
  #include "ecoffswap.h"
  
! static int alpha_elf_dynamic_symbol_p
!   PARAMS((struct elf_link_hash_entry *, struct bfd_link_info *));
  static struct bfd_hash_entry * elf64_alpha_link_hash_newfunc
    PARAMS((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
  static struct bfd_link_hash_table * elf64_alpha_bfd_link_hash_table_create
*************** static reloc_howto_type * elf64_alpha_bf
*** 66,71 ****
--- 67,74 ----
  static void elf64_alpha_info_to_howto
    PARAMS((bfd *, arelent *, Elf64_Internal_Rela *));
  
+ static boolean elf64_alpha_mkobject
+   PARAMS((bfd *));
  static boolean elf64_alpha_object_p
    PARAMS((bfd *));
  static boolean elf64_alpha_section_from_shdr
*************** struct alpha_elf_link_hash_table
*** 223,236 ****
  
  /* Should we do dynamic things to this symbol?  */
  
! #define alpha_elf_dynamic_symbol_p(h, info) 				\
!   ((((info)->shared && !(info)->symbolic)				\
!     || (((h)->elf_link_hash_flags					\
! 	 & (ELF_LINK_HASH_DEF_DYNAMIC | ELF_LINK_HASH_REF_REGULAR))	\
!         == (ELF_LINK_HASH_DEF_DYNAMIC | ELF_LINK_HASH_REF_REGULAR))	\
!     || (h)->root.type == bfd_link_hash_undefweak			\
!     || (h)->root.type == bfd_link_hash_defweak)				\
!    && (h)->dynindx != -1)
  
  /* Create an entry in a Alpha ELF linker hash table.  */
  
--- 226,260 ----
  
  /* Should we do dynamic things to this symbol?  */
  
! static int
! alpha_elf_dynamic_symbol_p (h, info)
!      struct elf_link_hash_entry *h;
!      struct bfd_link_info *info;
! {
!   if (h == NULL)
!     return false;
! 
!   while (h->root.type == bfd_link_hash_indirect
! 	 || h->root.type == bfd_link_hash_warning)
!     h = (struct elf_link_hash_entry *) h->root.u.i.link;
! 
!   if (h->dynindx == -1)
!     return false;
!   if (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT)
!     return false;
! 
!   if (h->root.type == bfd_link_hash_undefweak
!       || h->root.type == bfd_link_hash_defweak)
!     return true;
! 
!   if ((info->shared && !info->symbolic)
!       || ((h->elf_link_hash_flags
! 	   & (ELF_LINK_HASH_DEF_DYNAMIC | ELF_LINK_HASH_REF_REGULAR))
! 	  == (ELF_LINK_HASH_DEF_DYNAMIC | ELF_LINK_HASH_REF_REGULAR)))
!     return true;
! 
!   return false;
! }
  
  /* Create an entry in a Alpha ELF linker hash table.  */
  
Index: elfxx-ia64.c
===================================================================
RCS file: /cvs/src/src/bfd/elfxx-ia64.c,v
retrieving revision 1.8
diff -c -p -d -r1.8 elfxx-ia64.c
*** elfxx-ia64.c	2001/01/23 11:45:53	1.8
--- elfxx-ia64.c	2001/01/26 23:59:07
*************** elfNN_ia64_dynamic_symbol_p (h, info)
*** 1181,1186 ****
--- 1181,1188 ----
  
    if (h->dynindx == -1)
      return false;
+   if (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT)
+     return false;
  
    if (h->root.type == bfd_link_hash_undefweak
        || h->root.type == bfd_link_hash_defweak)

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