From b7a26f91f425d537f77f38cd5dac97dda0fd9127 Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Fri, 3 May 2002 13:48:55 +0000 Subject: [PATCH] * ld.h: Fix formatting. * ldexp.c: Likewise. * ldfile.c: Likewise. * ldlang.c: Likewise. * ldmain.c: Likewise. * lexsup.c: Likewise. * pe-dll.c: Likewise. --- ld/ChangeLog | 10 ++++++++ ld/ld.h | 4 ++-- ld/ldexp.c | 4 ++-- ld/ldfile.c | 4 ++-- ld/ldlang.c | 56 ++++++++++++++++++++++---------------------- ld/ldmain.c | 10 ++++---- ld/lexsup.c | 10 ++++---- ld/pe-dll.c | 66 ++++++++++++++++++++++++++-------------------------- 8 files changed, 87 insertions(+), 77 deletions(-) diff --git a/ld/ChangeLog b/ld/ChangeLog index d3c5513c3af..6a17f5b45a7 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,13 @@ +2002-05-03 Kazu Hirata + + * ld.h: Fix formatting. + * ldexp.c: Likewise. + * ldfile.c: Likewise. + * ldlang.c: Likewise. + * ldmain.c: Likewise. + * lexsup.c: Likewise. + * pe-dll.c: Likewise. + 2002-05-02 Alan Modra * emultempl/ppc64elf.em (gld${EMULATION_NAME}_after_allocation): diff --git a/ld/ld.h b/ld/ld.h index e629e66a5e9..12f3f69db54 100644 --- a/ld/ld.h +++ b/ld/ld.h @@ -1,5 +1,5 @@ /* ld.h -- general linker header file - Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000 + Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2002 Free Software Foundation, Inc. This file is part of GLD, the Gnu Linker. @@ -103,7 +103,7 @@ typedef struct { /* 1 => assign space to common symbols even if `relocatable_output'. */ boolean force_common_definition; - /* 1 => do not assign addresses to common symbols. */ + /* 1 => do not assign addresses to common symbols. */ boolean inhibit_common_definition; boolean relax; diff --git a/ld/ldexp.c b/ld/ldexp.c index d58465176e5..264e48f3a8e 100644 --- a/ld/ldexp.c +++ b/ld/ldexp.c @@ -935,13 +935,13 @@ exp_print_tree (tree) { if (config.map_file == NULL) config.map_file = stderr; - + if (tree == NULL) { minfo ("NULL TREE\n"); return; } - + switch (tree->type.node_class) { case etree_value: diff --git a/ld/ldfile.c b/ld/ldfile.c index 655ee608506..8d8310aa108 100644 --- a/ld/ldfile.c +++ b/ld/ldfile.c @@ -1,5 +1,5 @@ /* Linker file opening and searching. - Copyright 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2000, 2001 + Copyright 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. This file is part of GLD, the Gnu Linker. @@ -352,7 +352,7 @@ ldfile_open_command_file (name) ldfile_input_filename = name; lineno = 1; - + saved_script_handle = ldlex_input_stack; } diff --git a/ld/ldlang.c b/ld/ldlang.c index f6b950168c3..f8c9c44f368 100644 --- a/ld/ldlang.c +++ b/ld/ldlang.c @@ -1474,7 +1474,7 @@ load_symbols (entry, place) bfd_error_type err; lang_statement_list_type *hold; boolean bad_load = true; - + err = bfd_get_error (); /* See if the emulation has some special knowledge. */ @@ -1496,7 +1496,7 @@ load_symbols (entry, place) einfo (_("%F%B: file not recognized: %E\n"), entry->the_bfd); else bad_load = false; - + bfd_close (entry->the_bfd); entry->the_bfd = NULL; @@ -1537,7 +1537,7 @@ load_symbols (entry, place) case bfd_archive: if (entry->whole_archive) { - bfd * member = NULL; + bfd *member = NULL; boolean loaded = true; for (;;) @@ -1546,7 +1546,7 @@ load_symbols (entry, place) if (member == NULL) break; - + if (! bfd_check_format (member, bfd_object)) { einfo (_("%F%B: member %B in archive is not an object\n"), @@ -1602,7 +1602,7 @@ wild (s, target, output) if (sec->spec.name != NULL && strcmp (sec->spec.name, "COMMON") == 0) { /* Remember the section that common is going to in case we - later get something which doesn't know where to put it. */ + later get something which doesn't know where to put it. */ default_common_section = output; } } @@ -2842,23 +2842,23 @@ os_region_check (os, region, tree, base) if ((region->current < region->origin || (region->current - region->origin > region->length)) && ((region->current != region->origin + region->length) - || base == 0)) + || base == 0)) { if (tree != (etree_type *) NULL) - { - einfo (_("%X%P: address 0x%v of %B section %s is not within region %s\n"), - region->current, - os->bfd_section->owner, - os->bfd_section->name, - region->name); - } + { + einfo (_("%X%P: address 0x%v of %B section %s is not within region %s\n"), + region->current, + os->bfd_section->owner, + os->bfd_section->name, + region->name); + } else - { - einfo (_("%X%P: region %s is full (%B section %s)\n"), - region->name, - os->bfd_section->owner, - os->bfd_section->name); - } + { + einfo (_("%X%P: region %s is full (%B section %s)\n"), + region->name, + os->bfd_section->owner, + os->bfd_section->name); + } /* Reset the region pointer. */ region->current = region->origin; } @@ -3353,8 +3353,8 @@ lang_do_assignments (s, output_section_statement, fill, dot) if (value.valid_p == false) einfo (_("%F%P: invalid data statement\n")); } - { - unsigned int size; + { + unsigned int size; switch (s->data_statement.type) { default: @@ -3478,9 +3478,9 @@ lang_set_startof () h = bfd_link_hash_lookup (link_info.hash, buf, false, false, true); if (h != NULL && h->type == bfd_link_hash_undefined) { - unsigned opb; + unsigned opb; - opb = bfd_arch_mach_octets_per_byte (ldfile_output_architecture, + opb = bfd_arch_mach_octets_per_byte (ldfile_output_architecture, ldfile_output_machine); h->type = bfd_link_hash_defined; if (s->_cooked_size != 0) @@ -3627,7 +3627,7 @@ lang_check () else if (bfd_count_sections (input_bfd)) { /* If the input bfd has no contents, it shouldn't set the - private data of the output bfd. */ + private data of the output bfd. */ bfd_error_handler_type pfn = NULL; @@ -4520,7 +4520,7 @@ lang_leave_output_section_statement (fill, memspec, phdrs, lma_memspec) /* If no runtime region has been given, but the load region has been, use the load region. */ if (strcmp (memspec, "*default*") == 0) - current_section->region = lang_memory_region_lookup (lma_memspec); + current_section->region = lang_memory_region_lookup (lma_memspec); } current_section->phdrs = phdrs; stat_ptr = &statement_list; @@ -4896,7 +4896,7 @@ lang_leave_overlay_section (fill, phdrs) name = current_section->name; lang_leave_output_section_statement (fill, "*default*", - phdrs, "*default*"); + phdrs, "*default*"); /* Define the magic symbols. */ @@ -4933,7 +4933,7 @@ lang_leave_overlay (fill, memspec, phdrs, lma_memspec) const char *lma_memspec; { lang_memory_region_type *region; - lang_memory_region_type * default_region; + lang_memory_region_type *default_region; lang_memory_region_type *lma_region; struct overlay_list *l; struct lang_nocrossref *nocrossref; @@ -5246,7 +5246,7 @@ lang_do_version_exports_section () bfd_size_type len; if (sec == NULL) - continue; + continue; len = bfd_section_size (is->the_bfd, sec); contents = xmalloc (len); diff --git a/ld/ldmain.c b/ld/ldmain.c index 221f9d1f39d..a6036491329 100644 --- a/ld/ldmain.c +++ b/ld/ldmain.c @@ -318,12 +318,12 @@ main (argc, argv) if (saved_script_handle == NULL) { int isfile; - char *s = ldemul_get_script (& isfile); + char *s = ldemul_get_script (&isfile); if (isfile) ldfile_open_command_file (s); else - { + { lex_string = s; lex_redirect (s); } @@ -349,7 +349,7 @@ main (argc, argv) rewind (saved_script_handle); while ((n = fread (buf, 1, ld_bufsz - 1, saved_script_handle)) > 0) { - buf [n] = 0; + buf[n] = 0; info_msg (buf); } rewind (saved_script_handle); @@ -359,9 +359,9 @@ main (argc, argv) { int isfile; - info_msg (ldemul_get_script (& isfile)); + info_msg (ldemul_get_script (&isfile)); } - + info_msg ("\n==================================================\n"); } diff --git a/ld/lexsup.c b/ld/lexsup.c index 230dd6bb55b..cbde50960f7 100644 --- a/ld/lexsup.c +++ b/ld/lexsup.c @@ -804,7 +804,7 @@ parse_args (argc, argv) increment optind, and continue because getopt is too confused and will seg-fault the next time around. */ einfo(_("%P%F: bad -rpath option\n")); - + link_info.relocateable = true; config.build_constructors = false; config.magic_demand_paged = false; @@ -954,8 +954,8 @@ parse_args (argc, argv) break; case OPTION_TARGET_HELP: /* Mention any target specific options. */ - ldemul_list_emulation_options (stdout); - exit (0); + ldemul_list_emulation_options (stdout); + exit (0); case OPTION_TBSS: set_section_start (".bss", optarg); break; @@ -1009,7 +1009,7 @@ parse_args (argc, argv) version information. Read it, but don't assume that we've seen a linker script. */ { - FILE * hold_script_handle; + FILE *hold_script_handle; hold_script_handle = saved_script_handle; ldfile_open_command_file (optarg); @@ -1225,7 +1225,7 @@ help () int two_dashes = (ld_options[j].control == TWO_DASHES || ld_options[j].control == EXACTLY_TWO_DASHES); - + printf ("%s-%s%s", comma ? ", " : "", two_dashes ? "-" : "", diff --git a/ld/pe-dll.c b/ld/pe-dll.c index 7fe46cb828b..51780c46dba 100644 --- a/ld/pe-dll.c +++ b/ld/pe-dll.c @@ -47,7 +47,7 @@ at the end of this file. This function is not re-entrant and is normally only called once, so static variables are used to reduce the number of parameters and return values required. - + See also: ld/emultempl/pe.em. */ /* Auto-import feature by Paul Sokolovsky @@ -243,7 +243,7 @@ static autofilter_entry_type autofilter_objlist[] = { "dllcrt2.o", 9 }, { "gcrt0.o", 7 }, { "gcrt1.o", 7 }, - { "gcrt2.o", 7 }, + { "gcrt2.o", 7 }, { NULL, 0 } }; @@ -317,7 +317,7 @@ pe_dll_id_target (target) exit (1); } -/* Helper functions for qsort. Relocs must be sorted so that we can write +/* Helper functions for qsort. Relocs must be sorted so that we can write them out by pages. */ typedef struct @@ -446,11 +446,11 @@ auto_export (abfd, d, n) if (abfd && (p = lbasename (abfd->filename))) { - afptr = autofilter_objlist; - while (afptr->name) + afptr = autofilter_objlist; + while (afptr->name) { - if ( strcmp (p, afptr->name) == 0 ) - return 0; + if (strcmp (p, afptr->name) == 0) + return 0; afptr++; } } @@ -466,7 +466,7 @@ auto_export (abfd, d, n) if (strcmp (n, afptr->name) == 0) return 0; - afptr ++; + afptr++; } /* Next, exclude symbols starting with ... */ @@ -476,7 +476,7 @@ auto_export (abfd, d, n) if (strncmp (n, afptr->name, afptr->len) == 0) return 0; - afptr ++; + afptr++; } /* Finally, exclude symbols ending with ... */ @@ -484,13 +484,13 @@ auto_export (abfd, d, n) afptr = autofilter_symbolsuffixlist; while (afptr->name) { - if ((len >= afptr->len) && + if ((len >= afptr->len) /* Add 1 to insure match with trailing '\0'. */ - strncmp (n + len - afptr->len, afptr->name, - afptr->len + 1) == 0) + && strncmp (n + len - afptr->len, afptr->name, + afptr->len + 1) == 0) return 0; - afptr ++; + afptr++; } } @@ -560,10 +560,10 @@ process_def_file (abfd, info) sprintf (name, "%s%s", U("_imp_"), sn); blhe = bfd_link_hash_lookup (info->hash, name, - false, false, false); + false, false, false); free (name); - if (blhe && blhe->type == bfd_link_hash_defined) + if (blhe && blhe->type == bfd_link_hash_defined) continue; } @@ -863,7 +863,7 @@ generate_edata (abfd, info) if (pe_def_file->exports[i].ordinal == -1) { while (exported_symbols[next_ordinal - min_ordinal] != -1) - next_ordinal ++; + next_ordinal++; exported_symbols[next_ordinal - min_ordinal] = i; pe_def_file->exports[i].ordinal = next_ordinal; @@ -1112,9 +1112,9 @@ generate_reloc (abfd, info) for (i = 0; i < nrelocs; i++) { if (pe_dll_extra_pe_debug) - { + { struct symbol_cache_entry *sym = *relocs[i]->sym_ptr_ptr; - printf("rel: %s\n",sym->name); + printf ("rel: %s\n", sym->name); } if (!relocs[i]->howto->pc_relative && relocs[i]->howto->type != pe_details->imagebase_reloc) @@ -1193,7 +1193,7 @@ generate_reloc (abfd, info) if (reloc_data[i].type == 4) reloc_sz += 2; } - + reloc_sz = (reloc_sz + 3) & ~3; /* 4-byte align. */ reloc_d = (unsigned char *) xmalloc (reloc_sz); sec_page = (unsigned long) (-1); @@ -1551,11 +1551,11 @@ save_relocs (asection *sec) .long 0 .rva __my_dll_iname .rva fthunk - + .section .idata$5 .long 0 fthunk: - + .section .idata$4 .long 0 hname: */ @@ -1695,10 +1695,10 @@ make_tail (parent) .global __imp__function _function: jmp *__imp__function: - + .section idata$7 .long __head_my_dll - + .section .idata$5 ___imp_function: __imp__function: @@ -1949,9 +1949,9 @@ make_import_fixup_mark (rel) static int counter; static char *fixup_name = NULL; static size_t buffer_len = 0; - + struct symbol_cache_entry *sym = *rel->sym_ptr_ptr; - + bfd *abfd = bfd_asymbol_bfd (sym); struct coff_link_hash_entry *myh = NULL; @@ -1962,7 +1962,7 @@ make_import_fixup_mark (rel) } if (strlen (sym->name) + 25 > buffer_len) - /* Assume 25 chars for "__fu" + counter + "_". If counter is + /* Assume 25 chars for "__fu" + counter + "_". If counter is bigger than 20 digits long, we've got worse problems than overflowing this buffer... */ { @@ -1972,17 +1972,17 @@ make_import_fixup_mark (rel) buffer_len = ((strlen (sym->name) + 25) + 127) & ~127; fixup_name = (char *) xmalloc (buffer_len); } - + sprintf (fixup_name, "__fu%d_%s", counter++, sym->name); - bfd_coff_link_add_one_symbol (&link_info, abfd, fixup_name, BSF_GLOBAL, + bfd_coff_link_add_one_symbol (&link_info, abfd, fixup_name, BSF_GLOBAL, current_sec, /* sym->section, */ rel->address, NULL, true, false, (struct bfd_link_hash_entry **) &myh); #if 0 - printf ("type:%d\n", myh->type); - printf ("%s\n", myh->root.u.def.section->name); + printf ("type:%d\n", myh->type); + printf ("%s\n", myh->root.u.def.section->name); #endif return fixup_name; } @@ -1995,7 +1995,7 @@ make_import_fixup_mark (rel) .rva __fuNN_SYM (pointer to reference (address) in text) */ static bfd * -make_import_fixup_entry (name, fixup_name, dll_symname,parent) +make_import_fixup_entry (name, fixup_name, dll_symname, parent) const char *name; const char *fixup_name; const char *dll_symname; @@ -2021,8 +2021,8 @@ make_import_fixup_entry (name, fixup_name, dll_symname,parent) symtab = (asymbol **) xmalloc (6 * sizeof (asymbol *)); id3 = quick_section (abfd, ".idata$3", SEC_HAS_CONTENTS, 2); -#if 0 - quick_symbol (abfd, U ("_head_"), dll_symname, "", id2, BSF_GLOBAL, 0); +#if 0 + quick_symbol (abfd, U ("_head_"), dll_symname, "", id2, BSF_GLOBAL, 0); #endif quick_symbol (abfd, U ("_nm_thnk_"), name, "", UNDSEC, BSF_GLOBAL, 0); quick_symbol (abfd, U (""), dll_symname, "_iname", UNDSEC, BSF_GLOBAL, 0); -- 2.30.2