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]

ELF/m68k backend fixes


This fixes a bug in handling symbols that are forced local through
.hidden.

Andreas.

2003-03-22  Andreas Schwab  <schwab at suse dot de>

	* elf32-m68k.c (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define.
	(elf_m68k_relocate_section): Use it to correctly handle symbols
	forced to be local.
	(elf_m68k_finish_dynamic_symbol): Emit RELATIVE reloc for got
	entries for symbols that are forced to be local.
	
--- bfd/elf32-m68k.c.~1.52.~	2003-02-24 10:05:59.000000000 +0100
+++ bfd/elf32-m68k.c	2003-03-17 23:06:51.000000000 +0100
@@ -1097,6 +1097,17 @@ elf_m68k_adjust_dynamic_symbol (info, h)
   return TRUE;
 }
 
+/* This is the condition under which elf_m68k_finish_dynamic_symbol
+   will be called from elflink.h.  If elflink.h doesn't call our
+   finish_dynamic_symbol routine, we'll need to do something about
+   initializing any .plt and .got entries in elf_m68k_relocate_section.  */
+#define WILL_CALL_FINISH_DYNAMIC_SYMBOL(DYN, SHARED, H) \
+  ((DYN)								\
+   && ((SHARED)								\
+       || ((H)->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)	\
+   && ((H)->dynindx != -1						\
+       || ((H)->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0))
+
 /* Set the sizes of the dynamic sections.  */
 
 static bfd_boolean
@@ -1416,9 +1427,14 @@ elf_m68k_relocate_section (output_bfd, i
 			    || r_type == R_68K_GOT32)
 			   && strcmp (h->root.root.string,
 				      "_GLOBAL_OFFSET_TABLE_") != 0))
-		      && elf_hash_table (info)->dynamic_sections_created
+		      && (WILL_CALL_FINISH_DYNAMIC_SYMBOL
+			  (elf_hash_table (info)->dynamic_sections_created,
+			   info->shared, h))
 		      && (! info->shared
-			  || (! info->symbolic && h->dynindx != -1)
+			  || (! info->symbolic
+			      && h->dynindx != -1
+			      && (h->elf_link_hash_flags
+				  & ELF_LINK_FORCED_LOCAL) == 0)
 			  || (h->elf_link_hash_flags
 			      & ELF_LINK_HASH_DEF_REGULAR) == 0))
 		  || (info->shared
@@ -1496,13 +1512,18 @@ elf_m68k_relocate_section (output_bfd, i
 
 	    if (h != NULL)
 	      {
+		bfd_boolean dyn;
+
 		off = h->got.offset;
 		BFD_ASSERT (off != (bfd_vma) -1);
 
-		if (!elf_hash_table (info)->dynamic_sections_created
+		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->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR)))
+			&& (info->symbolic
+			    || h->dynindx == -1
+			    || (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0)
+			&& (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR)) != 0)
 		  {
 		    /* This is actually a static link, or it is a
 		       -Bsymbolic link and the symbol is defined
@@ -1940,7 +1961,9 @@ 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)
+	  && (info->symbolic
+	      || h->dynindx == -1
+	      || (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0)
 	  && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR))
 	{
 	  rela.r_info = ELF32_R_INFO (0, R_68K_RELATIVE);

-- 
Andreas Schwab, SuSE Labs, schwab at suse dot de
SuSE Linux AG, Deutschherrnstr. 15-19, D-90429 Nürnberg
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]