This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: Patch: IA64 gas patch to ignore unused symbols
- From: Steve Ellcey <sje at cup dot hp dot com>
- To: binutils at sources dot redhat dot com
- Cc: wilson at specifixinc dot com
- Date: Tue, 10 Feb 2004 11:21:23 -0800 (PST)
- Subject: Re: Patch: IA64 gas patch to ignore unused symbols
> On Fri, 2004-02-06 at 15:24, Steve Ellcey wrote:
> > * 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.
>
> It would be helpful if there were comments explaining what the code
> does, and why those particular symbols are being frobbed.
OK, I put in a function comment for ia64_frob_symbol.
> I think the code should also be enabled only when TE_HPUX. You are
> making assumptions about the meaning of $global$ and $PIC_pcrel$0 which
> are perhaps right for HPUX, but are definitely not right for linux. I
> don't see those symbol names in the binutils or gcc sources. Maybe they
> come from HPUX system header files? Are different HPUX versions going
> to need special treatment for different symbol names? This approach
> could get ugly.
I looked into $global$ and $PIC_pcrel$0 some more and found they are
HPPA specific, you will find them in the HPPA GCC files, so I can get
rid of them entirely for IA64.
> I would have no objections to this if it was HPUX specific, and had the
> usual explanatory function comment.
OK, here is an updated patch. I retested it also. I didn't make the
definition of ia64_frob_symbol HP-UX specific, only its use. I thought
it looked cleaner with fewer ifdef's. I can put the declaration and
definition of ia64_frob_symbol in an ifdef as well if you want.
Steve Ellcey
sje@cup.hp.com
2004-02-10 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 Tue Feb 10 10:57:32 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,127 ----
#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)
+ #ifdef TE_HPUX
+ #define tc_frob_symbol(s,p) p |= ia64_frob_symbol (s)
+ #endif /* TE_HPUX */
#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 Tue Feb 10 10:53:36 2004
--- src/gas/config/tc-ia64.c Tue Feb 10 10:52:04 2004
*************** ia64_frob_label (sym)
*** 7119,7124 ****
--- 7119,7139 ----
}
}
+ /* The HP-UX linker will give unresolved symbol errors for symbols
+ that are declared but unused. This routine removes declared,
+ unused symbols from an object. */
+ 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)))
+ return 1;
+ return 0;
+ }
+
void
ia64_flush_pending_output ()
{