diff options
author | Steve Chamberlain <sac@cygnus> | 1992-01-28 18:21:36 +0000 |
---|---|---|
committer | Steve Chamberlain <sac@cygnus> | 1992-01-28 18:21:36 +0000 |
commit | 870f54b2c887f03258f78baf5e772cb055c69b06 (patch) | |
tree | 22bef9ed29165e535059ab56d5b52a478784eda9 /ld/ldmain.c | |
parent | daa91756f11404bc87d38eb1e1a6bc9435e0326a (diff) | |
download | gdb-870f54b2c887f03258f78baf5e772cb055c69b06.zip gdb-870f54b2c887f03258f78baf5e772cb055c69b06.tar.gz gdb-870f54b2c887f03258f78baf5e772cb055c69b06.tar.bz2 |
* ldgram.y: map -M behave in the same way as -Map (sets file name
to be "-".
* ldsym.c, ldlang.c: remember that size of a section is dependent on
whether or not relaxing has been done.
* ldmain.c: don't open a map file if it doesn't have a name
* relax.c: all the brains have moved into bfd.
* ldwrite.c: ammend comment
Diffstat (limited to 'ld/ldmain.c')
-rw-r--r-- | ld/ldmain.c | 87 |
1 files changed, 47 insertions, 40 deletions
diff --git a/ld/ldmain.c b/ld/ldmain.c index d9380b5..a185a9c 100644 --- a/ld/ldmain.c +++ b/ld/ldmain.c @@ -129,21 +129,21 @@ main (argc, argv) bfd_init(); #ifdef GNU960 - { - int i; +{ + int i; - check_v960( argc, argv ); - emulation = GLD960_EMULATION_NAME; - for ( i = 1; i < argc; i++ ){ - if ( !strcmp(argv[i],"-Fcoff") ){ - emulation = LNK960_EMULATION_NAME; - output_flavor = BFD_COFF_FORMAT; - break; - } - } - } + check_v960( argc, argv ); + emulation = GLD960_EMULATION_NAME; + for ( i = 1; i < argc; i++ ){ + if ( !strcmp(argv[i],"-Fcoff") ){ + emulation = LNK960_EMULATION_NAME; + output_flavor = BFD_COFF_FORMAT; + break; + } + } +} #else - emulation = (char *) getenv(EMULATION_ENVIRON); + emulation = (char *) getenv(EMULATION_ENVIRON); #endif /* Initialize the data about options. */ @@ -172,8 +172,8 @@ main (argc, argv) config.text_read_only = true; config.make_executable = true; if (emulation == (char *)NULL) { - emulation= DEFAULT_EMULATION; - } + emulation= DEFAULT_EMULATION; + } ldemul_choose_mode(emulation); default_target = ldemul_choose_target(); @@ -183,15 +183,21 @@ main (argc, argv) parse_args(argc, argv); lang_final(); if (trace_files) { - info("%P: mode %s\n", emulation); - } + info("%P: mode %s\n", emulation); + } if (lang_has_input_file == false) { - einfo("%P%F: No input files\n"); - } + einfo("%P%F: No input files\n"); + } ldemul_after_parse(); - if (config.map_filename) - { + + if (config.map_filename) + { + if (strcmp(config.map_filename[0],"-") == 0) + { + config.map_file = stdout; + } + else { config.map_file = fopen(config.map_filename, FOPEN_WT); if (config.map_file == (FILE *)NULL) { @@ -199,7 +205,8 @@ main (argc, argv) config.map_filename); } } - else config.map_file = stdout; + } + lang_process(); @@ -208,35 +215,35 @@ main (argc, argv) if (config.text_read_only) { - /* Look for a text section and mark the readonly attribute in it */ - asection *found = bfd_get_section_by_name(output_bfd, ".text"); - if (found == (asection *)NULL) { - einfo("%P%F: text marked read only, but no text section present"); + /* Look for a text section and mark the readonly attribute in it */ + asection *found = bfd_get_section_by_name(output_bfd, ".text"); + if (found == (asection *)NULL) { + einfo("%P%F: text marked read only, but no text section present"); + } + found->flags |= SEC_READONLY; } - found->flags |= SEC_READONLY; - } if (config.relocateable_output) { - output_bfd->flags &= ~EXEC_P; + output_bfd->flags &= ~EXEC_P; - ldwrite(); - bfd_close(output_bfd); - } + ldwrite(); + bfd_close(output_bfd); + } else { - output_bfd->flags |= EXEC_P; + output_bfd->flags |= EXEC_P; - ldwrite(); + ldwrite(); - if (config.make_executable == false && force_make_executable ==false) { + if (config.make_executable == false && force_make_executable ==false) { - unlink(output_filename); + unlink(output_filename); + } + else { bfd_close(output_bfd); }; + return (!config.make_executable); } - else { bfd_close(output_bfd); }; - return (!config.make_executable); - } return(0); -} /* main() */ +} /* main() */ void |