Changeset 618 for trunk/src/binutils/ld/ldmain.c
- Timestamp:
- Aug 16, 2003, 11:33:53 PM (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/binutils/ld/ldmain.c
-
Property cvs2svn:cvs-rev
changed from
1.3
to1.4
r617 r618 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 … … 170 185 #if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES) 171 186 setlocale (LC_MESSAGES, ""); 187 #endif 188 #if defined (HAVE_SETLOCALE) 189 setlocale (LC_CTYPE, ""); 172 190 #endif 173 191 bindtextdomain (PACKAGE, LOCALEDIR); … … 190 208 xatexit (remove_output); 191 209 210 #ifdef TARGET_SYSTEM_ROOT_RELOCATABLE 211 ld_sysroot = make_relative_prefix (program_name, BINDIR, 212 TARGET_SYSTEM_ROOT); 213 214 if (ld_sysroot) 215 { 216 struct stat s; 217 int res = stat (ld_sysroot, &s) == 0 && S_ISDIR (s.st_mode); 218 219 if (!res) 220 { 221 free (ld_sysroot); 222 ld_sysroot = NULL; 223 } 224 } 225 226 if (! ld_sysroot) 227 { 228 ld_sysroot = make_relative_prefix (program_name, TOOLBINDIR, 229 TARGET_SYSTEM_ROOT); 230 231 if (ld_sysroot) 232 { 233 struct stat s; 234 int res = stat (ld_sysroot, &s) == 0 && S_ISDIR (s.st_mode); 235 236 if (!res) 237 { 238 free (ld_sysroot); 239 ld_sysroot = NULL; 240 } 241 } 242 } 243 244 if (! ld_sysroot) 245 #endif 246 ld_sysroot = TARGET_SYSTEM_ROOT; 247 248 if (ld_sysroot && *ld_sysroot) 249 ld_canon_sysroot = lrealpath (ld_sysroot); 250 251 if (ld_canon_sysroot) 252 ld_canon_sysroot_len = strlen (ld_canon_sysroot); 253 else 254 ld_canon_sysroot_len = -1; 255 192 256 /* Set the default BFD target based on the configured target. Doing 193 257 this permits the linker to be configured for a particular target, … … 200 264 } 201 265 266 #if YYDEBUG 267 { 268 extern int yydebug; 269 yydebug = 1; 270 } 271 #endif 272 202 273 /* Initialize the data about options. */ 203 trace_files = trace_file_tries = version_printed = false;204 whole_archive = false;205 config.build_constructors = true;206 config.dynamic_link = false;207 config.has_shared = false;274 trace_files = trace_file_tries = version_printed = FALSE; 275 whole_archive = FALSE; 276 config.build_constructors = TRUE; 277 config.dynamic_link = FALSE; 278 config.has_shared = FALSE; 208 279 config.split_by_reloc = (unsigned) -1; 209 280 config.split_by_file = (bfd_size_type) -1; 210 command_line.force_common_definition = false; 281 command_line.force_common_definition = FALSE; 282 command_line.inhibit_common_definition = FALSE; 211 283 command_line.interpreter = NULL; 212 284 command_line.rpath = NULL; 213 command_line.warn_mismatch = true; 214 command_line.check_section_addresses = true; 285 command_line.warn_mismatch = TRUE; 286 command_line.check_section_addresses = TRUE; 287 command_line.accept_unknown_input_arch = FALSE; 215 288 216 289 /* We initialize DEMANGLING based on the environment variable … … 221 294 demangling = getenv ("COLLECT_NO_DEMANGLE") == NULL; 222 295 296 link_info.relocateable = FALSE; 297 link_info.emitrelocations = FALSE; 298 link_info.task_link = FALSE; 299 link_info.shared = FALSE; 300 link_info.symbolic = FALSE; 301 link_info.export_dynamic = FALSE; 302 link_info.static_link = FALSE; 303 link_info.traditional_format = FALSE; 304 link_info.optimize = FALSE; 305 link_info.no_undefined = FALSE; 306 link_info.allow_shlib_undefined = TRUE; 307 link_info.allow_multiple_definition = FALSE; 308 link_info.allow_undefined_version = TRUE; 309 link_info.keep_memory = TRUE; 310 link_info.notice_all = FALSE; 311 link_info.nocopyreloc = FALSE; 312 link_info.new_dtags = FALSE; 313 link_info.combreloc = TRUE; 314 link_info.eh_frame_hdr = FALSE; 315 link_info.strip_discarded = TRUE; 316 link_info.strip = strip_none; 317 link_info.discard = discard_sec_merge; 318 link_info.common_skip_ar_aymbols = bfd_link_common_skip_none; 223 319 link_info.callbacks = &link_callbacks; 224 link_info.relocateable = false; 225 link_info.emitrelocations = false; 226 link_info.shared = false; 227 link_info.symbolic = false; 228 link_info.static_link = false; 229 link_info.traditional_format = false; 230 link_info.optimize = false; 231 link_info.no_undefined = false; 232 link_info.allow_shlib_undefined = false; 233 link_info.strip = strip_none; 234 link_info.discard = discard_none; 235 link_info.keep_memory = true; 320 link_info.hash = NULL; 321 link_info.keep_hash = NULL; 322 link_info.notice_hash = NULL; 323 link_info.wrap_hash = NULL; 236 324 link_info.input_bfds = NULL; 237 325 link_info.create_object_symbols_section = NULL; 238 link_info.hash = NULL; 239 link_info.keep_hash = NULL; 240 link_info.notice_all = false; 241 link_info.notice_hash = NULL; 242 link_info.wrap_hash = NULL; 243 link_info.mpc860c0 = 0; 326 link_info.gc_sym_list = NULL; 327 link_info.base_file = NULL; 244 328 /* SVR4 linkers seem to set DT_INIT and DT_FINI based on magic _init 245 329 and _fini symbols. We are compatible. */ 246 330 link_info.init_function = "_init"; 247 331 link_info.fini_function = "_fini"; 248 link_info.new_dtags = false; 332 link_info.mpc860c0 = 0; 333 link_info.pei386_auto_import = -1; 334 link_info.pei386_runtime_pseudo_reloc = FALSE; 335 link_info.spare_dynamic_tags = 5; 249 336 link_info.flags = (bfd_vma) 0; 250 337 link_info.flags_1 = (bfd_vma) 0; 338 link_info.relax_finalizing = FALSE; 251 339 252 340 ldfile_add_arch (""); 253 341 254 config.make_executable = true;255 force_make_executable = false;256 config.magic_demand_paged = true;257 config.text_read_only = true;342 config.make_executable = TRUE; 343 force_make_executable = FALSE; 344 config.magic_demand_paged = TRUE; 345 config.text_read_only = TRUE; 258 346 259 347 emulation = get_emulation (argc, argv); 260 348 ldemul_choose_mode (emulation); 261 default_target = ldemul_choose_target ( );349 default_target = ldemul_choose_target (argc, argv); 262 350 lang_init (); 263 351 ldemul_before_parse (); 264 lang_has_input_file = false;352 lang_has_input_file = FALSE; 265 353 parse_args (argc, argv); 266 354 … … 279 367 } 280 368 369 if (! link_info.shared) 370 { 371 if (command_line.filter_shlib) 372 einfo (_("%P%F: -F may not be used without -shared\n")); 373 if (command_line.auxiliary_filters) 374 einfo (_("%P%F: -f may not be used without -shared\n")); 375 } 376 281 377 /* Treat ld -r -s as ld -r -S -x (i.e., strip all local symbols). I 282 378 don't see how else this can be handled, since in this case we … … 285 381 { 286 382 link_info.strip = strip_debugger; 287 if (link_info.discard == discard_ none)383 if (link_info.discard == discard_sec_merge) 288 384 link_info.discard = discard_all; 289 385 } … … 293 389 set_scripts_dir (); 294 390 295 if (had_script == false) 296 { 297 /* Read the emulation's appropriate default script. */ 391 /* If we have not already opened and parsed a linker script 392 read the emulation's appropriate default script. */ 393 if (saved_script_handle == NULL) 394 { 298 395 int isfile; 299 396 char *s = ldemul_get_script (&isfile); … … 303 400 else 304 401 { 305 if (trace_file_tries)306 {307 info_msg (_("using internal linker script:\n"));308 info_msg ("==================================================\n");309 info_msg (s);310 info_msg ("\n==================================================\n");311 }312 402 lex_string = s; 313 403 lex_redirect (s); … … 318 408 } 319 409 410 if (trace_file_tries) 411 { 412 if (saved_script_handle) 413 info_msg (_("using external linker script:")); 414 else 415 info_msg (_("using internal linker script:")); 416 info_msg ("\n==================================================\n"); 417 418 if (saved_script_handle) 419 { 420 static const int ld_bufsz = 8193; 421 size_t n; 422 char *buf = xmalloc (ld_bufsz); 423 424 rewind (saved_script_handle); 425 while ((n = fread (buf, 1, ld_bufsz - 1, saved_script_handle)) > 0) 426 { 427 buf[n] = 0; 428 info_msg (buf); 429 } 430 rewind (saved_script_handle); 431 free (buf); 432 } 433 else 434 { 435 int isfile; 436 437 info_msg (ldemul_get_script (&isfile)); 438 } 439 440 info_msg ("\n==================================================\n"); 441 } 442 320 443 lang_final (); 321 444 322 if ( lang_has_input_file == false)445 if (!lang_has_input_file) 323 446 { 324 447 if (version_printed) … … 328 451 329 452 if (trace_files) 330 { 331 info_msg (_("%P: mode %s\n"), emulation); 332 } 453 info_msg (_("%P: mode %s\n"), emulation); 333 454 334 455 ldemul_after_parse (); … … 356 477 /* Print error messages for any missing symbols, for any warning 357 478 symbols, and possibly multiple definitions. */ 358 359 if (! link_info.relocateable)360 {361 /* Look for a text section and switch the readonly attribute in it. */362 asection *found = bfd_get_section_by_name (output_bfd, ".text");363 364 if (found != (asection *) NULL)365 {366 if (config.text_read_only)367 found->flags |= SEC_READONLY;368 else369 found->flags &= ~SEC_READONLY;370 }371 }372 373 479 if (link_info.relocateable) 374 480 output_bfd->flags &= ~EXEC_P; … … 388 494 be reported in the exit status. (What non-fatal errors, if any, do we 389 495 want to ignore for relocateable output?) */ 390 391 if (config.make_executable == false && force_make_executable == false) 392 { 393 if (trace_files == true) 394 { 395 einfo (_("%P: link errors found, deleting executable `%s'\n"), 396 output_filename); 397 } 496 if (!config.make_executable && !force_make_executable) 497 { 498 if (trace_files) 499 einfo (_("%P: link errors found, deleting executable `%s'\n"), 500 output_filename); 398 501 399 502 /* The file will be removed by remove_output. */ 400 401 503 xexit (1); 402 504 } … … 416 518 { 417 519 int len = strlen (output_filename); 520 418 521 if (len < 4 419 522 || (strcasecmp (output_filename + len - 4, ".exe") != 0 … … 426 529 int l; 427 530 char *dst_name = xmalloc (len + 5); 531 428 532 strcpy (dst_name, output_filename); 429 533 strcat (dst_name, ".exe"); … … 438 542 { 439 543 int done = fwrite (buf, 1, l, dst); 544 440 545 if (done != l) 441 { 442 einfo (_("%P: Error writing file `%s'\n"), dst_name); 443 } 546 einfo (_("%P: Error writing file `%s'\n"), dst_name); 444 547 } 548 445 549 fclose (src); 446 550 if (fclose (dst) == EOF) 447 { 448 einfo (_("%P: Error closing file `%s'\n"), dst_name); 449 } 551 einfo (_("%P: Error closing file `%s'\n"), dst_name); 450 552 free (dst_name); 451 553 free (buf); … … 506 608 } 507 609 else 508 { 509 einfo (_("%P%F: missing argument to -m\n")); 510 } 610 einfo (_("%P%F: missing argument to -m\n")); 511 611 } 512 612 else if (strcmp (argv[i], "-mips1") == 0 513 613 || strcmp (argv[i], "-mips2") == 0 514 614 || strcmp (argv[i], "-mips3") == 0 515 || strcmp (argv[i], "-mips4") == 0) 615 || strcmp (argv[i], "-mips4") == 0 616 || strcmp (argv[i], "-mips5") == 0 617 || strcmp (argv[i], "-mips32") == 0 618 || strcmp (argv[i], "-mips32r2") == 0 619 || strcmp (argv[i], "-mips64") == 0) 516 620 { 517 /* FIXME: The arguments -mips1, -mips2 and -mips3are621 /* FIXME: The arguments -mips1, -mips2, -mips3, etc. are 518 622 passed to the linker by some MIPS compilers. They 519 623 generally tell the linker to use a slightly different … … 541 645 542 646 /* If directory DIR contains an "ldscripts" subdirectory, 543 add DIR to the library search path and return true,544 else return false. */545 546 static b oolean647 add DIR to the library search path and return TRUE, 648 else return FALSE. */ 649 650 static bfd_boolean 547 651 check_for_scripts_dir (dir) 548 652 char *dir; … … 551 655 char *buf; 552 656 struct stat s; 553 b oolean res;657 bfd_boolean res; 554 658 555 659 dirlen = strlen (dir); … … 561 665 free (buf); 562 666 if (res) 563 ldfile_add_library_path (dir, false);667 ldfile_add_library_path (dir, FALSE); 564 668 return res; 565 669 } … … 570 674 571 675 SCRIPTDIR (passed from Makefile) 676 (adjusted according to the current location of the binary) 677 SCRIPTDIR (passed from Makefile) 572 678 the dir where this program is (for using it from the build tree) 573 the dir where this program is/../lib (for installing the tool suite elsewhere) */ 679 the dir where this program is/../lib 680 (for installing the tool suite elsewhere). */ 574 681 575 682 static void … … 578 685 char *end, *dir; 579 686 size_t dirlen; 687 bfd_boolean found; 688 689 dir = make_relative_prefix (program_name, BINDIR, SCRIPTDIR); 690 if (dir) 691 { 692 found = check_for_scripts_dir (dir); 693 free (dir); 694 if (found) 695 return; 696 } 697 698 dir = make_relative_prefix (program_name, TOOLBINDIR, SCRIPTDIR); 699 if (dir) 700 { 701 found = check_for_scripts_dir (dir); 702 free (dir); 703 if (found) 704 return; 705 } 580 706 581 707 if (check_for_scripts_dir (SCRIPTDIR)) … … 589 715 /* We could have \foo\bar, or /foo\bar. */ 590 716 char *bslash = strrchr (program_name, '\\'); 717 591 718 if (end == NULL || (bslash != NULL && bslash > end)) 592 719 end = bslash; … … 595 722 596 723 if (end == NULL) 597 { 598 /* Don't look for ldscripts in the current directory. There is 599 too much potential for confusion. */ 600 return; 601 } 724 /* Don't look for ldscripts in the current directory. There is 725 too much potential for confusion. */ 726 return; 602 727 603 728 dirlen = end - program_name; … … 609 734 610 735 if (check_for_scripts_dir (dir)) 611 /* Don't free dir. */ 612 return; 736 { 737 free (dir); 738 return; 739 } 613 740 614 741 /* Look for "ldscripts" in <the dir where our binary is>/../lib. */ 615 742 strcpy (dir + dirlen, "/../lib"); 616 if (check_for_scripts_dir (dir)) 617 return; 618 619 /* Well, we tried. */ 743 check_for_scripts_dir (dir); 620 744 free (dir); 621 745 } … … 635 759 } 636 760 637 if (bfd_hash_lookup (link_info.notice_hash, name, true, true)761 if (bfd_hash_lookup (link_info.notice_hash, name, TRUE, TRUE) 638 762 == (struct bfd_hash_entry *) NULL) 639 763 einfo (_("%P%F: bfd_hash_lookup failed: %E\n")); … … 655 779 einfo (_("%P%F: bfd_hash_table_init failed: %E\n")); 656 780 } 657 if (bfd_hash_lookup (link_info.wrap_hash, name, true, true) == NULL) 781 782 if (bfd_hash_lookup (link_info.wrap_hash, name, TRUE, TRUE) == NULL) 658 783 einfo (_("%P%F: bfd_hash_lookup failed: %E\n")); 659 784 } … … 692 817 while (c != EOF) 693 818 { 694 while ( isspace(c))819 while (ISSPACE (c)) 695 820 c = getc (file); 696 821 … … 699 824 size_t len = 0; 700 825 701 while (! isspace(c) && c != EOF)826 while (! ISSPACE (c) && c != EOF) 702 827 { 703 828 buf[len] = c; … … 713 838 buf[len] = '\0'; 714 839 715 if (bfd_hash_lookup (link_info.keep_hash, buf, true, true)840 if (bfd_hash_lookup (link_info.keep_hash, buf, TRUE, TRUE) 716 841 == (struct bfd_hash_entry *) NULL) 717 842 einfo (_("%P%F: bfd_hash_lookup for insertion failed: %E\n")); … … 722 847 einfo (_("%P: `-retain-symbols-file' overrides `-s' and `-S'\n")); 723 848 849 free (buf); 724 850 link_info.strip = strip_some; 725 851 } … … 731 857 a link. */ 732 858 733 static b oolean859 static bfd_boolean 734 860 add_archive_element (info, abfd, name) 735 861 struct bfd_link_info *info ATTRIBUTE_UNUSED; … … 746 872 input->asymbols = NULL; 747 873 input->next = NULL; 748 input->just_syms_flag = false;749 input->loaded = false;750 input->search_dirs_flag = false;874 input->just_syms_flag = FALSE; 875 input->loaded = FALSE; 876 input->search_dirs_flag = FALSE; 751 877 752 878 /* FIXME: The following fields are not set: header.next, … … 760 886 if (config.map_file != (FILE *) NULL) 761 887 { 762 static b oolean header_printed;888 static bfd_boolean header_printed; 763 889 struct bfd_link_hash_entry *h; 764 890 bfd *from; 765 891 int len; 766 892 767 h = bfd_link_hash_lookup (link_info.hash, name, false, false, true);893 h = bfd_link_hash_lookup (link_info.hash, name, FALSE, FALSE, TRUE); 768 894 769 895 if (h == NULL) … … 797 923 char buf[100]; 798 924 799 sprintf (buf, "%-29s %s\n\n", _("Archive member included"), 800 _("because of file (symbol)")); 925 sprintf (buf, _("Archive member included because of file (symbol)\n\n")); 801 926 minfo ("%s", buf); 802 header_printed = true;927 header_printed = TRUE; 803 928 } 804 929 … … 839 964 info_msg ("%I\n", input); 840 965 841 return true;966 return TRUE; 842 967 } 843 968 … … 845 970 multiple times. */ 846 971 847 static b oolean972 static bfd_boolean 848 973 multiple_definition (info, name, obfd, osec, oval, nbfd, nsec, nval) 849 974 struct bfd_link_info *info ATTRIBUTE_UNUSED; … … 867 992 && ! bfd_is_abs_section (nsec) 868 993 && bfd_is_abs_section (nsec->output_section))) 869 return true;994 return TRUE; 870 995 871 996 einfo (_("%X%C: multiple definition of `%T'\n"), … … 880 1005 } 881 1006 882 return true;1007 return TRUE; 883 1008 } 884 1009 … … 888 1013 -warn-common was used. */ 889 1014 890 static b oolean1015 static bfd_boolean 891 1016 multiple_common (info, name, obfd, otype, osize, nbfd, ntype, nsize) 892 1017 struct bfd_link_info *info ATTRIBUTE_UNUSED; … … 900 1025 { 901 1026 if (! config.warn_common) 902 return true;1027 return TRUE; 903 1028 904 1029 if (ntype == bfd_link_hash_defined … … 947 1072 } 948 1073 949 return true;1074 return TRUE; 950 1075 } 951 1076 … … 954 1079 represent a value which should be added to the set. */ 955 1080 956 static b oolean1081 static bfd_boolean 957 1082 add_to_set (info, h, reloc, abfd, section, value) 958 1083 struct bfd_link_info *info ATTRIBUTE_UNUSED; … … 968 1093 969 1094 if (! config.build_constructors) 970 return true;1095 return TRUE; 971 1096 972 1097 ldctor_add_set_entry (h, reloc, (const char *) NULL, section, value); … … 981 1106 } 982 1107 983 return true;1108 return TRUE; 984 1109 } 985 1110 … … 989 1114 adding an element to a set, but less general. */ 990 1115 991 static b oolean1116 static bfd_boolean 992 1117 constructor_callback (info, constructor, name, abfd, section, value) 993 1118 struct bfd_link_info *info; 994 b oolean constructor;1119 bfd_boolean constructor; 995 1120 const char *name; 996 1121 bfd *abfd; … … 1006 1131 1007 1132 if (! config.build_constructors) 1008 return true;1133 return TRUE; 1009 1134 1010 1135 /* Ensure that BFD_RELOC_CTOR exists now, so that we can give a … … 1023 1148 strcpy (s, "__DTOR_LIST__"); 1024 1149 1025 h = bfd_link_hash_lookup (info->hash, set_name, true, true, true);1150 h = bfd_link_hash_lookup (info->hash, set_name, TRUE, TRUE, TRUE); 1026 1151 if (h == (struct bfd_link_hash_entry *) NULL) 1027 1152 einfo (_("%P%F: bfd_link_hash_lookup failed: %E\n")); … … 1036 1161 1037 1162 ldctor_add_set_entry (h, BFD_RELOC_CTOR, name, section, value); 1038 return true;1163 return TRUE; 1039 1164 } 1040 1165 … … 1042 1167 bfd_map_over_sections. */ 1043 1168 1044 struct warning_callback_info { 1045 boolean found; 1169 struct warning_callback_info 1170 { 1171 bfd_boolean found; 1046 1172 const char *warning; 1047 1173 const char *symbol; … … 1051 1177 /* This is called when there is a reference to a warning symbol. */ 1052 1178 1053 static b oolean1179 static bfd_boolean 1054 1180 warning_callback (info, warning, symbol, abfd, section, address) 1055 1181 struct bfd_link_info *info ATTRIBUTE_UNUSED; … … 1064 1190 if (! config.warn_multiple_gp 1065 1191 && strcmp (warning, "using multiple gp values") == 0) 1066 return true;1192 return TRUE; 1067 1193 1068 1194 if (section != NULL) … … 1080 1206 /* Look through the relocs to see if we can find a plausible 1081 1207 address. */ 1082 1083 1208 entry = (lang_input_statement_type *) abfd->usrdata; 1084 1209 if (entry != NULL && entry->asymbols != NULL) … … 1103 1228 } 1104 1229 1105 info.found = false;1230 info.found = FALSE; 1106 1231 info.warning = warning; 1107 1232 info.symbol = symbol; … … 1116 1241 } 1117 1242 1118 return true;1243 return TRUE; 1119 1244 } 1120 1245 … … 1162 1287 /* We found a reloc for the symbol we are looking for. */ 1163 1288 einfo ("%C: %s\n", abfd, sec, q->address, info->warning); 1164 info->found = true;1289 info->found = TRUE; 1165 1290 break; 1166 1291 } … … 1172 1297 /* This is called when an undefined symbol is found. */ 1173 1298 1174 static b oolean1299 static bfd_boolean 1175 1300 undefined_symbol (info, name, abfd, section, address, fatal) 1176 1301 struct bfd_link_info *info ATTRIBUTE_UNUSED; … … 1179 1304 asection *section; 1180 1305 bfd_vma address; 1181 b oolean fatal ATTRIBUTE_UNUSED;1306 bfd_boolean fatal ATTRIBUTE_UNUSED; 1182 1307 { 1183 1308 static char *error_name; … … 1191 1316 1192 1317 /* Only warn once about a particular undefined symbol. */ 1193 1194 1318 if (hash == NULL) 1195 1319 { … … 1200 1324 } 1201 1325 1202 if (bfd_hash_lookup (hash, name, false, false) != NULL)1203 return true;1204 1205 if (bfd_hash_lookup (hash, name, true, true) == NULL)1326 if (bfd_hash_lookup (hash, name, FALSE, FALSE) != NULL) 1327 return TRUE; 1328 1329 if (bfd_hash_lookup (hash, name, TRUE, TRUE) == NULL) 1206 1330 einfo (_("%F%P: bfd_hash_lookup failed: %E\n")); 1207 1331 } … … 1247 1371 } 1248 1372 1249 return true;1373 return TRUE; 1250 1374 } 1251 1375 1252 1376 /* This is called when a reloc overflows. */ 1253 1377 1254 static b oolean1378 static bfd_boolean 1255 1379 reloc_overflow (info, name, reloc_name, addend, abfd, section, address) 1256 1380 struct bfd_link_info *info ATTRIBUTE_UNUSED; … … 1270 1394 einfo ("+%v", addend); 1271 1395 einfo ("\n"); 1272 return true;1396 return TRUE; 1273 1397 } 1274 1398 1275 1399 /* This is called when a dangerous relocation is made. */ 1276 1400 1277 static b oolean1401 static bfd_boolean 1278 1402 reloc_dangerous (info, message, abfd, section, address) 1279 1403 struct bfd_link_info *info ATTRIBUTE_UNUSED; … … 1288 1412 einfo ("%X%C:", abfd, section, address); 1289 1413 einfo (_("dangerous relocation: %s\n"), message); 1290 return true;1414 return TRUE; 1291 1415 } 1292 1416 … … 1294 1418 that is not being output. */ 1295 1419 1296 static b oolean1420 static bfd_boolean 1297 1421 unattached_reloc (info, name, abfd, section, address) 1298 1422 struct bfd_link_info *info ATTRIBUTE_UNUSED; … … 1307 1431 einfo ("%X%C:", abfd, section, address); 1308 1432 einfo (_(" reloc refers to symbol `%T' which is not being output\n"), name); 1309 return true;1433 return TRUE; 1310 1434 } 1311 1435 … … 1314 1438 using the -y option. */ 1315 1439 1316 static b oolean1440 static bfd_boolean 1317 1441 notice (info, name, abfd, section, value) 1318 1442 struct bfd_link_info *info; … … 1324 1448 if (! info->notice_all 1325 1449 || (info->notice_hash != NULL 1326 && bfd_hash_lookup (info->notice_hash, name, false, false) != NULL))1450 && bfd_hash_lookup (info->notice_hash, name, FALSE, FALSE) != NULL)) 1327 1451 { 1328 1452 if (bfd_is_und_section (section)) … … 1335 1459 add_cref (name, abfd, section, value); 1336 1460 1337 return true;1338 } 1461 return TRUE; 1462 } -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.