Changeset 609 for branches/GNU/src/binutils/ld/ldmain.c
- Timestamp:
- Aug 16, 2003, 6:59:22 PM (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/GNU/src/binutils/ld/ldmain.c
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.1.1.2
r608 r609 1 1 /* Main program of GNU linker. 2 Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000 2 Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 3 2002, 2003 3 4 Free Software Foundation, Inc. 4 5 Written by Steve Chamberlain steve@cygnus.com 5 6 6 This file is part of GLD, the Gnu Linker.7 8 GLD is free software; you can redistribute it and/or modify9 it under the terms of the GNU General Public License as published by10 the Free Software Foundation; either version 2, or (at your option)11 any later version.12 13 GLD is distributed in the hope that it will be useful,14 but WITHOUT ANY WARRANTY; without even the implied warranty of15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the16 GNU General Public License for more details.17 18 You should have received a copy of the GNU General Public License19 along with GLD; see the file COPYING. If not, write to the Free20 Software Foundation, 59 Temple Place - Suite 330, Boston, MA21 02111-1307, USA. */7 This file is part of GLD, the Gnu Linker. 8 9 GLD is free software; you can redistribute it and/or modify 10 it under the terms of the GNU General Public License as published by 11 the Free Software Foundation; either version 2, or (at your option) 12 any later version. 13 14 GLD is distributed in the hope that it will be useful, 15 but WITHOUT ANY WARRANTY; without even the implied warranty of 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 GNU General Public License for more details. 18 19 You should have received a copy of the GNU General Public License 20 along with GLD; see the file COPYING. If not, write to the Free 21 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 22 02111-1307, USA. */ 22 23 23 24 #include "bfd.h" 24 25 #include "sysdep.h" 25 26 #include <stdio.h> 26 #include <ctype.h>27 #include "safe-ctype.h" 27 28 #include "libiberty.h" 28 29 #include "progress.h" … … 34 35 #include "ldmisc.h" 35 36 #include "ldwrite.h" 36 #include "ldgram.h"37 37 #include "ldexp.h" 38 38 #include "ldlang.h" 39 #include <ldgram.h> 39 40 #include "ldlex.h" 40 41 #include "ldfile.h" … … 42 43 #include "ldctor.h" 43 44 44 /* Somewhere above, sys/stat.h got included . . .. */45 /* Somewhere above, sys/stat.h got included. */ 45 46 #if !defined(S_ISDIR) && defined(S_IFDIR) 46 47 #define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) … … 55 56 #endif 56 57 57 static char *get_emulation PARAMS ((int, char **)); 58 static void set_scripts_dir PARAMS ((void)); 58 #ifndef TARGET_SYSTEM_ROOT 59 #define TARGET_SYSTEM_ROOT "" 60 #endif 61 62 int main PARAMS ((int, char **)); 59 63 60 64 /* EXPORTS */ … … 66 70 char *program_name; 67 71 72 /* The prefix for system library directories. */ 73 char *ld_sysroot; 74 75 /* The canonical representation of ld_sysroot. */ 76 char * ld_canon_sysroot; 77 int ld_canon_sysroot_len; 78 68 79 /* The file that we're creating. */ 69 80 bfd *output_bfd = 0; … … 73 84 74 85 /* Nonzero means print names of input files as processed. */ 75 b oolean trace_files;86 bfd_boolean trace_files; 76 87 77 88 /* Nonzero means same, but note open failures, too. */ 78 b oolean trace_file_tries;89 bfd_boolean trace_file_tries; 79 90 80 91 /* Nonzero means version number was printed, so exit successfully 81 92 instead of complaining if no input files are given. */ 82 b oolean version_printed;93 bfd_boolean version_printed; 83 94 84 95 /* Nonzero means link in every member of an archive. */ 85 b oolean whole_archive;86 87 /* T rueif we should demangle symbol names. */88 b oolean demangling;96 bfd_boolean whole_archive; 97 98 /* TRUE if we should demangle symbol names. */ 99 bfd_boolean demangling; 89 100 90 101 args_type command_line; … … 92 103 ld_config_type config; 93 104 94 static void remove_output PARAMS ((void)); 95 static boolean check_for_scripts_dir PARAMS ((char *dir)); 96 static boolean add_archive_element PARAMS ((struct bfd_link_info *, bfd *, 97 const char *)); 98 static boolean multiple_definition PARAMS ((struct bfd_link_info *, 99 const char *, 100 bfd *, asection *, bfd_vma, 101 bfd *, asection *, bfd_vma)); 102 static boolean multiple_common PARAMS ((struct bfd_link_info *, 103 const char *, bfd *, 104 enum bfd_link_hash_type, bfd_vma, 105 bfd *, enum bfd_link_hash_type, 106 bfd_vma)); 107 static boolean add_to_set PARAMS ((struct bfd_link_info *, 108 struct bfd_link_hash_entry *, 109 bfd_reloc_code_real_type, 110 bfd *, asection *, bfd_vma)); 111 static boolean constructor_callback PARAMS ((struct bfd_link_info *, 112 boolean constructor, 113 const char *name, 114 bfd *, asection *, bfd_vma)); 115 static boolean warning_callback PARAMS ((struct bfd_link_info *, 116 const char *, const char *, bfd *, 117 asection *, bfd_vma)); 118 static void warning_find_reloc PARAMS ((bfd *, asection *, PTR)); 119 static boolean undefined_symbol PARAMS ((struct bfd_link_info *, 120 const char *, bfd *, 121 asection *, bfd_vma, boolean)); 122 static boolean reloc_overflow PARAMS ((struct bfd_link_info *, const char *, 123 const char *, bfd_vma, 124 bfd *, asection *, bfd_vma)); 125 static boolean reloc_dangerous PARAMS ((struct bfd_link_info *, const char *, 126 bfd *, asection *, bfd_vma)); 127 static boolean unattached_reloc PARAMS ((struct bfd_link_info *, 128 const char *, bfd *, asection *, 129 bfd_vma)); 130 static boolean notice PARAMS ((struct bfd_link_info *, const char *, 131 bfd *, asection *, bfd_vma)); 132 133 static struct bfd_link_callbacks link_callbacks = { 105 static char *get_emulation 106 PARAMS ((int, char **)); 107 static void set_scripts_dir 108 PARAMS ((void)); 109 static void remove_output 110 PARAMS ((void)); 111 static bfd_boolean check_for_scripts_dir 112 PARAMS ((char *)); 113 static bfd_boolean add_archive_element 114 PARAMS ((struct bfd_link_info *, bfd *, const char *)); 115 static bfd_boolean multiple_definition 116 PARAMS ((struct bfd_link_info *, const char *, bfd *, asection *, bfd_vma, 117 bfd *, asection *, bfd_vma)); 118 static bfd_boolean multiple_common 119 PARAMS ((struct bfd_link_info *, const char *, bfd *, 120 enum bfd_link_hash_type, bfd_vma, bfd *, enum bfd_link_hash_type, 121 bfd_vma)); 122 static bfd_boolean add_to_set 123 PARAMS ((struct bfd_link_info *, struct bfd_link_hash_entry *, 124 bfd_reloc_code_real_type, bfd *, asection *, bfd_vma)); 125 static bfd_boolean constructor_callback 126 PARAMS ((struct bfd_link_info *, bfd_boolean, const char *, bfd *, 127 asection *, bfd_vma)); 128 static bfd_boolean warning_callback 129 PARAMS ((struct bfd_link_info *, const char *, const char *, bfd *, 130 asection *, bfd_vma)); 131 static void warning_find_reloc 132 PARAMS ((bfd *, asection *, PTR)); 133 static bfd_boolean undefined_symbol 134 PARAMS ((struct bfd_link_info *, const char *, bfd *, asection *, bfd_vma, 135 bfd_boolean)); 136 static bfd_boolean reloc_overflow 137 PARAMS ((struct bfd_link_info *, const char *, const char *, bfd_vma, 138 bfd *, asection *, bfd_vma)); 139 static bfd_boolean reloc_dangerous 140 PARAMS ((struct bfd_link_info *, const char *, bfd *, asection *, bfd_vma)); 141 static bfd_boolean unattached_reloc 142 PARAMS ((struct bfd_link_info *, const char *, bfd *, asection *, bfd_vma)); 143 static bfd_boolean notice 144 PARAMS ((struct bfd_link_info *, const char *, bfd *, asection *, bfd_vma)); 145 146 static struct bfd_link_callbacks link_callbacks = 147 { 134 148 add_archive_element, 135 149 multiple_definition, … … 142 156 reloc_dangerous, 143 157 unattached_reloc, 144 notice 158 notice, 159 error_handler 145 160 }; 146 161 … … 171 186 setlocale (LC_MESSAGES, ""); 172 187 #endif 188 #if defined (HAVE_SETLOCALE) 189 setlocale (LC_CTYPE, ""); 190 #endif 173 191 bindtextdomain (PACKAGE, LOCALEDIR); 174 192 textdomain (PACKAGE); … … 184 202 185 203 xatexit (remove_output); 204 205 #ifdef TARGET_SYSTEM_ROOT_RELOCATABLE 206 ld_sysroot = make_relative_prefix (program_name, BINDIR, 207 TARGET_SYSTEM_ROOT); 208 209 if (ld_sysroot) 210 { 211 struct stat s; 212 int res = stat (ld_sysroot, &s) == 0 && S_ISDIR (s.st_mode); 213 214 if (!res) 215 { 216 free (ld_sysroot); 217 ld_sysroot = NULL; 218 } 219 } 220 221 if (! ld_sysroot) 222 { 223 ld_sysroot = make_relative_prefix (program_name, TOOLBINDIR, 224 TARGET_SYSTEM_ROOT); 225 226 if (ld_sysroot) 227 { 228 struct stat s; 229 int res = stat (ld_sysroot, &s) == 0 && S_ISDIR (s.st_mode); 230 231 if (!res) 232 { 233 free (ld_sysroot); 234 ld_sysroot = NULL; 235 } 236 } 237 } 238 239 if (! ld_sysroot) 240 #endif 241 ld_sysroot = TARGET_SYSTEM_ROOT; 242 243 if (ld_sysroot && *ld_sysroot) 244 ld_canon_sysroot = lrealpath (ld_sysroot); 245 246 if (ld_canon_sysroot) 247 ld_canon_sysroot_len = strlen (ld_canon_sysroot); 248 else 249 ld_canon_sysroot_len = -1; 186 250 187 251 /* Set the default BFD target based on the configured target. Doing … … 195 259 } 196 260 261 #if YYDEBUG 262 { 263 extern int yydebug; 264 yydebug = 1; 265 } 266 #endif 267 197 268 /* Initialize the data about options. */ 198 trace_files = trace_file_tries = version_printed = false;199 whole_archive = false;200 config.build_constructors = true;201 config.dynamic_link = false;202 config.has_shared = false;269 trace_files = trace_file_tries = version_printed = FALSE; 270 whole_archive = FALSE; 271 config.build_constructors = TRUE; 272 config.dynamic_link = FALSE; 273 config.has_shared = FALSE; 203 274 config.split_by_reloc = (unsigned) -1; 204 275 config.split_by_file = (bfd_size_type) -1; 205 command_line.force_common_definition = false; 276 command_line.force_common_definition = FALSE; 277 command_line.inhibit_common_definition = FALSE; 206 278 command_line.interpreter = NULL; 207 279 command_line.rpath = NULL; 208 command_line.warn_mismatch = true; 209 command_line.check_section_addresses = true; 280 command_line.warn_mismatch = TRUE; 281 command_line.check_section_addresses = TRUE; 282 command_line.accept_unknown_input_arch = FALSE; 210 283 211 284 /* We initialize DEMANGLING based on the environment variable … … 216 289 demangling = getenv ("COLLECT_NO_DEMANGLE") == NULL; 217 290 291 link_info.relocateable = FALSE; 292 link_info.emitrelocations = FALSE; 293 link_info.task_link = FALSE; 294 link_info.shared = FALSE; 295 link_info.symbolic = FALSE; 296 link_info.export_dynamic = FALSE; 297 link_info.static_link = FALSE; 298 link_info.traditional_format = FALSE; 299 link_info.optimize = FALSE; 300 link_info.no_undefined = FALSE; 301 link_info.allow_shlib_undefined = TRUE; 302 link_info.allow_multiple_definition = FALSE; 303 link_info.allow_undefined_version = TRUE; 304 link_info.keep_memory = TRUE; 305 link_info.notice_all = FALSE; 306 link_info.nocopyreloc = FALSE; 307 link_info.new_dtags = FALSE; 308 link_info.combreloc = TRUE; 309 link_info.eh_frame_hdr = FALSE; 310 link_info.strip_discarded = TRUE; 311 link_info.strip = strip_none; 312 link_info.discard = discard_sec_merge; 313 link_info.common_skip_ar_aymbols = bfd_link_common_skip_none; 218 314 link_info.callbacks = &link_callbacks; 219 link_info.relocateable = false; 220 link_info.emitrelocations = false; 221 link_info.shared = false; 222 link_info.symbolic = false; 223 link_info.static_link = false; 224 link_info.traditional_format = false; 225 link_info.optimize = false; 226 link_info.no_undefined = false; 227 link_info.allow_shlib_undefined = false; 228 link_info.strip = strip_none; 229 link_info.discard = discard_none; 230 link_info.keep_memory = true; 315 link_info.hash = NULL; 316 link_info.keep_hash = NULL; 317 link_info.notice_hash = NULL; 318 link_info.wrap_hash = NULL; 231 319 link_info.input_bfds = NULL; 232 320 link_info.create_object_symbols_section = NULL; 233 link_info.hash = NULL; 234 link_info.keep_hash = NULL; 235 link_info.notice_all = false; 236 link_info.notice_hash = NULL; 237 link_info.wrap_hash = NULL; 238 link_info.mpc860c0 = 0; 321 link_info.gc_sym_list = NULL; 322 link_info.base_file = NULL; 239 323 /* SVR4 linkers seem to set DT_INIT and DT_FINI based on magic _init 240 324 and _fini symbols. We are compatible. */ 241 325 link_info.init_function = "_init"; 242 326 link_info.fini_function = "_fini"; 243 link_info.new_dtags = false; 327 link_info.mpc860c0 = 0; 328 link_info.pei386_auto_import = -1; 329 link_info.pei386_runtime_pseudo_reloc = FALSE; 330 link_info.spare_dynamic_tags = 5; 244 331 link_info.flags = (bfd_vma) 0; 245 332 link_info.flags_1 = (bfd_vma) 0; 333 link_info.relax_finalizing = FALSE; 246 334 247 335 ldfile_add_arch (""); 248 336 249 config.make_executable = true;250 force_make_executable = false;251 config.magic_demand_paged = true;252 config.text_read_only = true;337 config.make_executable = TRUE; 338 force_make_executable = FALSE; 339 config.magic_demand_paged = TRUE; 340 config.text_read_only = TRUE; 253 341 254 342 emulation = get_emulation (argc, argv); 255 343 ldemul_choose_mode (emulation); 256 default_target = ldemul_choose_target ( );344 default_target = ldemul_choose_target (argc, argv); 257 345 lang_init (); 258 346 ldemul_before_parse (); 259 lang_has_input_file = false;347 lang_has_input_file = FALSE; 260 348 parse_args (argc, argv); 261 349 … … 274 362 } 275 363 364 if (! link_info.shared) 365 { 366 if (command_line.filter_shlib) 367 einfo (_("%P%F: -F may not be used without -shared\n")); 368 if (command_line.auxiliary_filters) 369 einfo (_("%P%F: -f may not be used without -shared\n")); 370 } 371 276 372 /* Treat ld -r -s as ld -r -S -x (i.e., strip all local symbols). I 277 373 don't see how else this can be handled, since in this case we … … 280 376 { 281 377 link_info.strip = strip_debugger; 282 if (link_info.discard == discard_ none)378 if (link_info.discard == discard_sec_merge) 283 379 link_info.discard = discard_all; 284 380 } … … 288 384 set_scripts_dir (); 289 385 290 if (had_script == false) 291 { 292 /* Read the emulation's appropriate default script. */ 386 /* If we have not already opened and parsed a linker script 387 read the emulation's appropriate default script. */ 388 if (saved_script_handle == NULL) 389 { 293 390 int isfile; 294 391 char *s = ldemul_get_script (&isfile); … … 298 395 else 299 396 { 300 if (trace_file_tries)301 {302 info_msg (_("using internal linker script:\n"));303 info_msg ("==================================================\n");304 info_msg (s);305 info_msg ("\n==================================================\n");306 }307 397 lex_string = s; 308 398 lex_redirect (s); … … 313 403 } 314 404 405 if (trace_file_tries) 406 { 407 if (saved_script_handle) 408 info_msg (_("using external linker script:")); 409 else 410 info_msg (_("using internal linker script:")); 411 info_msg ("\n==================================================\n"); 412 413 if (saved_script_handle) 414 { 415 static const int ld_bufsz = 8193; 416 size_t n; 417 char *buf = xmalloc (ld_bufsz); 418 419 rewind (saved_script_handle); 420 while ((n = fread (buf, 1, ld_bufsz - 1, saved_script_handle)) > 0) 421 { 422 buf[n] = 0; 423 info_msg (buf); 424 } 425 rewind (saved_script_handle); 426 free (buf); 427 } 428 else 429 { 430 int isfile; 431 432 info_msg (ldemul_get_script (&isfile)); 433 } 434 435 info_msg ("\n==================================================\n"); 436 } 437 315 438 lang_final (); 316 439 317 if ( lang_has_input_file == false)440 if (!lang_has_input_file) 318 441 { 319 442 if (version_printed) … … 323 446 324 447 if (trace_files) 325 { 326 info_msg (_("%P: mode %s\n"), emulation); 327 } 448 info_msg (_("%P: mode %s\n"), emulation); 328 449 329 450 ldemul_after_parse (); … … 351 472 /* Print error messages for any missing symbols, for any warning 352 473 symbols, and possibly multiple definitions. */ 353 354 if (! link_info.relocateable)355 {356 /* Look for a text section and switch the readonly attribute in it. */357 asection *found = bfd_get_section_by_name (output_bfd, ".text");358 359 if (found != (asection *) NULL)360 {361 if (config.text_read_only)362 found->flags |= SEC_READONLY;363 else364 found->flags &= ~SEC_READONLY;365 }366 }367 368 474 if (link_info.relocateable) 369 475 output_bfd->flags &= ~EXEC_P; … … 383 489 be reported in the exit status. (What non-fatal errors, if any, do we 384 490 want to ignore for relocateable output?) */ 385 386 if (config.make_executable == false && force_make_executable == false) 387 { 388 if (trace_files == true) 389 { 390 einfo (_("%P: link errors found, deleting executable `%s'\n"), 391 output_filename); 392 } 491 if (!config.make_executable && !force_make_executable) 492 { 493 if (trace_files) 494 einfo (_("%P: link errors found, deleting executable `%s'\n"), 495 output_filename); 393 496 394 497 /* The file will be removed by remove_output. */ 395 396 498 xexit (1); 397 499 } … … 407 509 { 408 510 int len = strlen (output_filename); 511 409 512 if (len < 4 410 513 || (strcasecmp (output_filename + len - 4, ".exe") != 0 … … 417 520 int l; 418 521 char *dst_name = xmalloc (len + 5); 522 419 523 strcpy (dst_name, output_filename); 420 524 strcat (dst_name, ".exe"); … … 429 533 { 430 534 int done = fwrite (buf, 1, l, dst); 535 431 536 if (done != l) 432 { 433 einfo (_("%P: Error writing file `%s'\n"), dst_name); 434 } 537 einfo (_("%P: Error writing file `%s'\n"), dst_name); 435 538 } 539 436 540 fclose (src); 437 541 if (fclose (dst) == EOF) 438 { 439 einfo (_("%P: Error closing file `%s'\n"), dst_name); 440 } 542 einfo (_("%P: Error closing file `%s'\n"), dst_name); 441 543 free (dst_name); 442 544 free (buf); … … 497 599 } 498 600 else 499 { 500 einfo (_("%P%F: missing argument to -m\n")); 501 } 601 einfo (_("%P%F: missing argument to -m\n")); 502 602 } 503 603 else if (strcmp (argv[i], "-mips1") == 0 504 604 || strcmp (argv[i], "-mips2") == 0 505 605 || strcmp (argv[i], "-mips3") == 0 506 || strcmp (argv[i], "-mips4") == 0) 606 || strcmp (argv[i], "-mips4") == 0 607 || strcmp (argv[i], "-mips5") == 0 608 || strcmp (argv[i], "-mips32") == 0 609 || strcmp (argv[i], "-mips32r2") == 0 610 || strcmp (argv[i], "-mips64") == 0) 507 611 { 508 /* FIXME: The arguments -mips1, -mips2 and -mips3are612 /* FIXME: The arguments -mips1, -mips2, -mips3, etc. are 509 613 passed to the linker by some MIPS compilers. They 510 614 generally tell the linker to use a slightly different … … 532 636 533 637 /* If directory DIR contains an "ldscripts" subdirectory, 534 add DIR to the library search path and return true,535 else return false. */536 537 static b oolean638 add DIR to the library search path and return TRUE, 639 else return FALSE. */ 640 641 static bfd_boolean 538 642 check_for_scripts_dir (dir) 539 643 char *dir; … … 542 646 char *buf; 543 647 struct stat s; 544 b oolean res;648 bfd_boolean res; 545 649 546 650 dirlen = strlen (dir); … … 552 656 free (buf); 553 657 if (res) 554 ldfile_add_library_path (dir, false);658 ldfile_add_library_path (dir, FALSE); 555 659 return res; 556 660 } … … 561 665 562 666 SCRIPTDIR (passed from Makefile) 667 (adjusted according to the current location of the binary) 668 SCRIPTDIR (passed from Makefile) 563 669 the dir where this program is (for using it from the build tree) 564 the dir where this program is/../lib (for installing the tool suite elsewhere) */ 670 the dir where this program is/../lib 671 (for installing the tool suite elsewhere). */ 565 672 566 673 static void … … 569 676 char *end, *dir; 570 677 size_t dirlen; 678 bfd_boolean found; 679 680 dir = make_relative_prefix (program_name, BINDIR, SCRIPTDIR); 681 if (dir) 682 { 683 found = check_for_scripts_dir (dir); 684 free (dir); 685 if (found) 686 return; 687 } 688 689 dir = make_relative_prefix (program_name, TOOLBINDIR, SCRIPTDIR); 690 if (dir) 691 { 692 found = check_for_scripts_dir (dir); 693 free (dir); 694 if (found) 695 return; 696 } 571 697 572 698 if (check_for_scripts_dir (SCRIPTDIR)) … … 580 706 /* We could have \foo\bar, or /foo\bar. */ 581 707 char *bslash = strrchr (program_name, '\\'); 708 582 709 if (end == NULL || (bslash != NULL && bslash > end)) 583 710 end = bslash; … … 586 713 587 714 if (end == NULL) 588 { 589 /* Don't look for ldscripts in the current directory. There is 590 too much potential for confusion. */ 591 return; 592 } 715 /* Don't look for ldscripts in the current directory. There is 716 too much potential for confusion. */ 717 return; 593 718 594 719 dirlen = end - program_name; … … 600 725 601 726 if (check_for_scripts_dir (dir)) 602 /* Don't free dir. */ 603 return; 727 { 728 free (dir); 729 return; 730 } 604 731 605 732 /* Look for "ldscripts" in <the dir where our binary is>/../lib. */ 606 733 strcpy (dir + dirlen, "/../lib"); 607 if (check_for_scripts_dir (dir)) 608 return; 609 610 /* Well, we tried. */ 734 check_for_scripts_dir (dir); 611 735 free (dir); 612 736 } … … 626 750 } 627 751 628 if (bfd_hash_lookup (link_info.notice_hash, name, true, true)752 if (bfd_hash_lookup (link_info.notice_hash, name, TRUE, TRUE) 629 753 == (struct bfd_hash_entry *) NULL) 630 754 einfo (_("%P%F: bfd_hash_lookup failed: %E\n")); … … 646 770 einfo (_("%P%F: bfd_hash_table_init failed: %E\n")); 647 771 } 648 if (bfd_hash_lookup (link_info.wrap_hash, name, true, true) == NULL) 772 773 if (bfd_hash_lookup (link_info.wrap_hash, name, TRUE, TRUE) == NULL) 649 774 einfo (_("%P%F: bfd_hash_lookup failed: %E\n")); 650 775 } … … 683 808 while (c != EOF) 684 809 { 685 while ( isspace(c))810 while (ISSPACE (c)) 686 811 c = getc (file); 687 812 … … 690 815 size_t len = 0; 691 816 692 while (! isspace(c) && c != EOF)817 while (! ISSPACE (c) && c != EOF) 693 818 { 694 819 buf[len] = c; … … 704 829 buf[len] = '\0'; 705 830 706 if (bfd_hash_lookup (link_info.keep_hash, buf, true, true)831 if (bfd_hash_lookup (link_info.keep_hash, buf, TRUE, TRUE) 707 832 == (struct bfd_hash_entry *) NULL) 708 833 einfo (_("%P%F: bfd_hash_lookup for insertion failed: %E\n")); … … 713 838 einfo (_("%P: `-retain-symbols-file' overrides `-s' and `-S'\n")); 714 839 840 free (buf); 715 841 link_info.strip = strip_some; 716 842 } … … 722 848 a link. */ 723 849 724 static b oolean850 static bfd_boolean 725 851 add_archive_element (info, abfd, name) 726 852 struct bfd_link_info *info ATTRIBUTE_UNUSED; … … 737 863 input->asymbols = NULL; 738 864 input->next = NULL; 739 input->just_syms_flag = false;740 input->loaded = false;741 input->search_dirs_flag = false;865 input->just_syms_flag = FALSE; 866 input->loaded = FALSE; 867 input->search_dirs_flag = FALSE; 742 868 743 869 /* FIXME: The following fields are not set: header.next, … … 751 877 if (config.map_file != (FILE *) NULL) 752 878 { 753 static b oolean header_printed;879 static bfd_boolean header_printed; 754 880 struct bfd_link_hash_entry *h; 755 881 bfd *from; 756 882 int len; 757 883 758 h = bfd_link_hash_lookup (link_info.hash, name, false, false, true);884 h = bfd_link_hash_lookup (link_info.hash, name, FALSE, FALSE, TRUE); 759 885 760 886 if (h == NULL) … … 788 914 char buf[100]; 789 915 790 sprintf (buf, "%-29s %s\n\n", _("Archive member included"), 791 _("because of file (symbol)")); 916 sprintf (buf, _("Archive member included because of file (symbol)\n\n")); 792 917 minfo ("%s", buf); 793 header_printed = true;918 header_printed = TRUE; 794 919 } 795 920 … … 830 955 info_msg ("%I\n", input); 831 956 832 return true;957 return TRUE; 833 958 } 834 959 … … 836 961 multiple times. */ 837 962 838 static b oolean963 static bfd_boolean 839 964 multiple_definition (info, name, obfd, osec, oval, nbfd, nsec, nval) 840 965 struct bfd_link_info *info ATTRIBUTE_UNUSED; … … 858 983 && ! bfd_is_abs_section (nsec) 859 984 && bfd_is_abs_section (nsec->output_section))) 860 return true;985 return TRUE; 861 986 862 987 einfo (_("%X%C: multiple definition of `%T'\n"), … … 871 996 } 872 997 873 return true;998 return TRUE; 874 999 } 875 1000 … … 879 1004 -warn-common was used. */ 880 1005 881 static b oolean1006 static bfd_boolean 882 1007 multiple_common (info, name, obfd, otype, osize, nbfd, ntype, nsize) 883 1008 struct bfd_link_info *info ATTRIBUTE_UNUSED; … … 891 1016 { 892 1017 if (! config.warn_common) 893 return true;1018 return TRUE; 894 1019 895 1020 if (ntype == bfd_link_hash_defined … … 938 1063 } 939 1064 940 return true;1065 return TRUE; 941 1066 } 942 1067 … … 945 1070 represent a value which should be added to the set. */ 946 1071 947 static b oolean1072 static bfd_boolean 948 1073 add_to_set (info, h, reloc, abfd, section, value) 949 1074 struct bfd_link_info *info ATTRIBUTE_UNUSED; … … 959 1084 960 1085 if (! config.build_constructors) 961 return true;1086 return TRUE; 962 1087 963 1088 ldctor_add_set_entry (h, reloc, (const char *) NULL, section, value); … … 972 1097 } 973 1098 974 return true;1099 return TRUE; 975 1100 } 976 1101 … … 980 1105 adding an element to a set, but less general. */ 981 1106 982 static b oolean1107 static bfd_boolean 983 1108 constructor_callback (info, constructor, name, abfd, section, value) 984 1109 struct bfd_link_info *info; 985 b oolean constructor;1110 bfd_boolean constructor; 986 1111 const char *name; 987 1112 bfd *abfd; … … 997 1122 998 1123 if (! config.build_constructors) 999 return true;1124 return TRUE; 1000 1125 1001 1126 /* Ensure that BFD_RELOC_CTOR exists now, so that we can give a … … 1014 1139 strcpy (s, "__DTOR_LIST__"); 1015 1140 1016 h = bfd_link_hash_lookup (info->hash, set_name, true, true, true);1141 h = bfd_link_hash_lookup (info->hash, set_name, TRUE, TRUE, TRUE); 1017 1142 if (h == (struct bfd_link_hash_entry *) NULL) 1018 1143 einfo (_("%P%F: bfd_link_hash_lookup failed: %E\n")); … … 1027 1152 1028 1153 ldctor_add_set_entry (h, BFD_RELOC_CTOR, name, section, value); 1029 return true;1154 return TRUE; 1030 1155 } 1031 1156 … … 1033 1158 bfd_map_over_sections. */ 1034 1159 1035 struct warning_callback_info { 1036 boolean found; 1160 struct warning_callback_info 1161 { 1162 bfd_boolean found; 1037 1163 const char *warning; 1038 1164 const char *symbol; … … 1042 1168 /* This is called when there is a reference to a warning symbol. */ 1043 1169 1044 static b oolean1170 static bfd_boolean 1045 1171 warning_callback (info, warning, symbol, abfd, section, address) 1046 1172 struct bfd_link_info *info ATTRIBUTE_UNUSED; … … 1055 1181 if (! config.warn_multiple_gp 1056 1182 && strcmp (warning, "using multiple gp values") == 0) 1057 return true;1183 return TRUE; 1058 1184 1059 1185 if (section != NULL) … … 1071 1197 /* Look through the relocs to see if we can find a plausible 1072 1198 address. */ 1073 1074 1199 entry = (lang_input_statement_type *) abfd->usrdata; 1075 1200 if (entry != NULL && entry->asymbols != NULL) … … 1094 1219 } 1095 1220 1096 info.found = false;1221 info.found = FALSE; 1097 1222 info.warning = warning; 1098 1223 info.symbol = symbol; … … 1107 1232 } 1108 1233 1109 return true;1234 return TRUE; 1110 1235 } 1111 1236 … … 1153 1278 /* We found a reloc for the symbol we are looking for. */ 1154 1279 einfo ("%C: %s\n", abfd, sec, q->address, info->warning); 1155 info->found = true;1280 info->found = TRUE; 1156 1281 break; 1157 1282 } … … 1163 1288 /* This is called when an undefined symbol is found. */ 1164 1289 1165 static b oolean1290 static bfd_boolean 1166 1291 undefined_symbol (info, name, abfd, section, address, fatal) 1167 1292 struct bfd_link_info *info ATTRIBUTE_UNUSED; … … 1170 1295 asection *section; 1171 1296 bfd_vma address; 1172 b oolean fatal ATTRIBUTE_UNUSED;1297 bfd_boolean fatal ATTRIBUTE_UNUSED; 1173 1298 { 1174 1299 static char *error_name; … … 1182 1307 1183 1308 /* Only warn once about a particular undefined symbol. */ 1184 1185 1309 if (hash == NULL) 1186 1310 { … … 1191 1315 } 1192 1316 1193 if (bfd_hash_lookup (hash, name, false, false) != NULL)1194 return true;1195 1196 if (bfd_hash_lookup (hash, name, true, true) == NULL)1317 if (bfd_hash_lookup (hash, name, FALSE, FALSE) != NULL) 1318 return TRUE; 1319 1320 if (bfd_hash_lookup (hash, name, TRUE, TRUE) == NULL) 1197 1321 einfo (_("%F%P: bfd_hash_lookup failed: %E\n")); 1198 1322 } … … 1238 1362 } 1239 1363 1240 return true;1364 return TRUE; 1241 1365 } 1242 1366 1243 1367 /* This is called when a reloc overflows. */ 1244 1368 1245 static b oolean1369 static bfd_boolean 1246 1370 reloc_overflow (info, name, reloc_name, addend, abfd, section, address) 1247 1371 struct bfd_link_info *info ATTRIBUTE_UNUSED; … … 1261 1385 einfo ("+%v", addend); 1262 1386 einfo ("\n"); 1263 return true;1387 return TRUE; 1264 1388 } 1265 1389 1266 1390 /* This is called when a dangerous relocation is made. */ 1267 1391 1268 static b oolean1392 static bfd_boolean 1269 1393 reloc_dangerous (info, message, abfd, section, address) 1270 1394 struct bfd_link_info *info ATTRIBUTE_UNUSED; … … 1279 1403 einfo ("%X%C:", abfd, section, address); 1280 1404 einfo (_("dangerous relocation: %s\n"), message); 1281 return true;1405 return TRUE; 1282 1406 } 1283 1407 … … 1285 1409 that is not being output. */ 1286 1410 1287 static b oolean1411 static bfd_boolean 1288 1412 unattached_reloc (info, name, abfd, section, address) 1289 1413 struct bfd_link_info *info ATTRIBUTE_UNUSED; … … 1298 1422 einfo ("%X%C:", abfd, section, address); 1299 1423 einfo (_(" reloc refers to symbol `%T' which is not being output\n"), name); 1300 return true;1424 return TRUE; 1301 1425 } 1302 1426 … … 1305 1429 using the -y option. */ 1306 1430 1307 static b oolean1431 static bfd_boolean 1308 1432 notice (info, name, abfd, section, value) 1309 1433 struct bfd_link_info *info; … … 1315 1439 if (! info->notice_all 1316 1440 || (info->notice_hash != NULL 1317 && bfd_hash_lookup (info->notice_hash, name, false, false) != NULL))1441 && bfd_hash_lookup (info->notice_hash, name, FALSE, FALSE) != NULL)) 1318 1442 { 1319 1443 if (bfd_is_und_section (section)) … … 1326 1450 add_cref (name, abfd, section, value); 1327 1451 1328 return true;1329 } 1452 return TRUE; 1453 } -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.