This is the mail archive of the binutils@sourceware.org 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]

[M68K] Update visibility checks for relocation processing


Use SYMBOL_CALLS_LOCAL / SYMBOL_REFERENCES_LOCAL to properly handle
relocations that should be resolved locally.  Calls to protected
functions no longer generate text relocations.

Andreas.

2008-12-04  Andreas Schwab  <schwab@suse.de>

	* elf32-m68k.c (elf_m68k_discard_copies): Use SYMBOL_CALLS_LOCAL.
	(elf_m68k_relocate_section): Use SYMBOL_CALLS_LOCAL and
	SYMBOL_REFERENCES_LOCAL.
	(elf_m68k_relocate_section): Likewise.

--- bfd/elf32-m68k.c	26 Nov 2008 10:48:43 +0100	1.109
+++ bfd/elf32-m68k.c	04 Dez 2008 15:35:22 +0100	
@@ -2980,9 +2980,7 @@ elf_m68k_discard_copies (h, inf)
   if (h->root.type == bfd_link_hash_warning)
     h = (struct elf_link_hash_entry *) h->root.u.i.link;
 
-  if (!h->def_regular
-      || (!info->symbolic
-	  && !h->forced_local))
+  if (!SYMBOL_CALLS_LOCAL (info, h))
     {
       if ((info->flags & DF_TEXTREL) == 0)
 	{
@@ -3205,10 +3203,9 @@ elf_m68k_relocate_section (output_bfd, i
 		dyn = elf_hash_table (info)->dynamic_sections_created;
 		if (!WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, h)
 		    || (info->shared
-			&& (info->symbolic
-			    || h->dynindx == -1
-			    || h->forced_local)
-			&& h->def_regular))
+			&& SYMBOL_REFERENCES_LOCAL (info, h))
+		    || (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
@@ -3348,17 +3345,12 @@ elf_m68k_relocate_section (output_bfd, i
 
 	  break;
 
-	case R_68K_PC8:
-	case R_68K_PC16:
-	case R_68K_PC32:
-	  if (h == NULL
-	      || (info->shared
-		  && h->forced_local))
-	    break;
-	  /* Fall through.  */
 	case R_68K_8:
 	case R_68K_16:
 	case R_68K_32:
+	case R_68K_PC8:
+	case R_68K_PC16:
+	case R_68K_PC32:
 	  if (info->shared
 	      && r_symndx != 0
 	      && (input_section->flags & SEC_ALLOC) != 0
@@ -3368,10 +3360,7 @@ elf_m68k_relocate_section (output_bfd, i
 	      && ((r_type != R_68K_PC8
 		   && r_type != R_68K_PC16
 		   && r_type != R_68K_PC32)
-		  || (h != NULL
-		      && h->dynindx != -1
-		      && (!info->symbolic
-			  || !h->def_regular))))
+		  || !SYMBOL_CALLS_LOCAL (info, h)))
 	    {
 	      Elf_Internal_Rela outrel;
 	      bfd_byte *loc;
@@ -3675,10 +3664,7 @@ elf_m68k_finish_dynamic_symbol (output_b
 	     The entry in the global offset table will already have been
 	     initialized in the relocate_section function.  */
 	  if (info->shared
-	      && (info->symbolic
-		  || h->dynindx == -1
-		  || h->forced_local)
-	      && h->def_regular)
+	      && SYMBOL_REFERENCES_LOCAL (info, h))
 	    {
 	      rela.r_info = ELF32_R_INFO (0, R_68K_RELATIVE);
 	      rela.r_addend = bfd_get_signed_32 (output_bfd,

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


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