* ldmain.c (reloc_overflow): Added name, reloc_name and addend
[platform/upstream/binutils.git] / ld / ldmain.c
1 /* Copyright (C) 1991, 1993 Free Software Foundation, Inc.
2    Written by Steve Chamberlain steve@cygnus.com
3
4 This file is part of GLD, the Gnu Linker.
5
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)
9 any later version.
10
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.
15
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.  */
19
20
21 #include "bfd.h"
22 #include "sysdep.h"
23 #include <stdio.h>
24 #include "bfdlink.h"
25
26 #include "config.h"
27 #include "ld.h"
28 #include "ldmain.h"
29 #include "ldmisc.h"
30 #include "ldwrite.h"
31 #include "ldgram.h"
32 #include "ldexp.h"
33 #include "ldlang.h"
34 #include "ldemul.h"
35 #include "ldlex.h"
36 #include "ldfile.h"
37 #include "ldctor.h"
38
39 /* Somewhere above, sys/stat.h got included . . . . */
40 #if !defined(S_ISDIR) && defined(S_IFDIR)
41 #define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
42 #endif
43
44 #include <string.h>
45
46 static char *get_emulation PARAMS ((int, char **));
47 static void set_scripts_dir PARAMS ((void));
48
49 /* EXPORTS */
50
51 char *default_target;
52 const char *output_filename = "a.out";
53
54 /* Name this program was invoked by.  */
55 char *program_name;
56
57 /* The file that we're creating */
58 bfd *output_bfd = 0;
59
60 /* Set by -G argument, for MIPS ECOFF target.  */
61 int g_switch_value = 8;
62
63 /* Nonzero means print names of input files as processed.  */
64 boolean trace_files;
65
66 /* Nonzero means same, but note open failures, too.  */
67 boolean trace_file_tries;
68
69 /* 1 => write load map.  */
70 boolean write_map;
71
72 args_type command_line;
73
74 ld_config_type config;
75
76 static boolean check_for_scripts_dir PARAMS ((char *dir));
77 static boolean add_archive_element PARAMS ((struct bfd_link_info *, bfd *,
78                                             const char *));
79 static boolean multiple_definition PARAMS ((struct bfd_link_info *,
80                                             const char *,
81                                             bfd *, asection *, bfd_vma,
82                                             bfd *, asection *, bfd_vma));
83 static boolean multiple_common PARAMS ((struct bfd_link_info *,
84                                         const char *, bfd *,
85                                         enum bfd_link_hash_type, bfd_vma,
86                                         bfd *, enum bfd_link_hash_type,
87                                         bfd_vma));
88 static boolean add_to_set PARAMS ((struct bfd_link_info *,
89                                    struct bfd_link_hash_entry *,
90                                    unsigned int bitsize,
91                                    bfd *, asection *, bfd_vma));
92 static boolean constructor_callback PARAMS ((struct bfd_link_info *,
93                                              boolean constructor,
94                                              unsigned int bitsize,
95                                              const char *name,
96                                              bfd *, asection *, bfd_vma));
97 static boolean warning_callback PARAMS ((struct bfd_link_info *,
98                                          const char *));
99 static boolean undefined_symbol PARAMS ((struct bfd_link_info *,
100                                          const char *, bfd *,
101                                          asection *, bfd_vma));
102 static boolean reloc_overflow PARAMS ((struct bfd_link_info *, const char *,
103                                        const char *, bfd_vma,
104                                        bfd *, asection *, bfd_vma));
105 static boolean reloc_dangerous PARAMS ((struct bfd_link_info *, const char *,
106                                         bfd *, asection *, bfd_vma));
107 static boolean unattached_reloc PARAMS ((struct bfd_link_info *,
108                                          const char *, bfd *, asection *,
109                                          bfd_vma));
110 static boolean notice_ysym PARAMS ((struct bfd_link_info *, const char *,
111                                     bfd *, asection *, bfd_vma));
112
113 static struct bfd_link_callbacks link_callbacks =
114 {
115   add_archive_element,
116   multiple_definition,
117   multiple_common,
118   add_to_set,
119   constructor_callback,
120   warning_callback,
121   undefined_symbol,
122   reloc_overflow,
123   reloc_dangerous,
124   unattached_reloc,
125   notice_ysym
126 };
127
128 struct bfd_link_info link_info;
129 \f
130 extern int main PARAMS ((int, char **));
131
132 int
133 main (argc, argv)
134      int argc;
135      char **argv;
136 {
137   char *emulation;
138
139   program_name = argv[0];
140
141   bfd_init ();
142
143   /* Initialize the data about options.  */
144   trace_files = trace_file_tries = false;
145   write_map = false;
146   config.build_constructors = true;
147   command_line.force_common_definition = false;
148
149   link_info.callbacks = &link_callbacks;
150   link_info.relocateable = false;
151   link_info.strip = strip_none;
152   link_info.discard = discard_none;
153   link_info.lprefix_len = 1;
154   link_info.lprefix = "L";
155   link_info.keep_memory = true;
156   link_info.input_bfds = NULL;
157   link_info.create_object_symbols_section = NULL;
158   link_info.hash = NULL;
159   link_info.keep_hash = NULL;
160   link_info.notice_hash = NULL;
161
162   ldfile_add_arch ("");
163
164   config.make_executable = true;
165   force_make_executable = false;
166   config.magic_demand_paged = true;
167   config.text_read_only = true;
168   config.make_executable = true;
169
170   emulation = get_emulation (argc, argv);
171   ldemul_choose_mode (emulation);
172   default_target = ldemul_choose_target ();
173   lang_init ();
174   ldemul_before_parse ();
175   lang_has_input_file = false;
176   parse_args (argc, argv);
177
178   /* This essentially adds another -L directory so this must be done after
179      the -L's in argv have been processed.  */
180   set_scripts_dir ();
181
182   if (had_script == false)
183     {
184       /* Read the emulation's appropriate default script.  */
185       int isfile;
186       char *s = ldemul_get_script (&isfile);
187
188       if (isfile)
189         {
190           /* sizeof counts the terminating NUL.  */
191           size_t size = strlen (s) + sizeof ("-T ");
192           char *buf = (char *) ldmalloc(size);
193           sprintf (buf, "-T %s", s);
194           parse_line (buf, 0);
195           free (buf);
196         }
197       else
198         parse_line (s, 1);
199     }
200
201   if (link_info.relocateable && command_line.relax)
202     {
203       einfo ("%P%F: -relax and -r may not be used together\n");
204     }
205   lang_final ();
206
207   if (lang_has_input_file == false)
208     {
209       einfo ("%P%F: no input files\n");
210     }
211
212   if (trace_files)
213     {
214       info_msg ("%P: mode %s\n", emulation);
215     }
216
217   ldemul_after_parse ();
218
219
220   if (config.map_filename)
221     {
222       if (strcmp (config.map_filename, "-") == 0)
223         {
224           config.map_file = stdout;
225         }
226       else
227         {
228           config.map_file = fopen (config.map_filename, FOPEN_WT);
229           if (config.map_file == (FILE *) NULL)
230             {
231               einfo ("%P%F: cannot open map file %s: %E\n",
232                      config.map_filename);
233             }
234         }
235     }
236
237
238   lang_process ();
239
240   /* Print error messages for any missing symbols, for any warning
241      symbols, and possibly multiple definitions */
242
243
244   if (config.text_read_only)
245     {
246       /* Look for a text section and mark the readonly attribute in it */
247       asection *found = bfd_get_section_by_name (output_bfd, ".text");
248
249       if (found != (asection *) NULL)
250         {
251           found->flags |= SEC_READONLY;
252         }
253     }
254
255   if (link_info.relocateable)
256     output_bfd->flags &= ~EXEC_P;
257   else
258     output_bfd->flags |= EXEC_P;
259
260   ldwrite ();
261
262   /* Even if we're producing relocateable output, some non-fatal errors should
263      be reported in the exit status.  (What non-fatal errors, if any, do we
264      want to ignore for relocateable output?)  */
265
266   if (config.make_executable == false && force_make_executable == false)
267     {
268       if (trace_files == true)
269         {
270           einfo ("%P: link errors found, deleting executable `%s'\n",
271                  output_filename);
272         }
273
274       if (output_bfd->iostream)
275         fclose ((FILE *) (output_bfd->iostream));
276
277       unlink (output_filename);
278       exit (1);
279     }
280   else
281     {
282       bfd_close (output_bfd);
283     }
284
285   if (config.stats)
286     {
287       extern char **environ;
288       char *lim = (char *) sbrk (0);
289
290       fprintf (stderr, "%s: data size %ld\n", program_name,
291                (long) (lim - (char *) &environ));
292     }
293
294   exit (0);
295   return 0;
296 }
297
298 /* We need to find any explicitly given emulation in order to initialize the
299    state that's needed by the lex&yacc argument parser (parse_args).  */
300
301 static char *
302 get_emulation (argc, argv)
303      int argc;
304      char **argv;
305 {
306   char *emulation;
307   int i;
308
309   emulation = (char *) getenv (EMULATION_ENVIRON);
310   if (emulation == NULL)
311     emulation = DEFAULT_EMULATION;
312
313   for (i = 1; i < argc; i++)
314     {
315       if (!strncmp (argv[i], "-m", 2))
316         {
317           if (argv[i][2] == '\0')
318             {
319               /* -m EMUL */
320               if (i < argc - 1)
321                 {
322                   emulation = argv[i + 1];
323                   i++;
324                 }
325               else
326                 {
327                   einfo("%P%F: missing argument to -m\n");
328                 }
329             }
330           else if (strcmp (argv[i], "-mips1") == 0
331                    || strcmp (argv[i], "-mips2") == 0
332                    || strcmp (argv[i], "-mips3") == 0)
333             {
334               /* FIXME: The arguments -mips1, -mips2 and -mips3 are
335                  passed to the linker by some MIPS compilers.  They
336                  generally tell the linker to use a slightly different
337                  library path.  Perhaps someday these should be
338                  implemented as emulations; until then, we just ignore
339                  the arguments and hope that nobody ever creates
340                  emulations named ips1, ips2 or ips3.  */
341             }
342           else
343             {
344               /* -mEMUL */
345               emulation = &argv[i][2];
346             }
347         }
348     }
349
350   return emulation;
351 }
352
353 /* If directory DIR contains an "ldscripts" subdirectory,
354    add DIR to the library search path and return true,
355    else return false.  */
356
357 static boolean
358 check_for_scripts_dir (dir)
359      char *dir;
360 {
361   size_t dirlen;
362   char *buf;
363   struct stat s;
364   boolean res;
365
366   dirlen = strlen (dir);
367   /* sizeof counts the terminating NUL.  */
368   buf = (char *) ldmalloc (dirlen + sizeof("/ldscripts"));
369   sprintf (buf, "%s/ldscripts", dir);
370
371   res = stat (buf, &s) == 0 && S_ISDIR (s.st_mode);
372   free (buf);
373   if (res)
374     ldfile_add_library_path (dir);
375   return res;
376 }
377
378 /* Set the default directory for finding script files.
379    Libraries will be searched for here too, but that's ok.
380    We look for the "ldscripts" directory in:
381
382    SCRIPTDIR (passed from Makefile)
383    the dir where this program is (for using it from the build tree)
384    the dir where this program is/../lib (for installing the tool suite elsewhere) */
385
386 static void
387 set_scripts_dir ()
388 {
389   char *end, *dir;
390   size_t dirlen;
391
392   if (check_for_scripts_dir (SCRIPTDIR))
393     return;                     /* We've been installed normally.  */
394
395   /* Look for "ldscripts" in the dir where our binary is.  */
396   end = strrchr (program_name, '/');
397   if (end)
398     {
399       dirlen = end - program_name;
400       /* Make a copy of program_name in dir.
401          Leave room for later "/../lib".  */
402       dir = (char *) ldmalloc (dirlen + 8);
403       strncpy (dir, program_name, dirlen);
404       dir[dirlen] = '\0';
405     }
406   else
407     {
408       dirlen = 1;
409       dir = (char *) ldmalloc (dirlen + 8);
410       strcpy (dir, ".");
411     }
412
413   if (check_for_scripts_dir (dir))
414     return;                     /* Don't free dir.  */
415
416   /* Look for "ldscripts" in <the dir where our binary is>/../lib.  */
417   strcpy (dir + dirlen, "/../lib");
418   if (check_for_scripts_dir (dir))
419     return;
420
421   free (dir);                   /* Well, we tried.  */
422 }
423
424 void
425 add_ysym (name)
426      const char *name;
427 {
428   if (link_info.notice_hash == (struct bfd_hash_table *) NULL)
429     {
430       link_info.notice_hash = ((struct bfd_hash_table *)
431                                ldmalloc (sizeof (struct bfd_hash_table)));
432       if (! bfd_hash_table_init_n (link_info.notice_hash,
433                                    bfd_hash_newfunc,
434                                    61))
435         einfo ("%P%F: bfd_hash_table_init failed: %E\n");
436     }      
437
438   if (bfd_hash_lookup (link_info.notice_hash, name, true, true)
439       == (struct bfd_hash_entry *) NULL)
440     einfo ("%P%F: bfd_hash_lookup failed: %E\n");
441 }
442
443 /* Handle the -retain-symbols-file option.  */
444
445 void
446 add_keepsyms_file (filename)
447      const char *filename;
448 {
449   FILE *file;
450   char *buf;
451   size_t bufsize;
452   int c;
453
454   if (link_info.strip == strip_some)
455     einfo ("%X%P: error: duplicate retain-symbols-file\n");
456
457   file = fopen (filename, "r");
458   if (file == (FILE *) NULL)
459     {
460       bfd_error = system_call_error;
461       einfo ("%X%P: %s: %E", filename);
462       return;
463     }
464
465   link_info.keep_hash = ((struct bfd_hash_table *)
466                          ldmalloc (sizeof (struct bfd_hash_table)));
467   if (! bfd_hash_table_init (link_info.keep_hash, bfd_hash_newfunc))
468     einfo ("%P%F: bfd_hash_table_init failed: %E\n");
469
470   bufsize = 100;
471   buf = (char *) ldmalloc (bufsize);
472
473   c = getc (file);
474   while (c != EOF)
475     {
476       while (isspace (c))
477         c = getc (file);
478
479       if (c != EOF)
480         {
481           size_t len = 0;
482
483           while (! isspace (c) && c != EOF)
484             {
485               buf[len] = c;
486               ++len;
487               if (len >= bufsize)
488                 {
489                   bufsize *= 2;
490                   buf = ldrealloc (buf, bufsize);
491                 }
492               c = getc (file);
493             }
494
495           buf[len] = '\0';
496
497           if (bfd_hash_lookup (link_info.keep_hash, buf, true, true)
498               == (struct bfd_hash_entry *) NULL)
499             einfo ("%P%F: bfd_hash_lookup for insertion failed: %E");
500         }
501     }
502
503   if (link_info.strip != strip_none)
504     einfo ("%P: `-retain-symbols-file' overrides `-s' and `-S'\n");
505
506   link_info.strip = strip_some;
507 }
508 \f
509 /* Callbacks from the BFD linker routines.  */
510
511 /* This is called when BFD has decided to include an archive member in
512    a link.  */
513
514 /*ARGSUSED*/
515 static boolean
516 add_archive_element (info, abfd, name)
517      struct bfd_link_info *info;
518      bfd *abfd;
519      const char *name;
520 {
521   lang_input_statement_type *input;
522
523   input = ((lang_input_statement_type *)
524            ldmalloc ((bfd_size_type) sizeof (lang_input_statement_type)));
525   input->filename = abfd->filename;
526   input->local_sym_name = abfd->filename;
527   input->the_bfd = abfd;
528   input->asymbols = NULL;
529   input->subfiles = NULL;
530   input->next = NULL;
531   input->just_syms_flag = false;
532   input->loaded = false;
533   input->chain = NULL;
534
535   /* FIXME: This is wrong.  It should point to an entry for the
536      archive itself.  However, it doesn't seem to matter.  */
537   input->superfile = NULL;
538
539   /* FIXME: The following fields are not set: header.next,
540      header.type, closed, passive_position, symbol_count, total_size,
541      next_real_file, is_archive, search_dirs_flag, target, real,
542      common_section, common_output_section, complained.  This bit of
543      code is from the old decode_library_subfile function.  I don't
544      know whether any of those fields matters.  */
545
546   ldlang_add_file (input);
547
548   if (write_map)
549     info_msg ("%s needed due to %T\n", abfd->filename, name);
550
551   if (trace_files || trace_file_tries)
552     info_msg ("%I\n", input);
553
554   return true;
555 }
556
557 /* This is called when BFD has discovered a symbol which is defined
558    multiple times.  */
559
560 /*ARGSUSED*/
561 static boolean
562 multiple_definition (info, name, obfd, osec, oval, nbfd, nsec, nval)
563      struct bfd_link_info *info;
564      const char *name;
565      bfd *obfd;
566      asection *osec;
567      bfd_vma oval;
568      bfd *nbfd;
569      asection *nsec;
570      bfd_vma nval;
571 {
572   einfo ("%X%C: multiple definition of `%T'\n",
573          nbfd, nsec, nval, name);
574   if (obfd != (bfd *) NULL)
575     einfo ("%C: first defined here\n", obfd, osec, oval);
576   return true;
577 }
578
579 /* This is called when there is a definition of a common symbol, or
580    when a common symbol is found for a symbol that is already defined,
581    or when two common symbols are found.  We only do something if
582    -warn-common was used.  */
583
584 /*ARGSUSED*/
585 static boolean
586 multiple_common (info, name, obfd, otype, osize, nbfd, ntype, nsize)
587      struct bfd_link_info *info;
588      const char *name;
589      bfd *obfd;
590      enum bfd_link_hash_type otype;
591      bfd_vma osize;
592      bfd *nbfd;
593      enum bfd_link_hash_type ntype;
594      bfd_vma nsize;
595 {
596   if (! config.warn_common)
597     return true;
598
599   if (ntype == bfd_link_hash_defined)
600     {
601       ASSERT (otype == bfd_link_hash_common);
602       einfo ("%B: warning: definition of `%T' overriding common\n",
603              nbfd, name);
604       einfo ("%B: warning: common is here\n", obfd);
605     }
606   else if (otype == bfd_link_hash_defined)
607     {
608       ASSERT (ntype == bfd_link_hash_common);
609       einfo ("%B: warning: common of `%T' overridden by definition\n",
610              nbfd, name);
611       einfo ("%B: warning: defined here\n", obfd);
612     }
613   else
614     {
615       ASSERT (otype == bfd_link_hash_common && ntype == bfd_link_hash_common);
616       if (osize > nsize)
617         {
618           einfo ("%B: warning: common of `%T' overridden by larger common\n",
619                  nbfd, name);
620           einfo ("%B: warning: larger common is here\n", obfd);
621         }
622       else if (nsize > osize)
623         {
624           einfo ("%B: warning: common of `%T' overriding smaller common\n",
625                  nbfd, name);
626           einfo ("%B: warning: smaller common is here\n", obfd);
627         }
628       else
629         {
630           einfo ("%B: warning: multiple common of `%T'\n", nbfd, name);
631           einfo ("%B: warning: previous common is here\n", obfd);
632         }
633     }
634
635   return true;
636 }
637
638 /* This is called when BFD has discovered a set element.  H is the
639    entry in the linker hash table for the set.  SECTION and VALUE
640    represent a value which should be added to the set.  */
641
642 /*ARGSUSED*/
643 static boolean
644 add_to_set (info, h, bitsize, abfd, section, value)
645      struct bfd_link_info *info;
646      struct bfd_link_hash_entry *h;
647      unsigned int bitsize;
648      bfd *abfd;
649      asection *section;
650      bfd_vma value;
651 {
652   ldctor_add_set_entry (h, bitsize, section, value);
653   return true;
654 }
655
656 /* This is called when BFD has discovered a constructor.  This is only
657    called for some object file formats--those which do not handle
658    constructors in some more clever fashion.  This is similar to
659    adding an element to a set, but less general.  */
660
661 static boolean
662 constructor_callback (info, constructor, bitsize, name, abfd, section, value)
663      struct bfd_link_info *info;
664      boolean constructor;
665      unsigned int bitsize;
666      const char *name;
667      bfd *abfd;
668      asection *section;
669      bfd_vma value;
670 {
671   char *set_name;
672   char *s;
673   struct bfd_link_hash_entry *h;
674
675   if (! config.build_constructors)
676     return true;
677
678   set_name = (char *) alloca (1 + sizeof "__CTOR_LIST__");
679   s = set_name;
680   if (bfd_get_symbol_leading_char (abfd) != '\0')
681     *s++ = bfd_get_symbol_leading_char (abfd);
682   if (constructor)
683     strcpy (s, "__CTOR_LIST__");
684   else
685     strcpy (s, "__DTOR_LIST__");
686
687   if (write_map)
688     info_msg ("Adding %s to constructor/destructor set %s\n", name, set_name);
689
690   h = bfd_link_hash_lookup (info->hash, set_name, true, true, true);
691   if (h == (struct bfd_link_hash_entry *) NULL)
692     einfo ("%P%F: bfd_link_hash_lookup failed: %E");
693   if (h->type == bfd_link_hash_new)
694     {
695       h->type = bfd_link_hash_undefined;
696       h->u.undef.abfd = abfd;
697       /* We don't call bfd_link_add_undef to add this to the list of
698          undefined symbols because we are going to define it
699          ourselves.  */
700     }
701
702   ldctor_add_set_entry (h, bitsize, section, value);
703   return true;
704 }
705
706 /* This is called when there is a reference to a warning symbol.  */
707
708 /*ARGSUSED*/
709 static boolean
710 warning_callback (info, warning)
711      struct bfd_link_info *info;
712      const char *warning;
713 {
714   einfo ("%P: %s\n", warning);
715   return true;
716 }
717
718 /* This is called when an undefined symbol is found.  */
719
720 /*ARGSUSED*/
721 static boolean
722 undefined_symbol (info, name, abfd, section, address)
723      struct bfd_link_info *info;
724      const char *name;
725      bfd *abfd;
726      asection *section;
727      bfd_vma address;
728 {
729   static char *error_name;
730   static unsigned int error_count;
731
732 #define MAX_ERRORS_IN_A_ROW 5
733
734   /* We never print more than a reasonable number of errors in a row
735      for a single symbol.  */
736   if (error_name != (char *) NULL
737       && strcmp (name, error_name) == 0)
738     ++error_count;
739   else
740     {
741       error_count = 0;
742       if (error_name != (char *) NULL)
743         free (error_name);
744       error_name = buystring (name);
745     }
746
747   if (error_count < MAX_ERRORS_IN_A_ROW)
748     einfo ("%X%C: undefined reference to `%T'\n",
749            abfd, section, address, name);
750   else if (error_count == MAX_ERRORS_IN_A_ROW)
751     einfo ("%C: more undefined references to `%T' follow\n",
752            abfd, section, address, name);
753
754   return true;
755 }
756
757 /* This is called when a reloc overflows.  */
758
759 /*ARGSUSED*/
760 static boolean
761 reloc_overflow (info, name, reloc_name, addend, abfd, section, address)
762      struct bfd_link_info *info;
763      const char *name;
764      const char *reloc_name;
765      bfd_vma addend;
766      bfd *abfd;
767      asection *section;
768      bfd_vma address;
769 {
770   einfo ("%X%C: relocation truncated to fit: %s %T", abfd, section,
771          address, reloc_name, name);
772   if (addend != 0)
773     einfo ("+%v", addend);
774   einfo ("\n");
775   return true;
776 }
777
778 /* This is called when a dangerous relocation is made.  */
779
780 /*ARGSUSED*/
781 static boolean
782 reloc_dangerous (info, message, abfd, section, address)
783      struct bfd_link_info *info;
784      const char *message;
785      bfd *abfd;
786      asection *section;
787      bfd_vma address;
788 {
789   einfo ("%X%C: dangerous relocation: %s\n", abfd, section, address, message);
790   return true;
791 }
792
793 /* This is called when a reloc is being generated attached to a symbol
794    that is not being output.  */
795
796 /*ARGSUSED*/
797 static boolean
798 unattached_reloc (info, name, abfd, section, address)
799      struct bfd_link_info *info;
800      const char *name;
801      bfd *abfd;
802      asection *section;
803      bfd_vma address;
804 {
805   einfo ("%X%C: reloc refers to symbol `%T' which is not being output\n",
806          abfd, section, address, name);
807   return true;
808 }
809
810 /* This is called when a symbol in notice_hash is found.  Symbols are
811    put in notice_hash using the -y option.  */
812
813 /*ARGSUSED*/
814 static boolean
815 notice_ysym (info, name, abfd, section, value)
816      struct bfd_link_info *info;
817      const char *name;
818      bfd *abfd;
819      asection *section;
820      bfd_vma value;
821 {
822   einfo ("%B: %s %s\n", abfd,
823          section != &bfd_und_section ? "definition of" : "reference to",
824          name);
825   return true;
826 }