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: IA64 gas patch to ignore unused symbols


I would like to copy a change that HPPA gas has into the IA64 gas.  The
HP linker is very fussy about having any symbol that is declared, even
if it is never used, be defined.  GCC is very bad about declaring and
then never using or defining symbols.  This patch will allow gas to drop
those symbols so the linker doesn't see them.

IA64 GCC currently has another mechanism for handling this situation
right now that doesn't inolve gas but it fails in the presense of
pre-compiled headers so I would like to put this change into gas so that
I can handle IA64 GCC in the same manner as HPPA GCC.

I tested this with the gas and gcc testsuites on Linux and HP-UX with
no regressions.

Steve Ellcey
sje@cup.hp.com


2004-02-06  Steve Ellcey  <sje@cup.hp.com>

	* gas/config/tc-ia64.h (ia64_frob_symbol): New routine.
	(tc_frob_symbol): New macro definition.
	* gas/config/tc-ia64.c (ia64_frob_symbol): New routine.


*** src.orig/gas/config/tc-ia64.h	Fri Feb  6 15:09:14 2004
--- src/gas/config/tc-ia64.h	Fri Feb  6 15:09:36 2004
*************** extern void ia64_end_of_source PARAMS((v
*** 91,96 ****
--- 91,97 ----
  extern void ia64_start_line PARAMS((void));
  extern int ia64_unrecognized_line PARAMS((int ch));
  extern void ia64_frob_label PARAMS((struct symbol *sym));
+ extern int ia64_frob_symbol PARAMS((struct symbol *sym));
  extern void ia64_flush_pending_output PARAMS((void));
  extern int ia64_parse_name (char *name, expressionS *e);
  extern int ia64_optimize_expr PARAMS((expressionS *l, operatorT op,
*************** extern void ia64_convert_frag (fragS *);
*** 118,123 ****
--- 119,125 ----
  #define md_start_line_hook()		ia64_start_line ()
  #define tc_unrecognized_line(ch)	ia64_unrecognized_line (ch)
  #define tc_frob_label(s)		ia64_frob_label (s)
+ #define tc_frob_symbol(s,p)		p |= ia64_frob_symbol (s)
  #define md_flush_pending_output()	ia64_flush_pending_output ()
  #define md_parse_name(s,e,c)		ia64_parse_name (s, e)
  #define tc_canonicalize_symbol_name(s)	ia64_canonicalize_symbol_name (s)
*** src.orig/gas/config/tc-ia64.c	Fri Feb  6 15:09:14 2004
--- src/gas/config/tc-ia64.c	Fri Feb  6 15:09:35 2004
*************** ia64_frob_label (sym)
*** 7117,7122 ****
--- 7117,7136 ----
      }
  }
  
+ int
+ ia64_frob_symbol (sym)
+      struct symbol *sym;
+ {
+   if ((S_GET_SEGMENT (sym) == &bfd_und_section && ! symbol_used_p (sym) &&
+        ELF_ST_VISIBILITY (S_GET_OTHER (sym)) == STV_DEFAULT)
+       || (S_GET_SEGMENT (sym) == &bfd_abs_section
+ 	  && ! S_IS_EXTERNAL (sym))
+       || strcmp (S_GET_NAME (sym), "$global$") == 0
+       || strcmp (S_GET_NAME (sym), "$PIC_pcrel$0") == 0)
+     return 1;
+   return 0;
+ }
+ 
  void
  ia64_flush_pending_output ()
  {


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