diff options
author | Steve Chamberlain <sac@cygnus> | 1992-01-29 16:43:16 +0000 |
---|---|---|
committer | Steve Chamberlain <sac@cygnus> | 1992-01-29 16:43:16 +0000 |
commit | cbbdbb9f2933a0d6d64faeaa72e6e75b3fa720a3 (patch) | |
tree | 9b693a141b18c7ea2ebad591a6ec8d2020f3e399 /ld/lderror.c | |
parent | 4cc027e126e19853730d7bfefac948e4ff8bdc91 (diff) | |
download | gdb-cbbdbb9f2933a0d6d64faeaa72e6e75b3fa720a3.zip gdb-cbbdbb9f2933a0d6d64faeaa72e6e75b3fa720a3.tar.gz gdb-cbbdbb9f2933a0d6d64faeaa72e6e75b3fa720a3.tar.bz2 |
* config/mh-sparc.h: now uses libgcc.a
* ldmain.c: quit using exit
* *.sc: use *(COMMON) rather than [COMMON]
* ldlex.l, lexsup.c: much thinking moved from .l and put into .c,
to allow preprocessing of .l file.
* Makefile.in: New ldlex.l mangling
* ldexp.c (fold_binary): perform expressions with % and / in
integer.
* ldfile.c (open_a): open archives on VMS in a special way
* lderror.c: forgot to check in from a long while ago
Diffstat (limited to 'ld/lderror.c')
-rw-r--r-- | ld/lderror.c | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/ld/lderror.c b/ld/lderror.c new file mode 100644 index 0000000..30946df --- /dev/null +++ b/ld/lderror.c @@ -0,0 +1,82 @@ +#include "bfd.h" +#include "sysdep.h" +#include "../bfd/seclet.h" +#include "ld.h" + +#define MAX_ERRORS_IN_A_ROW 5 + +extern ld_config_type config; + +extern bfd_error_vector_type bfd_error_vector; + + +/* BFD has failed to link something, give a better error message */ + +static void +DEFUN(ld_undefined_symbol,(relent, seclet), + CONST arelent *relent AND + bfd_seclet_type *seclet) +{ + asymbol *s = *(relent->sym_ptr_ptr); + static asymbol *error_symbol; + static unsigned int error_count; + if (seclet != (bfd_seclet_type *)NULL) + { + + asection *section = seclet->u.indirect.section; + bfd *abfd = section->owner; + + + /* We remember the symbol, and never print more than + a reasonable number of them in a row */ + if (s == error_symbol) { + error_count++; + } + else { + error_count = 0; + error_symbol = s; + } + if (error_count < MAX_ERRORS_IN_A_ROW) { + einfo("%C: undefined reference to `%T'\n", + abfd,section, seclet->u.indirect.symbols, + relent->address, s); + config.make_executable = false; + + } + else if (error_count == MAX_ERRORS_IN_A_ROW) { + einfo("%C: more undefined references to `%T' follow\n", + abfd, section, + seclet->u.indirect.symbols, + relent->address, s); + } + else { + /* Don't print any more */ + } + } + else + { + einfo("undefined reference to %s\n", (*(relent->sym_ptr_ptr))->name); + } +} +static void +DEFUN(ld_reloc_truncated,(relent, seclet), + CONST arelent *relent AND + bfd_seclet_type *seclet) +{ + asymbol *s = *(relent->sym_ptr_ptr); + asection *section = seclet->u.indirect.section; + bfd *abfd = section->owner; + + einfo("%X%C: relocation truncated to fit %R\n", + abfd, section, seclet->u.indirect.symbols, relent->address, relent); + +} + + +void +DEFUN_VOID(init_bfd_error_vector) +{ +bfd_error_vector.undefined_symbol = ld_undefined_symbol; +bfd_error_vector.reloc_value_truncated = ld_reloc_truncated; + +} |