From e47d05ade67e272fefb25ef2a1842e1c25f76052 Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Wed, 11 Oct 2000 00:16:07 +0000 Subject: [PATCH] 2000-10-10 Kazu Hirata * deffile.h: Fix formatting. * lexsup.c: Likewise. * mri.c: Likewise. --- ld/ChangeLog | 6 +++ ld/deffile.h | 130 +++++++++++++++++++++++---------------------------- ld/lexsup.c | 57 +++++++++++----------- ld/mri.c | 56 +++++++++++----------- 4 files changed, 119 insertions(+), 130 deletions(-) diff --git a/ld/ChangeLog b/ld/ChangeLog index 1ee145122dc..0300d6564ac 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,9 @@ +2000-10-10 Kazu Hirata + + * deffile.h: Fix formatting. + * lexsup.c: Likewise. + * mri.c: Likewise. + 2000-10-09 Paul Sokolovsky * pe-dll.c (make_one): Do not generate code thunk for DATA diff --git a/ld/deffile.h b/ld/deffile.h index 92d76bac58a..be6f4861906 100644 --- a/ld/deffile.h +++ b/ld/deffile.h @@ -27,75 +27,64 @@ /* DEF storage definitions. Note that any ordinal may be zero, and any pointer may be NULL, if not defined by the DEF file. */ -typedef struct def_file_section - { - char *name; /* always set */ - char *class; /* may be NULL */ - char flag_read, flag_write, flag_execute, flag_shared; - } -def_file_section; - -typedef struct def_file_export - { - char *name; /* always set */ - char *internal_name; /* always set, may == name */ - int ordinal; /* -1 if not specified */ - int hint; - char flag_private, flag_constant, flag_noname, flag_data; - } -def_file_export; - -typedef struct def_file_module - { - struct def_file_module *next; - void *user_data; - char name[1]; /* extended via malloc */ - } -def_file_module; - -typedef struct def_file_import - { - char *internal_name; /* always set */ - def_file_module *module; /* always set */ - char *name; /* may be NULL; either this or ordinal will be set */ - int ordinal; /* may be -1 */ - } -def_file_import; - -typedef struct def_file - { - - /* from the NAME or LIBRARY command */ - char *name; - int is_dll; /* -1 if NAME/LIBRARY not given */ - bfd_vma base_address; /* (bfd_vma)(-1) if unspecified */ - - /* from the DESCRIPTION command */ - char *description; - - /* from the STACK/HEAP command, -1 if unspecified */ - int stack_reserve, stack_commit; - int heap_reserve, heap_commit; - - /* from the SECTION/SEGMENT commands */ - int num_section_defs; - def_file_section *section_defs; - - /* from the EXPORTS commands */ - int num_exports; - def_file_export *exports; - - /* used by imports for module names */ - def_file_module *modules; - - /* from the IMPORTS commands */ - int num_imports; - def_file_import *imports; - - /* from the VERSION command, -1 if not specified */ - int version_major, version_minor; - } -def_file; +typedef struct def_file_section { + char *name; /* always set */ + char *class; /* may be NULL */ + char flag_read, flag_write, flag_execute, flag_shared; +} def_file_section; + +typedef struct def_file_export { + char *name; /* always set */ + char *internal_name; /* always set, may == name */ + int ordinal; /* -1 if not specified */ + int hint; + char flag_private, flag_constant, flag_noname, flag_data; +} def_file_export; + +typedef struct def_file_module { + struct def_file_module *next; + void *user_data; + char name[1]; /* extended via malloc */ +} def_file_module; + +typedef struct def_file_import { + char *internal_name; /* always set */ + def_file_module *module; /* always set */ + char *name; /* may be NULL; either this or ordinal will be set */ + int ordinal; /* may be -1 */ +} def_file_import; + +typedef struct def_file { + /* from the NAME or LIBRARY command */ + char *name; + int is_dll; /* -1 if NAME/LIBRARY not given */ + bfd_vma base_address; /* (bfd_vma)(-1) if unspecified */ + + /* from the DESCRIPTION command */ + char *description; + + /* from the STACK/HEAP command, -1 if unspecified */ + int stack_reserve, stack_commit; + int heap_reserve, heap_commit; + + /* from the SECTION/SEGMENT commands */ + int num_section_defs; + def_file_section *section_defs; + + /* from the EXPORTS commands */ + int num_exports; + def_file_export *exports; + + /* used by imports for module names */ + def_file_module *modules; + + /* from the IMPORTS commands */ + int num_imports; + def_file_import *imports; + + /* from the VERSION command, -1 if not specified */ + int version_major, version_minor; +} def_file; extern def_file *def_file_empty PARAMS ((void)); @@ -121,8 +110,7 @@ extern void def_file_add_directive PARAMS ((def_file * _def, int len)); #ifdef DEF_FILE_PRINT -extern void def_file_print PARAMS ((FILE * _file, - def_file * _def)); +extern void def_file_print PARAMS ((FILE * _file, def_file * _def)); #endif #endif /* DEFFILE_H */ diff --git a/ld/lexsup.c b/ld/lexsup.c index b4cf3b87b2a..57735d445a1 100644 --- a/ld/lexsup.c +++ b/ld/lexsup.c @@ -130,8 +130,7 @@ int parsing_defsym = 0; /* The long options. This structure is used for both the option parsing and the help text. */ -struct ld_option -{ +struct ld_option { /* The long option information. */ struct option opt; /* The short option with the same meaning ('\0' if none). */ @@ -141,19 +140,17 @@ struct ld_option /* The documentation string. If this is NULL, this is a synonym for the previous option. */ const char *doc; - enum - { - /* Use one dash before long option name. */ - ONE_DASH, - /* Use two dashes before long option name. */ - TWO_DASHES, - /* Don't mention this option in --help output. */ - NO_HELP - } control; + enum { + /* Use one dash before long option name. */ + ONE_DASH, + /* Use two dashes before long option name. */ + TWO_DASHES, + /* Don't mention this option in --help output. */ + NO_HELP + } control; }; -static const struct ld_option ld_options[] = -{ +static const struct ld_option ld_options[] = { { {NULL, required_argument, NULL, '\0'}, 'a', N_("KEYWORD"), N_("Shared library control for HP/UX compatibility"), ONE_DASH }, @@ -604,7 +601,7 @@ parse_args (argc, argv) optarg); cplus_demangle_set_style (style); - } + } break; case OPTION_DYNAMIC_LINKER: command_line.interpreter = optarg; @@ -873,7 +870,7 @@ parse_args (argc, argv) xexit (1); } - optarg2 ++; + optarg2++; /* So far so good. Are all the args present? */ if ((*optarg == '\0') || (*optarg2 == '\0')) @@ -1050,24 +1047,24 @@ the GNU General Public License. This program has absolutely no warranty.\n")); lang_leave_group (); ingroup = 0; break; - case OPTION_MPC860C0: - link_info.mpc860c0 = 20; /* default value (in bytes) */ - if (optarg) - { - unsigned words; + case OPTION_MPC860C0: + link_info.mpc860c0 = 20; /* default value (in bytes) */ + if (optarg) + { + unsigned words; - words = is_num (optarg, 1, 10, 0); - if (words == 0) - { - fprintf (stderr, + words = is_num (optarg, 1, 10, 0); + if (words == 0) + { + fprintf (stderr, _("%s: Invalid argument to option \"mpc860c0\"\n"), program_name); - xexit (1); - } - link_info.mpc860c0 = words * 4; /* convert words to bytes */ - } - command_line.relax = true; - break; + xexit (1); + } + link_info.mpc860c0 = words * 4; /* convert words to bytes */ + } + command_line.relax = true; + break; case OPTION_INIT: link_info.init_function = optarg; diff --git a/ld/mri.c b/ld/mri.c index 4c5d17a1ba9..d53eccb3854 100644 --- a/ld/mri.c +++ b/ld/mri.c @@ -34,8 +34,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "ldgram.h" #include "libiberty.h" -struct section_name_struct -{ +struct section_name_struct { struct section_name_struct *next; CONST char *name; CONST char *alias; @@ -91,7 +90,7 @@ mri_add_to_list (list, name, vma, zalias, align, subalign) etree_type *align; etree_type *subalign; { - struct section_name_struct **ptr = lookup (name,list); + struct section_name_struct **ptr = lookup (name, list); (*ptr)->name = name; (*ptr)->vma = vma; @@ -107,7 +106,7 @@ mri_output_section (name, vma) CONST char *name; etree_type *vma; { - mri_add_to_list (& address, name, vma, 0,0,0); + mri_add_to_list (&address, name, vma, 0, 0, 0); } /* If any ABSOLUTE are in the script, only load those files @@ -117,7 +116,7 @@ void mri_only_load (name) CONST char *name; { - mri_add_to_list (&only_load, name, 0, 0,0,0); + mri_add_to_list (&only_load, name, 0, 0, 0, 0); } void @@ -152,23 +151,22 @@ mri_draw_tree () /* Attatch the addresses of any which have addresses, and add the ones not mentioned. */ - if (address != (struct section_name_struct *)NULL) + if (address != (struct section_name_struct *) NULL) { struct section_name_struct *alist; struct section_name_struct *olist; - if (order == (struct section_name_struct *)NULL) + if (order == (struct section_name_struct *) NULL) order = address; for (alist = address; - alist != (struct section_name_struct*)NULL; + alist != (struct section_name_struct *) NULL; alist = alist->next) { int done = 0; for (olist = order; - done == 0 && - olist != (struct section_name_struct *)NULL; + done == 0 && olist != (struct section_name_struct *) NULL; olist = olist->next) { if (strcmp (alist->name, olist->name) == 0) @@ -181,19 +179,19 @@ mri_draw_tree () if (!done) { /* Add this onto end of order list. */ - mri_add_to_list (& order, alist->name, alist->vma, 0,0,0); + mri_add_to_list (&order, alist->name, alist->vma, 0, 0, 0); } } } /* If we're only supposed to load a subset of them in, then prune the list. */ - if (only_load != (struct section_name_struct *)NULL) + if (only_load != (struct section_name_struct *) NULL) { struct section_name_struct *ptr1; struct section_name_struct *ptr2; - if (order == (struct section_name_struct*)NULL) + if (order == (struct section_name_struct *) NULL) order = only_load; /* See if this name is in the list, if it is then we can load it. */ @@ -207,12 +205,12 @@ mri_draw_tree () /* No only load list, so everything is ok to load. */ struct section_name_struct *ptr; - for (ptr = order; ptr; ptr=ptr->next) + for (ptr = order; ptr; ptr = ptr->next) ptr->ok_to_load = 1; - } + } /* Create the order of sections to load. */ - if (order != (struct section_name_struct *)NULL) + if (order != (struct section_name_struct *) NULL) { /* Been told to output the sections in a certain order. */ struct section_name_struct *p = order; @@ -224,28 +222,28 @@ mri_draw_tree () etree_type *subalign = 0; /* See if an alignment has been specified. */ - for (aptr = alignment; aptr; aptr= aptr->next) + for (aptr = alignment; aptr; aptr = aptr->next) if (strcmp (aptr->name, p->name) == 0) - align = aptr->align; + align = aptr->align; - for (aptr = subalignment; aptr; aptr= aptr->next) + for (aptr = subalignment; aptr; aptr = aptr->next) if (strcmp (aptr->name, p->name) == 0) - subalign = aptr->subalign; + subalign = aptr->subalign; if (base == 0) - base = p->vma ? p->vma :exp_nameop (NAME, "."); + base = p->vma ? p->vma : exp_nameop (NAME, "."); lang_enter_output_section_statement (p->name, base, p->ok_to_load ? 0 : noload_section, 1, align, subalign, (etree_type *) NULL); base = 0; - lang_add_wild (p->name, false, (char *)NULL, false, false, NULL); + lang_add_wild (p->name, false, (char *) NULL, false, false, NULL); /* If there is an alias for this section, add it too. */ for (aptr = alias; aptr; aptr = aptr->next) if (strcmp (aptr->alias, p->name) == 0) - lang_add_wild (aptr->name, false, (char *)NULL, false, false, NULL); + lang_add_wild (aptr->name, false, (char *) NULL, false, false, NULL); lang_leave_output_section_statement (0, "*default*", (struct lang_output_section_phdr_list *) NULL, @@ -264,9 +262,9 @@ mri_load (name) { base = 0; lang_add_input_file (name, - lang_input_file_is_file_enum, (char *)NULL); + lang_input_file_is_file_enum, (char *) NULL); #if 0 - lang_leave_output_section_statement (0,"*default*"); + lang_leave_output_section_statement (0, "*default*"); #endif } @@ -274,7 +272,7 @@ void mri_order (name) CONST char *name; { - mri_add_to_list (& order, name, 0, 0,0,0); + mri_add_to_list (&order, name, 0, 0, 0, 0); } void @@ -296,7 +294,7 @@ mri_alias (want, is, isn) abort (); } - mri_add_to_list (& alias, is, 0, want,0,0); + mri_add_to_list (&alias, is, 0, want, 0, 0); } void @@ -336,7 +334,7 @@ mri_align (name, exp) CONST char *name; etree_type *exp; { - mri_add_to_list (& alignment, name, 0, 0, exp, 0); + mri_add_to_list (&alignment, name, 0, 0, exp, 0); } void @@ -344,7 +342,7 @@ mri_alignmod (name, exp) CONST char *name; etree_type *exp; { - mri_add_to_list (& subalignment, name, 0, 0, 0, exp); + mri_add_to_list (&subalignment, name, 0, 0, 0, exp); } void -- 2.30.2