diff options
Diffstat (limited to 'contrib/binutils/ld/ldlang.c')
-rw-r--r-- | contrib/binutils/ld/ldlang.c | 63 |
1 files changed, 34 insertions, 29 deletions
diff --git a/contrib/binutils/ld/ldlang.c b/contrib/binutils/ld/ldlang.c index 79de098..0eb06b2 100644 --- a/contrib/binutils/ld/ldlang.c +++ b/contrib/binutils/ld/ldlang.c @@ -31,7 +31,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "ldmain.h" #include "ldexp.h" #include "ldlang.h" -#include "ldgram.h" +#include <ldgram.h> #include "ldlex.h" #include "ldmisc.h" #include "ldctor.h" @@ -1783,6 +1783,29 @@ get_first_input_target () return target; } +const char * +lang_get_output_target () +{ + const char *target; + + /* Has the user told us which output format to use? */ + if (output_target != (char *) NULL) + return output_target; + + /* No - has the current target been set to something other than + the default? */ + if (current_target != default_target) + return current_target; + + /* No - can we determine the format of the first input file? */ + target = get_first_input_target (); + if (target != NULL) + return target; + + /* Failed - use the default output target. */ + return default_target; +} + /* Open the output file. */ static bfd * @@ -1791,24 +1814,7 @@ open_output (name) { bfd *output; - /* Has the user told us which output format to use? */ - if (output_target == (char *) NULL) - { - /* No - has the current target been set to something other than - the default? */ - if (current_target != default_target) - output_target = current_target; - - /* No - can we determine the format of the first input file? */ - else - { - output_target = get_first_input_target (); - - /* Failed - use the default output target. */ - if (output_target == NULL) - output_target = default_target; - } - } + output_target = lang_get_output_target (); /* Has the user requested a particular endianness on the command line? */ @@ -2012,7 +2018,7 @@ lang_reasonable_defaults () default_common_section = lang_output_section_statement_lookup (".bss"); - if (placed_commons == false) + if (!placed_commons) { lang_wild_statement_type *new = new_stat (lang_wild_statement, @@ -2768,7 +2774,7 @@ size_input_section (this_ptr, output_section_statement, fill, dot) lang_input_section_type *is = &((*this_ptr)->input_section); asection *i = is->section; - if (is->ifile->just_syms_flag == false) + if (!is->ifile->just_syms_flag) { unsigned opb = bfd_arch_mach_octets_per_byte (ldfile_output_architecture, ldfile_output_machine); @@ -3023,11 +3029,10 @@ lang_size_sections_1 (s, output_section_statement, prev, fill, dot, relax) abs_output_section, lang_allocating_phase_enum, dot, &dot); - if (r.valid_p == false) - { - einfo (_("%F%S: non constant address expression for section %s\n"), - os->name); - } + if (!r.valid_p) + einfo (_("%F%S: non constant address expression for section %s\n"), + os->name); + dot = r.value + r.section->bfd_section->vma; } @@ -3394,7 +3399,7 @@ lang_do_assignments (s, output_section_statement, fill, dot) abs_output_section, lang_final_phase_enum, dot, &dot); s->data_statement.value = value.value; - if (value.valid_p == false) + if (!value.valid_p) einfo (_("%F%P: invalid data statement\n")); } { @@ -3431,7 +3436,7 @@ lang_do_assignments (s, output_section_statement, fill, dot) abs_output_section, lang_final_phase_enum, dot, &dot); s->reloc_statement.addend_value = value.value; - if (value.valid_p == false) + if (!value.valid_p) einfo (_("%F%P: invalid reloc statement\n")); } dot += bfd_get_reloc_size (s->reloc_statement.howto) / opb; @@ -4014,7 +4019,7 @@ lang_add_output (name, from_script) int from_script; { /* Make -o on command line override OUTPUT in script. */ - if (had_output_filename == false || !from_script) + if (!had_output_filename || !from_script) { output_filename = name; had_output_filename = true; |