public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] visibility fixes for s390*.
@ 2003-05-09 14:55 Martin Schwidefsky
  2003-05-09 15:01 ` Daniel Jacobowitz
  0 siblings, 1 reply; 5+ messages in thread
From: Martin Schwidefsky @ 2003-05-09 14:55 UTC (permalink / raw)
  To: binutils

Hi,
I incorporated the visibility fixes from i386 to the s390 backends. This
fixes some of the ld test case failures for s390*. This is applicable for
CVS head and the 2.14 branch. Ok to commit ?

blue skies,
  Martin.

2003-05-09  Martin Schwidefsky  <schwidefsky@de.ibm.com>

	* elf32-s390.c (allocate_dynrelocs): For undef weak syms with
	non-default visibility, a) don't make them dynamic, b) discard
	space for dynamic relocs.
	(elf_s390_relocate_section): Initialize the GOT entries and skip
	R_390_{8,16,32}/R_390_PC{16,16DBL,32DBL,32} for weak undefined
	symbols with non-default visibility.
	* elf64-s390.c: Likewise.

diff -urN src/bfd/elf32-s390.c src-s390/bfd/elf32-s390.c
--- src/bfd/elf32-s390.c	Thu May  8 21:40:46 2003
+++ src-s390/bfd/elf32-s390.c	Fri May  9 15:09:37 2003
@@ -1651,7 +1651,9 @@
   htab = elf_s390_hash_table (info);
 
   if (htab->elf.dynamic_sections_created
-      && h->plt.refcount > 0)
+      && h->plt.refcount > 0
+      && (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
+	  || h->root.type != bfd_link_hash_undefweak))
     {
       /* Make sure this symbol is output as a dynamic symbol.
 	 Undefined weak syms won't yet be marked as dynamic.  */
@@ -1662,7 +1664,8 @@
 	    return FALSE;
 	}
 
-      if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, info, h))
+      if (info->shared
+	  || WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, info, h))
 	{
 	  asection *s = htab->splt;
 
@@ -1758,7 +1761,10 @@
 	htab->srelgot->_raw_size += sizeof (Elf32_External_Rela);
       else if (tls_type == GOT_TLS_GD)
 	htab->srelgot->_raw_size += 2 * sizeof (Elf32_External_Rela);
-      else if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info, h))
+      else if ((ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
+		|| h->root.type != bfd_link_hash_undefweak)
+	       && (info->shared
+		   || WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, 0, h)))
 	htab->srelgot->_raw_size += sizeof (Elf32_External_Rela);
     }
   else
@@ -1792,6 +1798,12 @@
 		pp = &p->next;
 	    }
 	}
+
+      /* Also discard relocs on undefined weak syms with non-default
+	 visibility.  */
+      if (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT
+	  && h->root.type == bfd_link_hash_undefweak)
+	eh->dyn_relocs = NULL;
     }
   else
     {
@@ -2306,7 +2318,9 @@
 		      && (info->symbolic
 			  || h->dynindx == -1
 			  || (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL))
-		      && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR)))
+		      && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR))
+		  || (ELF_ST_VISIBILITY (h->other)
+		      && h->root.type == bfd_link_hash_undefweak))
 		{
 		  /* This is actually a static link, or it is a
 		     -Bsymbolic link and the symbol is defined
@@ -2471,6 +2485,9 @@
 	    break;
 
 	  if ((info->shared
+	       && (h == NULL
+		   || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
+		   || h->root.type != bfd_link_hash_undefweak)
 	       && ((r_type != R_390_PC16
 		    && r_type != R_390_PC16DBL
 		    && r_type != R_390_PC32DBL
diff -urN src/bfd/elf64-s390.c src-s390/bfd/elf64-s390.c
--- src/bfd/elf64-s390.c	Thu May  8 22:14:07 2003
+++ src-s390/bfd/elf64-s390.c	Fri May  9 15:09:51 2003
@@ -1623,7 +1623,9 @@
   htab = elf_s390_hash_table (info);
 
   if (htab->elf.dynamic_sections_created
-      && h->plt.refcount > 0)
+      && h->plt.refcount > 0
+      && (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
+	  || h->root.type != bfd_link_hash_undefweak))
     {
       /* Make sure this symbol is output as a dynamic symbol.
 	 Undefined weak syms won't yet be marked as dynamic.  */
@@ -1634,7 +1636,8 @@
 	    return FALSE;
 	}
 
-      if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, info, h))
+      if (info->shared
+	  || WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, info, h))
 	{
 	  asection *s = htab->splt;
 
@@ -1730,7 +1733,10 @@
 	htab->srelgot->_raw_size += sizeof (Elf64_External_Rela);
       else if (tls_type == GOT_TLS_GD)
 	htab->srelgot->_raw_size += 2 * sizeof (Elf64_External_Rela);
-      else if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info, h))
+      else if ((ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
+		|| h->root.type != bfd_link_hash_undefweak)
+	       && (info->shared
+		   || WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, 0, h)))
 	htab->srelgot->_raw_size += sizeof (Elf64_External_Rela);
     }
   else
@@ -1764,6 +1770,12 @@
 		pp = &p->next;
 	    }
 	}
+
+      /* Also discard relocs on undefined weak syms with non-default
+	 visibility.  */
+      if (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT
+	  && h->root.type == bfd_link_hash_undefweak)
+	eh->dyn_relocs = NULL;
     }
   else
     {
@@ -2279,7 +2291,9 @@
 		      && (info->symbolic
 			  || h->dynindx == -1
 			  || (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL))
-		      && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR)))
+		      && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR))
+		  || (ELF_ST_VISIBILITY (h->other)
+		      && h->root.type == bfd_link_hash_undefweak))
 		{
 		  /* This is actually a static link, or it is a
 		     -Bsymbolic link and the symbol is defined
@@ -2449,6 +2463,9 @@
 	    break;
 
 	  if ((info->shared
+	       && (h == NULL
+		   || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
+		   || h->root.type != bfd_link_hash_undefweak)
 	       && ((r_type != R_390_PC16
 		    && r_type != R_390_PC16DBL
 		    && r_type != R_390_PC32

^ permalink raw reply	[flat|nested] 5+ messages in thread
* Re: [PATCH] visibility fixes for s390*.
@ 2003-05-09 15:05 Martin Schwidefsky
  2003-05-09 15:08 ` Daniel Jacobowitz
  0 siblings, 1 reply; 5+ messages in thread
From: Martin Schwidefsky @ 2003-05-09 15:05 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: binutils


> Are you sure this is applicable to the branch?  I believe that none of
> the other changes which required platform-specific modifications went
> to the branch.

Well, I debugged the problem on 2.14.90.0.1. And the problem is there.

blue skies,
   Martin


^ permalink raw reply	[flat|nested] 5+ messages in thread
* Re: [PATCH] visibility fixes for s390*.
@ 2003-05-09 15:11 Martin Schwidefsky
  0 siblings, 0 replies; 5+ messages in thread
From: Martin Schwidefsky @ 2003-05-09 15:11 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: binutils


> Please check any patches you would like added to 2.14 on the actual
> branch.  I think the first two patches from today won't be needed.

Aha. Good that I asked ;-) So the patches go only into CVS head for now.

blue skies,
   Martin


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

end of thread, other threads:[~2003-05-09 15:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-05-09 14:55 [PATCH] visibility fixes for s390* Martin Schwidefsky
2003-05-09 15:01 ` Daniel Jacobowitz
2003-05-09 15:05 Martin Schwidefsky
2003-05-09 15:08 ` Daniel Jacobowitz
2003-05-09 15:11 Martin Schwidefsky

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).