1 /* Copyright (C) 1991, 1993 Free Software Foundation, Inc.
2 Written by Steve Chamberlain steve@cygnus.com
4 This file is part of GLD, the Gnu Linker.
6 GLD is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
11 GLD is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GLD; see the file COPYING. If not, write to
18 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
22 #include "../bfd/seclet.h"
27 #define MAX_ERRORS_IN_A_ROW 5
29 extern bfd_error_vector_type bfd_error_vector
;
31 static void ld_undefined_symbol
PARAMS ((const arelent
*,
32 const bfd_seclet_type
*));
33 static void ld_reloc_truncated
PARAMS ((const arelent
*,
36 /* BFD has failed to link something, give a better error message */
39 ld_undefined_symbol (relent
, seclet
)
40 CONST arelent
*relent
;
41 CONST bfd_seclet_type
*seclet
;
43 asymbol
*s
= *(relent
->sym_ptr_ptr
);
44 static asymbol
*error_symbol
;
45 static unsigned int error_count
;
46 if (seclet
!= (bfd_seclet_type
*)NULL
)
49 asection
*section
= seclet
->u
.indirect
.section
;
50 bfd
*abfd
= section
->owner
;
53 /* We remember the symbol, and never print more than
54 a reasonable number of them in a row */
55 if (s
== error_symbol
) {
62 if (error_count
< MAX_ERRORS_IN_A_ROW
) {
63 einfo("%X%C: undefined reference to `%T'\n",
64 abfd
,section
, seclet
->u
.indirect
.symbols
,
66 config
.make_executable
= false;
69 else if (error_count
== MAX_ERRORS_IN_A_ROW
) {
70 einfo("%C: more undefined references to `%T' follow\n",
72 seclet
->u
.indirect
.symbols
,
76 /* Don't print any more */
81 einfo("%Xundefined reference to %s\n", (*(relent
->sym_ptr_ptr
))->name
);
86 ld_reloc_truncated (relent
, seclet
)
87 CONST arelent
*relent
;
88 bfd_seclet_type
*seclet
;
90 asection
*section
= seclet
->u
.indirect
.section
;
91 bfd
*abfd
= section
->owner
;
93 einfo("%X%C: relocation truncated to fit %R\n",
94 abfd
, section
, seclet
->u
.indirect
.symbols
, relent
->address
, relent
);
98 init_bfd_error_vector ()
100 bfd_error_vector
.undefined_symbol
= ld_undefined_symbol
;
101 bfd_error_vector
.reloc_value_truncated
= ld_reloc_truncated
;