public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Fix R_68K_NONE in .rela.plt
@ 2004-11-07  0:35 Andreas Schwab
  2004-11-07  7:07 ` Alan Modra
  0 siblings, 1 reply; 2+ messages in thread
From: Andreas Schwab @ 2004-11-07  0:35 UTC (permalink / raw)
  To: binutils

This patch fixes elf_m68k_adjust_dynamic_symbol to properly account hidden
symbols, so that we don't generate R_68K_NONE relocations in the .rela.plt
section.

Andreas.

2004-11-07  Andreas Schwab  <schwab@suse.de>

	* elf32-m68k.c (elf_m68k_adjust_dynamic_symbol): Use
	SYMBOL_CALLS_LOCAL and check for undefweak symbols with
	non-default visibility.

--- bfd/elf32-m68k.c	22 Oct 2004 17:33:51 +0200	1.70
+++ bfd/elf32-m68k.c	07 Nov 2004 01:09:33 +0100	
@@ -936,9 +936,10 @@ elf_m68k_adjust_dynamic_symbol (info, h)
   if (h->type == STT_FUNC
       || h->needs_plt)
     {
-      if (! info->shared
-	  && !h->def_dynamic
-	  && !h->ref_dynamic
+      if ((h->plt.refcount <= 0
+	   || SYMBOL_CALLS_LOCAL (info, h)
+	   || (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT
+	       && h->root.type == bfd_link_hash_undefweak))
 	  /* We must always create the plt entry if it was referenced
 	     by a PLTxxO relocation.  In this case we already recorded
 	     it as a dynamic symbol.  */
@@ -946,19 +947,11 @@ elf_m68k_adjust_dynamic_symbol (info, h)
 	{
 	  /* This case can occur if we saw a PLTxx reloc in an input
 	     file, but the symbol was never referred to by a dynamic
-	     object.  In such a case, we don't actually need to build
-	     a procedure linkage table, and we can just do a PCxx
-	     reloc instead.  */
-	  BFD_ASSERT (h->needs_plt);
+	     object, or if all references were garbage collected.  In
+	     such a case, we don't actually need to build a procedure
+	     linkage table, and we can just do a PCxx reloc instead.  */
 	  h->plt.offset = (bfd_vma) -1;
-	  return TRUE;
-	}
-
-      /* GC may have rendered this entry unused.  */
-      if (h->plt.refcount <= 0)
-	{
 	  h->needs_plt = 0;
-	  h->plt.offset = (bfd_vma) -1;
 	  return TRUE;
 	}
 

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

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

* Re: [PATCH] Fix R_68K_NONE in .rela.plt
  2004-11-07  0:35 [PATCH] Fix R_68K_NONE in .rela.plt Andreas Schwab
@ 2004-11-07  7:07 ` Alan Modra
  0 siblings, 0 replies; 2+ messages in thread
From: Alan Modra @ 2004-11-07  7:07 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: binutils

On Sun, Nov 07, 2004 at 01:35:08AM +0100, Andreas Schwab wrote:
> 	* elf32-m68k.c (elf_m68k_adjust_dynamic_symbol): Use
> 	SYMBOL_CALLS_LOCAL and check for undefweak symbols with
> 	non-default visibility.

Looks OK to me.

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre

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

end of thread, other threads:[~2004-11-07  7:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-11-07  0:35 [PATCH] Fix R_68K_NONE in .rela.plt Andreas Schwab
2004-11-07  7:07 ` Alan Modra

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