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]

PATCH: Remove S_IS_EXTERN


On Wed, Apr 20, 2005 at 10:27:49AM +0100, Nick Clifton wrote:
> Hi H. J.
> 
> >>>S_IS_EXTERN just calls S_IS_EXTERNAL. Why does gas need it?
> 
> >>It doesn't.
> >>
> >>In the non BFD_ASSEMBLER case, in obj-coff.h, S_IS_EXTERN and
> >>S_IS_EXTERNAL are not identical.  Specifically, S_IS_EXTERNAL will
> >>return true for a common symbol, and S_IS_EXTERN will not.  This is
> >>almost certainly a bug.
> 
> >Should I submit a patch to remove S_IS_EXTERN?
> 
> Yes please.
> 

Here is the patch.


H.J.
----
2005-04-20  H.J. Lu  <hongjiu.lu@intel.com>

	* config/obj-aout.h (S_IS_EXTERN): Removed.
	* config/obj-bout.h (S_IS_EXTERN): Likewise.
	* config/obj-coff.h (S_IS_EXTERN): Likewise.
	* symbols.c (S_IS_EXTERN): Likewise.
	* symbols.h (S_IS_EXTERN): Likewise.

	* config/tc-alpha.c (tc_gen_reloc): Replace S_IS_EXTERN with
	S_IS_EXTERNAL.
	* config/tc-d10v.c (md_apply_fix3): Likewise.
	* config/tc-ia64.c (ia64_fix_adjustable): Likewise.
	* config/tc-iq2000.c (iq2000_fix_adjustable): Likewise.
	* config/tc-m32r.c (m32r_fix_adjustable): Likewise.
	* config/tc-mmix.c (mmix_adjust_symtab): Likewise.
	* config/tc-sh64.c (shmedia_frob_file_before_adjust): Likewise.
	(shmedia_md_convert_frag): Likewise.
	* symbols.c (print_symbol_value_1): Likewise.
	* write.c (write_object_file): Likewise.

--- gas/config/obj-aout.h.ext	2005-03-26 09:11:48.000000000 -0800
+++ gas/config/obj-aout.h	2005-04-20 07:14:36.000000000 -0700
@@ -127,8 +127,6 @@ extern void obj_aout_frob_file_before_fi
    || (flag_strip_local_absolute			\
        && ! S_IS_EXTERNAL(s)				\
        && S_GET_SEGMENT (s) == absolute_section))
-/* True if a symbol is not defined in this file.  */
-#define S_IS_EXTERN(s)		((s)->sy_symbol.n_type & N_EXT)
 /* True if the symbol has been generated because of a .stabd directive.  */
 #define S_IS_STABD(s)		(S_GET_NAME(s) == NULL)
 
--- gas/config/obj-bout.h.ext	2005-03-26 09:11:48.000000000 -0800
+++ gas/config/obj-bout.h	2005-04-20 07:14:25.000000000 -0700
@@ -197,8 +197,6 @@ struct relocation_info
    || (flag_strip_local_absolute			\
        && !S_IS_EXTERNAL(s)				\
        && S_GET_SEGMENT(s) == absolute_section))
-/* True if a symbol is not defined in this file.  */
-#define S_IS_EXTERN(s)		((s)->sy_symbol.n_type & N_EXT)
 /* True if the symbol has been generated because of a .stabd directive.  */
 #define S_IS_STABD(s)		(S_GET_NAME(s) == NULL)
 
--- gas/config/obj-coff.h.ext	2005-04-19 14:41:26.000000000 -0700
+++ gas/config/obj-coff.h	2005-04-20 07:14:06.000000000 -0700
@@ -502,10 +502,6 @@ typedef struct
        && !S_IS_EXTERNAL (s) \
        && (s)->sy_symbol.ost_entry.n_scnum == C_ABS_SECTION))
 
-/* True if a symbol is not defined in this file.  */
-#define S_IS_EXTERN(s)		((s)->sy_symbol.ost_entry.n_scnum == 0 \
-				 && S_GET_VALUE (s) == 0)
-
 /* True if a symbol can be multiply defined (bss symbols have this def
    though it is bad practice).  */
 #define S_IS_COMMON(s)		((s)->sy_symbol.ost_entry.n_scnum == 0 \
--- gas/config/tc-alpha.c.ext	2005-03-26 09:11:49.000000000 -0800
+++ gas/config/tc-alpha.c	2005-04-20 07:12:24.000000000 -0700
@@ -5637,7 +5637,7 @@ tc_gen_reloc (asection *sec ATTRIBUTE_UN
          symbol, the relocation will entirely be performed at link time, not
          at assembly time.  bfd_perform_reloc doesn't know about this sort
          of thing, and as a result we need to fake it out here.  */
-      if ((S_IS_EXTERN (fixp->fx_addsy) || S_IS_WEAK (fixp->fx_addsy)
+      if ((S_IS_EXTERNAL (fixp->fx_addsy) || S_IS_WEAK (fixp->fx_addsy)
 	   || (S_GET_SEGMENT (fixp->fx_addsy)->flags & SEC_MERGE)
 	   || (S_GET_SEGMENT (fixp->fx_addsy)->flags & SEC_THREAD_LOCAL))
 	  && !S_IS_COMMON (fixp->fx_addsy))
--- gas/config/tc-d10v.c.ext	2005-03-26 09:11:49.000000000 -0800
+++ gas/config/tc-d10v.c	2005-04-20 07:12:17.000000000 -0700
@@ -1572,7 +1572,7 @@ md_apply_fix3 (fixS *fixP, valueT *valP,
 	 symbol, then ignore the offset.
          XXX - Do we have to worry about branches to a symbol + offset ?  */
       if (fixP->fx_addsy != NULL
-	  && S_IS_EXTERN (fixP->fx_addsy) )
+	  && S_IS_EXTERNAL (fixP->fx_addsy) )
         {
           segT fseg = S_GET_SEGMENT (fixP->fx_addsy);
           segment_info_type *segf = seg_info(fseg);
--- gas/config/tc-ia64.c.ext	2005-04-20 07:16:13.000000000 -0700
+++ gas/config/tc-ia64.c	2005-04-20 07:11:49.000000000 -0700
@@ -10844,7 +10838,7 @@ ia64_fix_adjustable (fix)
      fixS *fix;
 {
   /* Prevent all adjustments to global symbols */
-  if (S_IS_EXTERN (fix->fx_addsy) || S_IS_WEAK (fix->fx_addsy))
+  if (S_IS_EXTERNAL (fix->fx_addsy) || S_IS_WEAK (fix->fx_addsy))
     return 0;
 
   switch (fix->fx_r_type)
--- gas/config/tc-iq2000.c.ext	2005-03-14 08:07:55.000000000 -0800
+++ gas/config/tc-iq2000.c	2005-04-20 07:11:36.000000000 -0700
@@ -800,7 +800,7 @@ iq2000_fix_adjustable (fixS * fixP)
     return TRUE;
 
   /* Prevent all adjustments to global symbols.  */
-  if (S_IS_EXTERN (fixP->fx_addsy))
+  if (S_IS_EXTERNAL (fixP->fx_addsy))
     return FALSE;
 
   if (S_IS_WEAK (fixP->fx_addsy))
--- gas/config/tc-m32r.c.ext	2005-03-26 09:11:51.000000000 -0800
+++ gas/config/tc-m32r.c	2005-04-20 07:11:29.000000000 -0700
@@ -2205,7 +2205,7 @@ m32r_fix_adjustable (fixS *fixP)
     return 1;
 
   /* Prevent all adjustments to global symbols.  */
-  if (S_IS_EXTERN (fixP->fx_addsy))
+  if (S_IS_EXTERNAL (fixP->fx_addsy))
     return 0;
   if (S_IS_WEAK (fixP->fx_addsy))
     return 0;
--- gas/config/tc-mmix.c.ext	2005-03-26 09:11:51.000000000 -0800
+++ gas/config/tc-mmix.c	2005-04-20 07:11:02.000000000 -0700
@@ -3309,7 +3309,7 @@ mmix_adjust_symtab (void)
       {
 	if (sym == regsec)
 	  {
-	    if (S_IS_EXTERN (sym) || symbol_used_in_reloc_p (sym))
+	    if (S_IS_EXTERNAL (sym) || symbol_used_in_reloc_p (sym))
 	      abort ();
 	    symbol_remove (sym, &symbol_rootP, &symbol_lastP);
 	  }
--- gas/config/tc-sh64.c.ext	2005-02-24 10:21:38.000000000 -0800
+++ gas/config/tc-sh64.c	2005-04-20 07:10:54.000000000 -0700
@@ -284,7 +284,7 @@ shmedia_frob_file_before_adjust (void)
 
       if (mainsym != NULL
 	  && S_GET_OTHER (mainsym) != STO_SH5_ISA32
-	  && (S_IS_EXTERN (mainsym) || S_IS_WEAK (mainsym)))
+	  && (S_IS_EXTERNAL (mainsym) || S_IS_WEAK (mainsym)))
 	{
 	  symp->sy_value.X_op = O_symbol;
 	  symp->sy_value.X_add_symbol = mainsym;
@@ -823,7 +823,7 @@ shmedia_md_convert_frag (bfd *output_bfd
        || sh_relax
        || symbolP == NULL
        || ! S_IS_DEFINED (symbolP)
-       || S_IS_EXTERN (symbolP)
+       || S_IS_EXTERNAL (symbolP)
        || S_IS_WEAK (symbolP)
        || (S_GET_SEGMENT (fragP->fr_symbol) != absolute_section
 	   && S_GET_SEGMENT (fragP->fr_symbol) != seg));
--- gas/symbols.c.ext	2005-04-19 14:41:25.000000000 -0700
+++ gas/symbols.c	2005-04-20 07:10:37.000000000 -0700
@@ -1823,12 +1823,6 @@ S_IS_LOCAL (symbolS *s)
 }
 
 int
-S_IS_EXTERN (symbolS *s)
-{
-  return S_IS_EXTERNAL (s);
-}
-
-int
 S_IS_STABD (symbolS *s)
 {
   return S_GET_NAME (s) == 0;
@@ -2405,7 +2399,7 @@ print_symbol_value_1 (FILE *file, symbol
 	fprintf (file, " used");
       if (S_IS_LOCAL (sym))
 	fprintf (file, " local");
-      if (S_IS_EXTERN (sym))
+      if (S_IS_EXTERNAL (sym))
 	fprintf (file, " extern");
       if (S_IS_DEBUG (sym))
 	fprintf (file, " debug");
--- gas/symbols.h.ext	2005-04-19 14:41:25.000000000 -0700
+++ gas/symbols.h	2005-04-20 07:10:01.000000000 -0700
@@ -98,7 +98,6 @@ extern int S_IS_DEFINED (symbolS *);
 extern int S_FORCE_RELOC (symbolS *, int);
 extern int S_IS_DEBUG (symbolS *);
 extern int S_IS_LOCAL (symbolS *);
-extern int S_IS_EXTERN (symbolS *);
 extern int S_IS_STABD (symbolS *);
 extern const char *S_GET_NAME (symbolS *);
 extern segT S_GET_SEGMENT (symbolS *);
--- gas/write.c.ext	2005-03-14 08:07:51.000000000 -0800
+++ gas/write.c	2005-04-20 07:10:16.000000000 -0700
@@ -1956,10 +1956,10 @@ write_object_file (void)
 	  if (symp == abs_section_sym
 	      || (! EMIT_SECTION_SYMBOLS
 		  && symbol_section_p (symp))
-	      /* Note that S_IS_EXTERN and S_IS_LOCAL are not always
+	      /* Note that S_IS_EXTERNAL and S_IS_LOCAL are not always
 		 opposites.  Sometimes the former checks flags and the
 		 latter examines the name...  */
-	      || (!S_IS_EXTERN (symp)
+	      || (!S_IS_EXTERNAL (symp)
 		  && (punt || S_IS_LOCAL (symp))
 		  && ! symbol_used_in_reloc_p (symp)))
 	    {


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