From 4de2d33d1b8c5f1c14d957aca252d83a0b74f5a3 Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Fri, 29 Sep 2000 11:18:18 +0000 Subject: 2000-09-29 Kazu Hirata * ldcref.c: Fix formatting. * ldctor.c: Likewise. * ldemul.c: Likewise. * ldexp.c: Likewise. * ldfile.c: Likewise. * ldlang.c: Likewise. --- ld/ChangeLog | 9 ++++ ld/ldcref.c | 4 +- ld/ldctor.c | 11 +++-- ld/ldemul.c | 146 +++++++++++++++++++++++++++++------------------------------ ld/ldexp.c | 45 ++++++++---------- ld/ldfile.c | 33 ++++++-------- ld/ldlang.c | 22 ++------- 7 files changed, 125 insertions(+), 145 deletions(-) (limited to 'ld') diff --git a/ld/ChangeLog b/ld/ChangeLog index 0c72cac..3690def 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,12 @@ +2000-09-29 Kazu Hirata + + * ldcref.c: Fix formatting. + * ldctor.c: Likewise. + * ldemul.c: Likewise. + * ldexp.c: Likewise. + * ldfile.c: Likewise. + * ldlang.c: Likewise. + 2000-09-28 Paul Sokolovsky * pe-dll.c (process_def_file): Uninitialized data wasn't diff --git a/ld/ldcref.c b/ld/ldcref.c index e208106..f7751e3 100644 --- a/ld/ldcref.c +++ b/ld/ldcref.c @@ -145,7 +145,6 @@ cref_hash_newfunc (entry, table, string) /* Add a symbol to the cref hash table. This is called for every symbol that is seen during the link. */ -/*ARGSUSED*/ void add_cref (name, abfd, section, value) const char *name; @@ -242,7 +241,7 @@ output_cref (fp) len = strlen (msg); while (len < FILECOL) { - putc (' ' , fp); + putc (' ', fp); ++len; } fprintf (fp, _("File\n")); @@ -350,7 +349,6 @@ check_nocrossrefs () /* Check one symbol to see if it is a prohibited cross reference. */ -/*ARGSUSED*/ static boolean check_nocrossref (h, ignore) struct cref_hash_entry *h; diff --git a/ld/ldctor.c b/ld/ldctor.c index 0a434b8..6e5eace 100644 --- a/ld/ldctor.c +++ b/ld/ldctor.c @@ -1,8 +1,8 @@ /* ldctor.c -- constructor support routines - Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 1998 + Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98, 2000 Free Software Foundation, Inc. By Steve Chamberlain - + This file is part of GLD, the Gnu Linker. GLD is free software; you can redistribute it and/or modify @@ -86,7 +86,8 @@ ldctor_add_set_entry (h, reloc, name, section, value) { if (p->reloc != reloc) { - einfo (_("%P%X: Different relocs used in set %s\n"), h->root.string); + einfo (_("%P%X: Different relocs used in set %s\n"), + h->root.string); return; } @@ -136,7 +137,7 @@ ctor_prio (name) while (*name == '_') ++name; - if (strncmp (name, "GLOBAL_", sizeof "GLOBAL_" - 1) != 0) + if (strncmp (name, "GLOBAL_", sizeof "GLOBAL_" - 1) != 0) return -1; name += sizeof "GLOBAL_" - 1; @@ -365,7 +366,7 @@ ldctor_build_sets () minfo ("%G\n", e->section->owner, e->section, e->value); } - /* Need SEC_KEEP for --gc-sections */ + /* Need SEC_KEEP for --gc-sections. */ if (! bfd_is_abs_section (e->section)) e->section->flags |= SEC_KEEP; diff --git a/ld/ldemul.c b/ld/ldemul.c index 41c638a..b2ce9c4 100644 --- a/ld/ldemul.c +++ b/ld/ldemul.c @@ -15,8 +15,9 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License -along with GLD; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +along with GLD; see the file COPYING. If not, write to the Free +Software Foundation, 59 Temple Place - Suite 330, Boston, MA +02111-1307, USA. */ #include "bfd.h" #include "sysdep.h" @@ -33,29 +34,29 @@ the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307 ld_emulation_xfer_type *ld_emulation; void -ldemul_hll(name) +ldemul_hll (name) char *name; { - ld_emulation->hll(name); + ld_emulation->hll (name); } - -void ldemul_syslib(name) +void +ldemul_syslib (name) char *name; { - ld_emulation->syslib(name); + ld_emulation->syslib (name); } void -ldemul_after_parse() +ldemul_after_parse () { - ld_emulation->after_parse(); + ld_emulation->after_parse (); } void -ldemul_before_parse() +ldemul_before_parse () { - ld_emulation->before_parse(); + ld_emulation->before_parse (); } void @@ -64,52 +65,51 @@ ldemul_after_open () ld_emulation->after_open (); } -void -ldemul_after_allocation() +void +ldemul_after_allocation () { - ld_emulation->after_allocation(); + ld_emulation->after_allocation (); } -void -ldemul_before_allocation() +void +ldemul_before_allocation () { if (ld_emulation->before_allocation) - ld_emulation->before_allocation(); + ld_emulation->before_allocation (); } - void -ldemul_set_output_arch() +ldemul_set_output_arch () { - ld_emulation->set_output_arch(); + ld_emulation->set_output_arch (); } void -ldemul_finish() +ldemul_finish () { if (ld_emulation->finish) - ld_emulation->finish(); + ld_emulation->finish (); } void -ldemul_set_symbols() +ldemul_set_symbols () { if (ld_emulation->set_symbols) - ld_emulation->set_symbols(); + ld_emulation->set_symbols (); } void -ldemul_create_output_section_statements() +ldemul_create_output_section_statements () { if (ld_emulation->create_output_section_statements) - ld_emulation->create_output_section_statements(); + ld_emulation->create_output_section_statements (); } char * -ldemul_get_script(isfile) +ldemul_get_script (isfile) int *isfile; { - return ld_emulation->get_script(isfile); + return ld_emulation->get_script (isfile); } boolean @@ -138,7 +138,7 @@ ldemul_parse_args (argc, argv) int argc; char **argv; { - /* Try and use the emulation parser if there is one. */ + /* Try and use the emulation parser if there is one. */ if (ld_emulation->parse_args) { return ld_emulation->parse_args (argc, argv); @@ -169,24 +169,24 @@ ldemul_recognized_file (entry) } char * -ldemul_choose_target() +ldemul_choose_target () { - return ld_emulation->choose_target(); + return ld_emulation->choose_target (); } /* The default choose_target function. */ char * -ldemul_default_target() +ldemul_default_target () { char *from_outside = getenv (TARGET_ENVIRON); - if (from_outside != (char *)NULL) + if (from_outside != (char *) NULL) return from_outside; return ld_emulation->target_name; } -void -after_parse_default() +void +after_parse_default () { } @@ -197,37 +197,35 @@ after_open_default () } void -after_allocation_default() +after_allocation_default () { } void -before_allocation_default() +before_allocation_default () { } void -set_output_arch_default() +set_output_arch_default () { - /* Set the output architecture and machine if possible */ - bfd_set_arch_mach(output_bfd, - ldfile_output_architecture, ldfile_output_machine); + /* Set the output architecture and machine if possible. */ + bfd_set_arch_mach (output_bfd, + ldfile_output_architecture, ldfile_output_machine); } -/*ARGSUSED*/ void -syslib_default(ignore) - char *ignore ATTRIBUTE_UNUSED; +syslib_default (ignore) + char *ignore ATTRIBUTE_UNUSED; { info_msg (_("%S SYSLIB ignored\n")); } -/*ARGSUSED*/ void -hll_default(ignore) - char *ignore ATTRIBUTE_UNUSED; +hll_default (ignore) + char *ignore ATTRIBUTE_UNUSED; { info_msg (_("%S HLL ignored\n")); } @@ -235,25 +233,25 @@ hll_default(ignore) ld_emulation_xfer_type *ld_emulations[] = { EMULATION_LIST }; void -ldemul_choose_mode(target) +ldemul_choose_mode (target) char *target; { - ld_emulation_xfer_type **eptr = ld_emulations; - /* Ignore "gld" prefix. */ - if (target[0] == 'g' && target[1] == 'l' && target[2] == 'd') - target += 3; - for (; *eptr; eptr++) - { - if (strcmp(target, (*eptr)->emulation_name) == 0) - { - ld_emulation = *eptr; - return; - } - } - einfo (_("%P: unrecognised emulation mode: %s\n"), target); - einfo (_("Supported emulations: ")); - ldemul_list_emulations (stderr); - einfo ("%F\n"); + ld_emulation_xfer_type **eptr = ld_emulations; + /* Ignore "gld" prefix. */ + if (target[0] == 'g' && target[1] == 'l' && target[2] == 'd') + target += 3; + for (; *eptr; eptr++) + { + if (strcmp (target, (*eptr)->emulation_name) == 0) + { + ld_emulation = *eptr; + return; + } + } + einfo (_("%P: unrecognised emulation mode: %s\n"), target); + einfo (_("Supported emulations: ")); + ldemul_list_emulations (stderr); + einfo ("%F\n"); } void @@ -275,33 +273,33 @@ ldemul_list_emulations (f) void ldemul_list_emulation_options (f) - FILE * f; + FILE *f; { - ld_emulation_xfer_type ** eptr; + ld_emulation_xfer_type **eptr; int options_found = 0; - - for (eptr = ld_emulations; * eptr; eptr ++) + + for (eptr = ld_emulations; *eptr; eptr++) { - ld_emulation_xfer_type * emul = * eptr; - + ld_emulation_xfer_type *emul = *eptr; + if (emul->list_options) { fprintf (f, "%s: \n", emul->emulation_name); - + emul->list_options (f); options_found = 1; } } - + if (! options_found) fprintf (f, _(" no emulation specific options.\n")); } int ldemul_find_potential_libraries (name, entry) - char * name; - lang_input_statement_type * entry; + char *name; + lang_input_statement_type *entry; { if (ld_emulation->find_potential_libraries) return ld_emulation->find_potential_libraries (name, entry); diff --git a/ld/ldexp.c b/ld/ldexp.c index 0c38314..7aa8cce 100644 --- a/ld/ldexp.c +++ b/ld/ldexp.c @@ -29,7 +29,6 @@ contains a value, a section to which it is relative and a valid bit. */ - #include "bfd.h" #include "sysdep.h" #include "bfdlink.h" @@ -127,7 +126,7 @@ exp_print_token (code) fprintf(config.map_file, "%c",code); } -static void +static void make_abs (ptr) etree_value_type *ptr; { @@ -147,7 +146,7 @@ new_abs (value) return new; } -static void +static void check (os, name, op) lang_output_section_statement_type *os; const char *name; @@ -213,7 +212,7 @@ new_rel_from_section (value, section) return new; } -static etree_value_type +static etree_value_type fold_binary (tree, current_section, allocation_done, dot, dotp) etree_type *tree; lang_output_section_statement_type *current_section; @@ -264,7 +263,7 @@ fold_binary (tree, current_section, allocation_done, dot, dotp) make_abs(&other); } - switch (tree->type.node_code) + switch (tree->type.node_code) { case '%': if (other.value == 0) @@ -321,7 +320,7 @@ fold_binary (tree, current_section, allocation_done, dot, dotp) return result; } -etree_value_type +etree_value_type invalid () { etree_value_type new; @@ -329,7 +328,7 @@ invalid () return new; } -static etree_value_type +static etree_value_type fold_name (tree, current_section, allocation_done, dot) etree_type *tree; lang_output_section_statement_type *current_section; @@ -337,10 +336,10 @@ fold_name (tree, current_section, allocation_done, dot) bfd_vma dot; { etree_value_type result; - switch (tree->type.node_code) + switch (tree->type.node_code) { case SIZEOF_HEADERS: - if (allocation_done != lang_first_phase_enum) + if (allocation_done != lang_first_phase_enum) { result = new_abs ((bfd_vma) bfd_sizeof_headers (output_bfd, @@ -474,7 +473,7 @@ fold_name (tree, current_section, allocation_done, dot) return result; } -etree_value_type +etree_value_type exp_fold_tree (tree, current_section, allocation_done, dot, dotp) etree_type *tree; lang_output_section_statement_type *current_section; @@ -490,7 +489,7 @@ exp_fold_tree (tree, current_section, allocation_done, dot, dotp) return result; } - switch (tree->type.node_class) + switch (tree->type.node_class) { case etree_value: result = new_rel (tree->value.value, current_section); @@ -524,7 +523,7 @@ exp_fold_tree (tree, current_section, allocation_done, dot, dotp) allocation_done, dot, dotp); if (result.valid_p) { - switch (tree->type.node_code) + switch (tree->type.node_code) { case ALIGN_K: if (allocation_done != lang_first_phase_enum) @@ -540,7 +539,7 @@ exp_fold_tree (tree, current_section, allocation_done, dot, dotp) result.value += result.section->bfd_section->vma; result.section = abs_output_section; } - else + else result.valid_p = false; break; @@ -627,7 +626,7 @@ exp_fold_tree (tree, current_section, allocation_done, dot, dotp) dot, nextdot); } else - *dotp = nextdot; + *dotp = nextdot; } } } @@ -685,7 +684,7 @@ exp_fold_tree (tree, current_section, allocation_done, dot, dotp) return result; } -static etree_value_type +static etree_value_type exp_fold_tree_no_dot (tree, current_section, allocation_done) etree_type *tree; lang_output_section_statement_type *current_section; @@ -744,7 +743,6 @@ exp_trinop (code, cond, lhs, rhs) return new; } - etree_type * exp_unop (code, child) int code; @@ -766,7 +764,6 @@ exp_unop (code, child) return new; } - etree_type * exp_nameop (code, name) int code; @@ -778,7 +775,6 @@ exp_nameop (code, name) value.name.name = name; value.name.type.node_class = etree_name; - r = exp_fold_tree_no_dot(&value, (lang_output_section_statement_type *)NULL, lang_first_phase_enum); @@ -791,9 +787,6 @@ exp_nameop (code, name) } - - - etree_type * exp_assop (code, dst, src) int code; @@ -804,7 +797,6 @@ exp_assop (code, dst, src) value.assign.type.node_code = code; - value.assign.src = src; value.assign.dst = dst; value.assign.type.node_class = etree_assign; @@ -853,7 +845,7 @@ exp_assert (exp, message) return n; } -void +void exp_print_tree (tree) etree_type *tree; { @@ -901,13 +893,13 @@ exp_print_tree (tree) break; case etree_unary: exp_print_token(tree->unary.type.node_code); - if (tree->unary.child) + if (tree->unary.child) { fprintf(config.map_file,"("); exp_print_tree(tree->unary.child); fprintf(config.map_file,")"); } - + break; case etree_assert: @@ -955,7 +947,7 @@ exp_get_vma (tree, def, name, allocation_done) return def; } -int +int exp_get_value_int (tree,def,name, allocation_done) etree_type *tree; int def; @@ -965,7 +957,6 @@ exp_get_value_int (tree,def,name, allocation_done) return (int)exp_get_vma(tree,(bfd_vma)def,name, allocation_done); } - bfd_vma exp_get_abs_int (tree, def, name, allocation_done) etree_type *tree; diff --git a/ld/ldfile.c b/ld/ldfile.c index edf1681..cab604e 100644 --- a/ld/ldfile.c +++ b/ld/ldfile.c @@ -62,15 +62,15 @@ char *slash = ":"; static search_dirs_type **search_tail_ptr = &search_head; -typedef struct search_arch +typedef struct search_arch { - char *name; + char *name; struct search_arch *next; } search_arch_type; static search_arch_type *search_arch_head; static search_arch_type **search_arch_tail_ptr = &search_arch_head; - + static FILE *try_open PARAMS ((const char *name, const char *exten)); void @@ -166,7 +166,7 @@ ldfile_open_file_search (arch, entry, lib, suffix) for (search = search_head; search != (search_dirs_type *)NULL; - search = search->next) + search = search->next) { char *string; @@ -189,8 +189,8 @@ ldfile_open_file_search (arch, entry, lib, suffix) lib, entry->filename, arch, suffix); else if (entry->filename[0] == '/' || entry->filename[0] == '.' #if defined (__MSDOS__) || defined (_WIN32) - || entry->filename[0] == '\\' - || (isalpha (entry->filename[0]) + || entry->filename[0] == '\\' + || (isalpha (entry->filename[0]) && entry->filename[1] == ':') #endif ) @@ -247,7 +247,7 @@ ldfile_open_file (entry) if (ldemul_find_potential_libraries (arch->name, entry)) return; } - + einfo (_("%F%P: cannot find %s\n"), entry->local_sym_name); } } @@ -263,7 +263,7 @@ try_open (name, exten) char buff[1000]; result = fopen (name, "r"); - + if (trace_file_tries) { if (result == NULL) @@ -279,7 +279,7 @@ try_open (name, exten) { sprintf (buff, "%s%s", name, exten); result = fopen (buff, "r"); - + if (trace_file_tries) { if (result == NULL) @@ -314,13 +314,13 @@ ldfile_find_command_file (name, extend) search = search->next) { sprintf (buffer,"%s%s%s", search->name, slash, name); - + result = try_open (buffer, extend); if (result) break; } } - + return result; } @@ -336,9 +336,9 @@ ldfile_open_command_file (name) bfd_set_error (bfd_error_system_call); einfo (_("%P%F: cannot open linker script file %s: %E\n"), name); } - + lex_push_file (ldlex_input_stack, name); - + ldfile_input_filename = name; lineno = 1; had_script = true; @@ -363,7 +363,6 @@ gnu960_map_archname (name) NULL, "" }; struct tabentry *tp; - for (tp = arch_tab; tp->cmd_switch != NULL; tp++) { @@ -373,7 +372,7 @@ gnu960_map_archname (name) if (tp->cmd_switch == NULL) einfo (_("%P%F: unknown architecture: %s\n"),name); - + return tp->arch; } @@ -384,7 +383,6 @@ ldfile_add_arch (name) search_arch_type *new = (search_arch_type *)xmalloc ((bfd_size_type)(sizeof (search_arch_type))); - if (*name != '\0') { if (ldfile_output_machine_name[0] != '\0') @@ -392,7 +390,7 @@ ldfile_add_arch (name) einfo (_("%P%F: target architecture respecified\n")); return; } - + ldfile_output_machine_name = name; } @@ -404,7 +402,6 @@ ldfile_add_arch (name) #else /* not GNU960 */ - void ldfile_add_arch (in_name) CONST char * in_name; diff --git a/ld/ldlang.c b/ld/ldlang.c index 0d8de57..55d7848 100644 --- a/ld/ldlang.c +++ b/ld/ldlang.c @@ -45,7 +45,6 @@ static lang_statement_union_type *new_statement PARAMS ((enum statement_enum, size_t, lang_statement_list_type*)); - /* LOCALS */ static struct obstack stat_obstack; @@ -192,7 +191,6 @@ struct lang_nocrossrefs *nocrossref_list; etree_type *base; /* Relocation base - or null */ - #if defined(__STDC__) || defined(ALMOST_STDC) #define cat(a,b) a##b #else @@ -226,7 +224,7 @@ walk_wild_section (ptr, section, file, callback, data) callback_t callback; PTR data; { - /* Don't process sections from files which were excluded. */ + /* Don't process sections from files which were excluded. */ if (ptr->exclude_filename_list != NULL) { struct name_list *list_tmp; @@ -637,7 +635,6 @@ lang_memory_region_lookup (name) } } - static lang_memory_region_type * lang_memory_default (section) asection *section; @@ -913,7 +910,6 @@ struct already_linked static struct bfd_hash_table already_linked_table; -/*ARGSUSED*/ static void section_already_linked (abfd, sec, data) bfd *abfd; @@ -1214,7 +1210,7 @@ wild_doit (ptr, section, output, file) if (section->flags & SEC_BLOCK) { section->output_section->flags |= SEC_BLOCK; - /* FIXME: This value should really be obtained from the bfd... */ + /* FIXME: This value should really be obtained from the bfd... */ output->block_value = 128; } } @@ -1524,8 +1520,6 @@ load_symbols (entry, place) entry->loaded = true; } - - /* Handle a wild statement. SECTION or FILE or both may be NULL, indicating that it is a wildcard. Separate lang_input_section statements are created for each part of the expansion; they are @@ -1672,7 +1666,7 @@ closest_target_match (target, data) } /* Oh dear, we now have two potential candidates for a successful match. - Compare their names and choose the better one. */ + Compare their names and choose the better one. */ if (name_compare (target->name, original->name) > name_compare (winner->name, original->name)) winner = target; @@ -1930,7 +1924,6 @@ lang_reasonable_defaults () default_common_section = lang_output_section_statement_lookup (".bss"); - if (placed_commons == false) { lang_wild_statement_type *new = @@ -2010,7 +2003,6 @@ map_input_to_output_sections (s, target, output_section_statement) switch (s->header.type) { - case lang_wild_statement_enum: wild (&s->wild_statement, s->wild_statement.section_name, s->wild_statement.filename, target, @@ -2607,7 +2599,6 @@ insert_pad (this_ptr, fill, power, output_section_statement, dot) new->padding_statement.size = alignment_needed * opb; } - /* Remember the most restrictive alignment */ if (power > output_section_statement->alignment_power) { @@ -3179,7 +3170,7 @@ lang_do_assignments (s, output_section_statement, fill, dot) if (os->load_base) { /* If nothing has been placed into the output section then - it won't have a bfd_section. */ + it won't have a bfd_section. */ if (os->bfd_section) { os->bfd_section->lma @@ -3678,7 +3669,6 @@ lang_place_orphans () } } - void lang_set_flags (ptr, flags, invert) lang_memory_region_type *ptr; @@ -3821,7 +3811,6 @@ lang_add_output (name, from_script) } } - static lang_output_section_statement_type *current_section; static int @@ -3862,8 +3851,6 @@ lang_enter_output_section_statement (output_section_statement_name, os = lang_output_section_statement_lookup (output_section_statement_name); - - /* Add this statement to tree */ /* add_statement(lang_output_section_statement_enum, output_section_statement);*/ @@ -4067,7 +4054,6 @@ lang_process () map_input_to_output_sections (statement_list.head, (char *) NULL, (lang_output_section_statement_type *) NULL); - /* Find any sections not attached explicitly and handle them */ lang_place_orphans (); -- cgit v1.1