public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] elf32-sh.c: Use SYMBOL_CALLS_LOCAL
@ 2003-07-24 10:51 kaz Kojima
  2003-07-29 15:03 ` Nick Clifton
  0 siblings, 1 reply; 2+ messages in thread
From: kaz Kojima @ 2003-07-24 10:51 UTC (permalink / raw)
  To: binutils

Hi,

Before converting to C90 style, I'd like to check in the attached patch
which makes elf32-sh.c use SYMBOL_CALLS_LOCAL and SYMBOL_REFERENCES_LOCAL.
There are no new regressions on sh4-unknown-linux-gnu.

Regards,
	kaz
--
2003-07-24  Kaz Kojima  <kkojima@rr.iij4u.or.jp>

	* elf32-sh.c (sh_elf_adjust_dynamic_symbol): Use SYMBOL_CALLS_LOCAL.
	(allocate_dynrelocs): Likewise.
	(sh_elf_relocate_section): Likewise. Use SYMBOL_REFERENCES_LOCAL.
	(sh_elf_finish_dynamic_symbol): Use SYMBOL_REFERENCES_LOCAL.

diff -u3prN ORIG/src/bfd/elf32-sh.c LOCAL/src/bfd/elf32-sh.c
--- ORIG/src/bfd/elf32-sh.c	Sat Jul 19 13:06:17 2003
+++ LOCAL/src/bfd/elf32-sh.c	Thu Jul 24 08:55:44 2003
@@ -3915,11 +3915,9 @@ sh_elf_adjust_dynamic_symbol (info, h)
       || (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0)
     {
       if (h->plt.refcount <= 0
-	  || (! info->shared
-	      && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) == 0
-	      && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) == 0
-	      && h->root.type != bfd_link_hash_undefweak
-	      && h->root.type != bfd_link_hash_undefined))
+	  || SYMBOL_CALLS_LOCAL (info, h)
+	  || (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT
+	      && h->root.type == bfd_link_hash_undefweak))
 	{
 	  /* This case can occur if we saw a PLT reloc in an input
 	     file, but the symbol was never referred to by a dynamic
@@ -4224,9 +4222,7 @@ allocate_dynrelocs (h, inf)
 
   if (info->shared)
     {
-      if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0
-	  && ((h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0
-	      || info->symbolic))
+      if (SYMBOL_CALLS_LOCAL (info, h))
 	{
 	  struct elf_sh_dyn_relocs **pp;
 
@@ -4908,11 +4904,7 @@ sh_elf_relocate_section (output_bfd, inf
 	      && r_symndx != 0
 	      && (input_section->flags & SEC_ALLOC) != 0
 	      && (r_type != R_SH_REL32
-		  || (h != NULL
-		      && h->dynindx != -1
-		      && (! info->symbolic
-			  || (h->elf_link_hash_flags
-			      & ELF_LINK_HASH_DEF_REGULAR) == 0))))
+		  || !SYMBOL_CALLS_LOCAL (info, h)))
 	    {
 	      Elf_Internal_Rela outrel;
 	      bfd_byte *loc;
@@ -5071,9 +5063,7 @@ sh_elf_relocate_section (output_bfd, inf
 	      dyn = htab->root.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_FORCED_LOCAL))
-		      && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR))
+		      && SYMBOL_REFERENCES_LOCAL (info, h))
 		  || (ELF_ST_VISIBILITY (h->other)
 		      && h->root.type == bfd_link_hash_undefweak))
 		{
@@ -6963,10 +6953,7 @@ sh_elf_finish_dynamic_symbol (output_bfd
 	 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->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL))
-	  && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR))
+	  && SYMBOL_REFERENCES_LOCAL (info, h))
 	{
 	  rel.r_info = ELF32_R_INFO (0, R_SH_RELATIVE);
 	  rel.r_addend = (h->root.u.def.value
@@ -7014,10 +7001,7 @@ sh_elf_finish_dynamic_symbol (output_bfd
 	   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->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL))
-	    && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR))
+	    && SYMBOL_REFERENCES_LOCAL (info, h))
 	  {
 	    rel.r_info = ELF32_R_INFO (0, R_SH_RELATIVE);
 	    rel.r_addend = (h->root.u.def.value

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

* Re: [PATCH] elf32-sh.c: Use SYMBOL_CALLS_LOCAL
  2003-07-24 10:51 [PATCH] elf32-sh.c: Use SYMBOL_CALLS_LOCAL kaz Kojima
@ 2003-07-29 15:03 ` Nick Clifton
  0 siblings, 0 replies; 2+ messages in thread
From: Nick Clifton @ 2003-07-29 15:03 UTC (permalink / raw)
  To: kaz Kojima; +Cc: binutils

Hi Kaz,

> 2003-07-24  Kaz Kojima  <kkojima@rr.iij4u.or.jp>
>
> 	* elf32-sh.c (sh_elf_adjust_dynamic_symbol): Use SYMBOL_CALLS_LOCAL.
> 	(allocate_dynrelocs): Likewise.
> 	(sh_elf_relocate_section): Likewise. Use SYMBOL_REFERENCES_LOCAL.
> 	(sh_elf_finish_dynamic_symbol): Use SYMBOL_REFERENCES_LOCAL.

Approved - please apply.

Cheers
        Nick
        

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

end of thread, other threads:[~2003-07-29 15:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-07-24 10:51 [PATCH] elf32-sh.c: Use SYMBOL_CALLS_LOCAL kaz Kojima
2003-07-29 15:03 ` Nick Clifton

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