1991-03-22 05:29:07 +08:00
|
|
|
/* ldsym.h -
|
|
|
|
Copyright (C) 1991 Free Software Foundation, Inc.
|
|
|
|
|
|
|
|
This file is part of GLD, the Gnu Linker.
|
|
|
|
|
1991-10-17 03:39:40 +08:00
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
1991-03-22 05:29:07 +08:00
|
|
|
|
1991-10-17 03:39:40 +08:00
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
1991-03-22 05:29:07 +08:00
|
|
|
|
1991-10-17 03:39:40 +08:00
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
1991-03-22 05:29:07 +08:00
|
|
|
|
|
|
|
typedef struct user_symbol_struct
|
|
|
|
{
|
|
|
|
/* Point to next symbol in this hash chain */
|
|
|
|
struct user_symbol_struct *link;
|
|
|
|
|
|
|
|
/* Name of this symbol. */
|
1991-04-16 00:27:15 +09:00
|
|
|
CONST char *name;
|
1991-03-22 05:29:07 +08:00
|
|
|
|
|
|
|
/* Pointer to next symbol in order of symbol creation */
|
|
|
|
struct user_symbol_struct *next;
|
|
|
|
|
|
|
|
/* Chain of asymbols we see from input files
|
|
|
|
note that we point to the entry in the canonical table of
|
|
|
|
the pointer to the asymbol, *not* the asymbol. This means
|
|
|
|
that we can run back and fix all refs to point to the
|
|
|
|
defs nearly for free.
|
|
|
|
*/
|
|
|
|
asymbol **srefs_chain;
|
|
|
|
asymbol **sdefs_chain;
|
|
|
|
|
|
|
|
/* only ever point to the largest ever common definition -
|
|
|
|
* all the rest are turned into refs
|
|
|
|
* scoms and sdefs are never != NULL at same time
|
|
|
|
*/
|
|
|
|
asymbol **scoms_chain;
|
|
|
|
|
1991-08-02 08:29:23 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* If this symbol is a constructor */
|
|
|
|
#define SYM_CONSTRUCTOR 1
|
|
|
|
/* If this symbol is a warning symbol */
|
|
|
|
#define SYM_WARNING 2
|
|
|
|
/* IF this is an alias for another symbol */
|
|
|
|
#define SYM_INDIRECT 4
|
* Makefile.in (ldexp.o, ldctor.o, ldlang.o, ldmain.o, ldwrite.o, lexsup.o,
mri.o, relax.o): Indicate dependence on ldgram.h.
* ld.h (strip_symbols_type): Add value STRIP_SOME.
* ldgram.y (OPTION_RETAIN_SYMBOLS_FILE): New terminal token.
(lang_add_keepsyms_file): New function.
* ldlex.l: Handle "-retain-symbols-file".
* ldsym.c (keepsyms_file, kept_syms): New vars.
(process_keepsyms): New functihon; reads file, marks symbols for saving.
(write_file_locals): File symbols should always be kept.
(ldsym_write): Warn about "-retain-symbols-file" overriding "-S" and "-s".
Process retain-symbols file before setting symtab.
* ldsym.h (SYM_KEEP): New flag for ldsym_type flags.
(keepsyms_file, kept_syms): Declare them.
* ldmain.c (main): Non-fatal errors should still cause non-zero exit status
even with -r.
1992-09-26 05:05:20 +08:00
|
|
|
/* If this symbol explicitly should be kept, despite discarding
|
|
|
|
most others. */
|
|
|
|
#define SYM_KEEP 8
|
1992-12-08 00:49:54 +08:00
|
|
|
/* If its got -y set */
|
|
|
|
#define SYM_Y 16
|
1991-08-02 08:29:23 +09:00
|
|
|
int flags;
|
1991-03-22 05:29:07 +08:00
|
|
|
} ldsym_type;
|
|
|
|
|
* Makefile.in (ldexp.o, ldctor.o, ldlang.o, ldmain.o, ldwrite.o, lexsup.o,
mri.o, relax.o): Indicate dependence on ldgram.h.
* ld.h (strip_symbols_type): Add value STRIP_SOME.
* ldgram.y (OPTION_RETAIN_SYMBOLS_FILE): New terminal token.
(lang_add_keepsyms_file): New function.
* ldlex.l: Handle "-retain-symbols-file".
* ldsym.c (keepsyms_file, kept_syms): New vars.
(process_keepsyms): New functihon; reads file, marks symbols for saving.
(write_file_locals): File symbols should always be kept.
(ldsym_write): Warn about "-retain-symbols-file" overriding "-S" and "-s".
Process retain-symbols file before setting symtab.
* ldsym.h (SYM_KEEP): New flag for ldsym_type flags.
(keepsyms_file, kept_syms): Declare them.
* ldmain.c (main): Non-fatal errors should still cause non-zero exit status
even with -r.
1992-09-26 05:05:20 +08:00
|
|
|
extern CONST char *keepsyms_file;
|
|
|
|
extern int kept_syms;
|
1991-03-22 05:29:07 +08:00
|
|
|
|
* ldctor.h, lderror.h, ldexp.h, ldfile.h, ldindr.h, ldlang.c,
ldlang.h, ldlex.h, ldmain.h, ldmisc.h, ldsym.h, ldver.h, ldwarn.h,
ldwrite.h, relax.h: Replace all uses of EXFUN and PROTO ansi-glue
macros with PARAMS. Recreational cleanup. Update copyrights.
1992-11-21 19:18:00 +08:00
|
|
|
ldsym_type *ldsym_get PARAMS ((CONST char *));
|
|
|
|
ldsym_type *ldsym_get_soft PARAMS ((CONST char *));
|
|
|
|
void ldsym_print_symbol_table PARAMS ((void));
|
|
|
|
void ldsym_write PARAMS ((void));
|
|
|
|
boolean ldsym_undefined PARAMS ((CONST char *));
|
|
|
|
|
1991-03-22 05:29:07 +08:00
|
|
|
#define FOR_EACH_LDSYM(x) \
|
|
|
|
extern ldsym_type *symbol_head; \
|
|
|
|
ldsym_type *x; \
|
|
|
|
for (x = symbol_head; x != (ldsym_type *)NULL; x = x->next)
|
|
|
|
|
* ldctor.h, lderror.h, ldexp.h, ldfile.h, ldindr.h, ldlang.c,
ldlang.h, ldlex.h, ldmain.h, ldmisc.h, ldsym.h, ldver.h, ldwarn.h,
ldwrite.h, relax.h: Replace all uses of EXFUN and PROTO ansi-glue
macros with PARAMS. Recreational cleanup. Update copyrights.
1992-11-21 19:18:00 +08:00
|
|
|
void ldsym_init PARAMS ((void));
|