darling-gdb/ld/lderror.c
David MacKenzie 8ddef5528d * 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-17 20:55:43 +00:00

83 lines
1.9 KiB
C

#include "bfd.h"
#include "sysdep.h"
#include "../bfd/seclet.h"
#include "ld.h"
#include "ldmisc.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
ld_undefined_symbol (relent, seclet)
CONST arelent *relent;
CONST 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("%X%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("%Xundefined reference to %s\n", (*(relent->sym_ptr_ptr))->name);
}
}
static void
ld_reloc_truncated (relent, seclet)
CONST arelent *relent;
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
init_bfd_error_vector ()
{
bfd_error_vector.undefined_symbol = ld_undefined_symbol;
bfd_error_vector.reloc_value_truncated = ld_reloc_truncated;
}