1991-10-17 03:39:40 +08:00
|
|
|
/*
|
|
|
|
Copyright (C) 1991 Free Software Foundation, Inc.
|
|
|
|
Written by Steve Chamberlain of Cygnus Support.
|
|
|
|
|
|
|
|
This file is part of GLD, the GNU linker.
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
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-08-02 08:29:03 +09:00
|
|
|
#include "bfd.h"
|
1991-10-11 19:28:27 +08:00
|
|
|
#include "sysdep.h"
|
1991-08-02 08:29:03 +09:00
|
|
|
#include "ldsym.h"
|
1991-10-01 11:51:53 +08:00
|
|
|
#include "ldwarn.h"
|
|
|
|
#include "ldmisc.h"
|
1991-08-02 08:29:03 +09:00
|
|
|
|
|
|
|
/* we keep all the warning symbols in a list, if we ever get a
|
|
|
|
warning, we'll search it the hard way. This won't be to bad since
|
|
|
|
warnings are infrequent, and never that many (true or false ?).
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
typedef struct warning_list_struct {
|
|
|
|
struct warning_list_struct *next;
|
|
|
|
asymbol *sym;
|
|
|
|
} warning_list_type;
|
|
|
|
|
|
|
|
|
|
|
|
static warning_list_type *warning_list;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* This is a warning symbol, add the error text to a list we keep, and mark
|
|
|
|
the symbol referenced as requiring a warning */
|
|
|
|
|
|
|
|
|
|
|
|
void
|
* ldfile.c (ldfile_open_command): Don't try .ld extension.
It wasn't documented (or likely used) and wastes time.
(try_open): If EXTEN is empty, don't try it.
* ldctor.c, lderror.c, ldexp.c, ldfile.c, ldindr.c, ldlang.c,
ldlex.l, ldmain.c, ldmisc.c, ldsym.c, ldver.c, ldwarn.c,
ldwrite.c, lexsup.c, mri.c, relax.c: Replace DEFUN macro calls
with normal function declarations.
* Move *.em to emultempl/*.em. Move *.sh to emulparams/*.sh.
Move *.sc-sh to scripttempl/*.sc.
* {emultempl,emulparams,scripttempl}/README: New files.
* sh.em, st2000.em, z8ksim.em, h8300hms.em, h8500hms.em: Files
removed, replaced with generic.em.
* h8300.sh, h8500.sh, h8300.sc, h8500.sc: Renamed from
h8[35]00hms.s[ch]. Change their contents to omit the "hms".
* *.em (*_get_script): Return script name instead of script contents.
* ldlang.c (lang_process): Change caller.
* ldlex.l, ldgram.y: Recognize -m option.
Check for input files after *all* options in grammar.
* ldmain.c (main): Check for -m options. Add default directory
for -m.
* mkscript.c: File removed.
* genscripts.sh: Take two more parameters, tooldirlib and libdir,
to add to the default LIB_PATH.
Look for input files in the new subdirectories.
Create the scripts in emulations subdirectory and don't filter
them through mkscript.
* configure.in: Make the emulations subdirectory.
* Makefile.in: Account for all of the above changes.
Remove unused .SUFFIXES. Get libgcc.a path with gcc
-print-libgcc-file-name instead of $(libdir)/libgcc.a.
Put CFLAGS last in the compilation rules.
Add -I../bfd to INCLUDES so sysdep.h is found.
* ldfile.c (try_open): If opening without the extension fails,
try with the extension even if -v or -V was given.
had_script is imported (from ldgram.y), not exported.
1993-06-18 04:55:43 +08:00
|
|
|
add_warning (sym)
|
|
|
|
asymbol *sym;
|
1991-08-02 08:29:03 +09:00
|
|
|
{
|
|
|
|
CONST char *name = ((asymbol *)(sym->value))->name;
|
|
|
|
warning_list_type *new;
|
|
|
|
|
|
|
|
ldsym_type *lookup = ldsym_get(name);
|
|
|
|
|
|
|
|
lookup->flags |= SYM_WARNING;
|
|
|
|
|
|
|
|
new = (warning_list_type *)ldmalloc(sizeof(warning_list_type));
|
|
|
|
new->next = warning_list;
|
|
|
|
new->sym = sym;
|
|
|
|
warning_list = new;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* run through the list we kept, and find the warning associated with
|
|
|
|
this symbol */
|
|
|
|
CONST char *
|
* ldfile.c (ldfile_open_command): Don't try .ld extension.
It wasn't documented (or likely used) and wastes time.
(try_open): If EXTEN is empty, don't try it.
* ldctor.c, lderror.c, ldexp.c, ldfile.c, ldindr.c, ldlang.c,
ldlex.l, ldmain.c, ldmisc.c, ldsym.c, ldver.c, ldwarn.c,
ldwrite.c, lexsup.c, mri.c, relax.c: Replace DEFUN macro calls
with normal function declarations.
* Move *.em to emultempl/*.em. Move *.sh to emulparams/*.sh.
Move *.sc-sh to scripttempl/*.sc.
* {emultempl,emulparams,scripttempl}/README: New files.
* sh.em, st2000.em, z8ksim.em, h8300hms.em, h8500hms.em: Files
removed, replaced with generic.em.
* h8300.sh, h8500.sh, h8300.sc, h8500.sc: Renamed from
h8[35]00hms.s[ch]. Change their contents to omit the "hms".
* *.em (*_get_script): Return script name instead of script contents.
* ldlang.c (lang_process): Change caller.
* ldlex.l, ldgram.y: Recognize -m option.
Check for input files after *all* options in grammar.
* ldmain.c (main): Check for -m options. Add default directory
for -m.
* mkscript.c: File removed.
* genscripts.sh: Take two more parameters, tooldirlib and libdir,
to add to the default LIB_PATH.
Look for input files in the new subdirectories.
Create the scripts in emulations subdirectory and don't filter
them through mkscript.
* configure.in: Make the emulations subdirectory.
* Makefile.in: Account for all of the above changes.
Remove unused .SUFFIXES. Get libgcc.a path with gcc
-print-libgcc-file-name instead of $(libdir)/libgcc.a.
Put CFLAGS last in the compilation rules.
Add -I../bfd to INCLUDES so sysdep.h is found.
* ldfile.c (try_open): If opening without the extension fails,
try with the extension even if -v or -V was given.
had_script is imported (from ldgram.y), not exported.
1993-06-18 04:55:43 +08:00
|
|
|
fetch_warning (sym)
|
|
|
|
asymbol *sym;
|
1991-08-02 08:29:03 +09:00
|
|
|
{
|
|
|
|
warning_list_type *ptr = warning_list;
|
|
|
|
while (ptr != (warning_list_type *)NULL) {
|
|
|
|
if (strcmp(((asymbol*)(ptr->sym->value))->name, sym->name) == 0) {
|
|
|
|
return ptr->sym->name;
|
|
|
|
}
|
|
|
|
ptr = ptr->next;
|
|
|
|
}
|
|
|
|
return "This is a warning without a message !";
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
* ldfile.c (ldfile_open_command): Don't try .ld extension.
It wasn't documented (or likely used) and wastes time.
(try_open): If EXTEN is empty, don't try it.
* ldctor.c, lderror.c, ldexp.c, ldfile.c, ldindr.c, ldlang.c,
ldlex.l, ldmain.c, ldmisc.c, ldsym.c, ldver.c, ldwarn.c,
ldwrite.c, lexsup.c, mri.c, relax.c: Replace DEFUN macro calls
with normal function declarations.
* Move *.em to emultempl/*.em. Move *.sh to emulparams/*.sh.
Move *.sc-sh to scripttempl/*.sc.
* {emultempl,emulparams,scripttempl}/README: New files.
* sh.em, st2000.em, z8ksim.em, h8300hms.em, h8500hms.em: Files
removed, replaced with generic.em.
* h8300.sh, h8500.sh, h8300.sc, h8500.sc: Renamed from
h8[35]00hms.s[ch]. Change their contents to omit the "hms".
* *.em (*_get_script): Return script name instead of script contents.
* ldlang.c (lang_process): Change caller.
* ldlex.l, ldgram.y: Recognize -m option.
Check for input files after *all* options in grammar.
* ldmain.c (main): Check for -m options. Add default directory
for -m.
* mkscript.c: File removed.
* genscripts.sh: Take two more parameters, tooldirlib and libdir,
to add to the default LIB_PATH.
Look for input files in the new subdirectories.
Create the scripts in emulations subdirectory and don't filter
them through mkscript.
* configure.in: Make the emulations subdirectory.
* Makefile.in: Account for all of the above changes.
Remove unused .SUFFIXES. Get libgcc.a path with gcc
-print-libgcc-file-name instead of $(libdir)/libgcc.a.
Put CFLAGS last in the compilation rules.
Add -I../bfd to INCLUDES so sysdep.h is found.
* ldfile.c (try_open): If opening without the extension fails,
try with the extension even if -v or -V was given.
had_script is imported (from ldgram.y), not exported.
1993-06-18 04:55:43 +08:00
|
|
|
produce_warnings (lgs, it)
|
|
|
|
ldsym_type *lgs;
|
|
|
|
asymbol *it;
|
1991-08-02 08:29:03 +09:00
|
|
|
{
|
|
|
|
asymbol **ptr;
|
|
|
|
ptr = lgs->srefs_chain;
|
|
|
|
while (ptr != (asymbol **)NULL) {
|
|
|
|
asymbol *ref = *ptr;
|
1992-12-23 07:46:19 +08:00
|
|
|
info("%B: %s\n", bfd_asymbol_bfd(ref), fetch_warning(it));
|
1991-08-02 08:29:03 +09:00
|
|
|
ptr = (asymbol **)(ref->udata);
|
|
|
|
}
|
|
|
|
}
|