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