]>
Commit | Line | Data |
---|---|---|
cbbdbb9f SC |
1 | #include "bfd.h" |
2 | #include "sysdep.h" | |
3 | #include "../bfd/seclet.h" | |
4 | #include "ld.h" | |
9aa97a39 | 5 | #include "ldmisc.h" |
cbbdbb9f SC |
6 | |
7 | #define MAX_ERRORS_IN_A_ROW 5 | |
8 | ||
9 | extern ld_config_type config; | |
10 | ||
11 | extern bfd_error_vector_type bfd_error_vector; | |
12 | ||
13 | ||
14 | /* BFD has failed to link something, give a better error message */ | |
15 | ||
16 | static void | |
17 | DEFUN(ld_undefined_symbol,(relent, seclet), | |
18 | CONST arelent *relent AND | |
9aa97a39 | 19 | CONST bfd_seclet_type *seclet) |
cbbdbb9f SC |
20 | { |
21 | asymbol *s = *(relent->sym_ptr_ptr); | |
22 | static asymbol *error_symbol; | |
23 | static unsigned int error_count; | |
24 | if (seclet != (bfd_seclet_type *)NULL) | |
25 | { | |
26 | ||
27 | asection *section = seclet->u.indirect.section; | |
28 | bfd *abfd = section->owner; | |
29 | ||
30 | ||
31 | /* We remember the symbol, and never print more than | |
32 | a reasonable number of them in a row */ | |
33 | if (s == error_symbol) { | |
34 | error_count++; | |
35 | } | |
36 | else { | |
37 | error_count = 0; | |
38 | error_symbol = s; | |
39 | } | |
40 | if (error_count < MAX_ERRORS_IN_A_ROW) { | |
ca3c5c63 | 41 | einfo("%X%C: undefined reference to `%T'\n", |
cbbdbb9f SC |
42 | abfd,section, seclet->u.indirect.symbols, |
43 | relent->address, s); | |
44 | config.make_executable = false; | |
45 | ||
46 | } | |
47 | else if (error_count == MAX_ERRORS_IN_A_ROW) { | |
48 | einfo("%C: more undefined references to `%T' follow\n", | |
49 | abfd, section, | |
50 | seclet->u.indirect.symbols, | |
51 | relent->address, s); | |
52 | } | |
53 | else { | |
54 | /* Don't print any more */ | |
55 | } | |
56 | } | |
57 | else | |
58 | { | |
ca3c5c63 | 59 | einfo("%Xundefined reference to %s\n", (*(relent->sym_ptr_ptr))->name); |
cbbdbb9f SC |
60 | } |
61 | } | |
62 | static void | |
63 | DEFUN(ld_reloc_truncated,(relent, seclet), | |
64 | CONST arelent *relent AND | |
65 | bfd_seclet_type *seclet) | |
66 | { | |
67 | asymbol *s = *(relent->sym_ptr_ptr); | |
68 | asection *section = seclet->u.indirect.section; | |
69 | bfd *abfd = section->owner; | |
70 | ||
71 | einfo("%X%C: relocation truncated to fit %R\n", | |
72 | abfd, section, seclet->u.indirect.symbols, relent->address, relent); | |
73 | ||
74 | } | |
75 | ||
76 | ||
77 | void | |
78 | DEFUN_VOID(init_bfd_error_vector) | |
79 | { | |
9aa97a39 SC |
80 | bfd_error_vector.undefined_symbol = ld_undefined_symbol; |
81 | bfd_error_vector.reloc_value_truncated = ld_reloc_truncated; | |
cbbdbb9f | 82 | } |