From 89cdebba1358d2b68fe98449be80bbc3338ebda5 Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Mon, 9 Oct 2000 15:09:17 +0000 Subject: [PATCH] 2000-10-09 Kazu Hirata * ldcref.c: Fix formatting. * ldctor.h: Likewise. * ldemul.c: Likewise. * ldemul.h: Likewise. * ldexp.c: Likewise. * ldexp.h: Likewise. * ldfile.c: Likewise. * ldfile.h: Likewise. * ld.h: Likewise. * ldlang.c: Likewise. * ldlang.h: Likewise. * ldmain.c: Likewise. --- ld/ChangeLog | 12 +++++ ld/ld.h | 25 ++++----- ld/ldcref.c | 12 ++--- ld/ldctor.h | 6 +-- ld/ldemul.c | 3 -- ld/ldemul.h | 8 ++- ld/ldexp.c | 3 +- ld/ldexp.h | 17 +++--- ld/ldfile.c | 32 ++++++------ ld/ldfile.h | 3 +- ld/ldlang.c | 7 ++- ld/ldlang.h | 142 +++++++++++++++++++++------------------------------ ld/ldmain.c | 3 +- 13 files changed, 119 insertions(+), 154 deletions(-) diff --git a/ld/ChangeLog b/ld/ChangeLog index 0105c61d33..2ed5096118 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,5 +1,17 @@ 2000-10-09 Kazu Hirata + * ld.h: Fix formatting. + * ldcref.c: Likewise. + * ldctor.h: Likewise. + * ldemul.c: Likewise. + * ldemul.h: Likewise. + * ldexp.c: Likewise. + * ldexp.h: Likewise. + * ldfile.c: Likewise. + * ldfile.h: Likewise. + * ldlang.c: Likewise. + * ldlang.h: Likewise. + * ldmain.c: Likewise. * pe-dll.c: Fix formatting. 2000-10-08 Kazu Hirata diff --git a/ld/ld.h b/ld/ld.h index 26069b8e30..6b7db93207 100644 --- a/ld/ld.h +++ b/ld/ld.h @@ -58,25 +58,23 @@ #define DISCARD_SECTION_NAME "/DISCARD/" /* A file name list */ -typedef struct name_list -{ - const char *name; - struct name_list *next; -} name_list; +typedef struct name_list { + const char *name; + struct name_list *next; +} +name_list; /* A wildcard specification. This is only used in ldgram.y, but it winds up in ldgram.h, so we need to define it outside. */ -struct wildcard_spec -{ +struct wildcard_spec { const char *name; struct name_list *exclude_name_list; boolean sorted; }; /* Extra information we hold on sections */ -typedef struct user_section_struct -{ +typedef struct user_section_struct { /* Pointer to the section where this data will go */ struct lang_input_statement_struct *file; } section_userdata_type; @@ -96,8 +94,7 @@ typedef struct user_section_struct #define ALIGN_N(this, boundary) \ ((( (this) + ((boundary) -1)) & (~((boundary)-1)))) -typedef struct -{ +typedef struct { /* 1 => assign space to common symbols even if `relocatable_output'. */ boolean force_common_definition; boolean relax; @@ -161,8 +158,7 @@ extern args_type command_line; typedef int token_code_type; -typedef struct -{ +typedef struct { bfd_size_type specified_data_size; boolean magic_demand_paged; boolean make_executable; @@ -215,8 +211,7 @@ typedef struct extern ld_config_type config; -typedef enum -{ +typedef enum { lang_first_phase_enum, lang_allocating_phase_enum, lang_final_phase_enum diff --git a/ld/ldcref.c b/ld/ldcref.c index f7751e3c3d..cb2a00fae8 100644 --- a/ld/ldcref.c +++ b/ld/ldcref.c @@ -36,8 +36,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* We keep an instance of this structure for each reference to a symbol from a given object. */ -struct cref_ref -{ +struct cref_ref { /* The next reference. */ struct cref_ref *next; /* The object. */ @@ -52,8 +51,7 @@ struct cref_ref /* We keep a hash table of symbols. Each entry looks like this. */ -struct cref_hash_entry -{ +struct cref_hash_entry { struct bfd_hash_entry root; /* The demangled name. */ char *demangled; @@ -63,8 +61,7 @@ struct cref_hash_entry /* This is what the hash table looks like. */ -struct cref_hash_table -{ +struct cref_hash_table { struct bfd_hash_table root; }; @@ -389,8 +386,7 @@ check_nocrossref (h, ignore) /* The struct is used to pass information from check_refs to check_reloc_refs through bfd_map_over_sections. */ -struct check_refs_info -{ +struct check_refs_info { struct cref_hash_entry *h; asection *defsec; struct lang_nocrossrefs *ncrs; diff --git a/ld/ldctor.h b/ld/ldctor.h index 742dbea1d0..4283c47cd9 100644 --- a/ld/ldctor.h +++ b/ld/ldctor.h @@ -31,8 +31,7 @@ extern boolean constructors_sorted; /* We keep a list of these structures for each set we build. */ -struct set_info -{ +struct set_info { struct set_info *next; /* Next set. */ struct bfd_link_hash_entry *h; /* Hash table entry. */ bfd_reloc_code_real_type reloc; /* Reloc to use for an entry. */ @@ -40,8 +39,7 @@ struct set_info struct set_element *elements; /* Elements in set. */ }; -struct set_element -{ +struct set_element { struct set_element *next; /* Next element. */ const char *name; /* Name in set (may be NULL). */ asection *section; /* Section of value in set. */ diff --git a/ld/ldemul.c b/ld/ldemul.c index b2ce9c4323..b0f43cd722 100644 --- a/ld/ldemul.c +++ b/ld/ldemul.c @@ -188,7 +188,6 @@ ldemul_default_target () void after_parse_default () { - } void @@ -199,13 +198,11 @@ after_open_default () void after_allocation_default () { - } void before_allocation_default () { - } void diff --git a/ld/ldemul.h b/ld/ldemul.h index 6e33ce88ff..224dab50ca 100644 --- a/ld/ldemul.h +++ b/ld/ldemul.h @@ -54,8 +54,7 @@ extern void hll_default PARAMS ((char*)); extern int ldemul_find_potential_libraries PARAMS ((char *, struct lang_input_statement_struct *)); -typedef struct ld_emulation_xfer_struct -{ +typedef struct ld_emulation_xfer_struct { /* Run before parsing the command line and script file. Set the architecture, maybe other things. */ void (*before_parse) PARAMS ((void)); @@ -142,10 +141,9 @@ typedef struct ld_emulation_xfer_struct } ld_emulation_xfer_type; -typedef enum -{ +typedef enum { intel_ic960_ld_mode_enum, - default_mode_enum , + default_mode_enum, intel_gld960_ld_mode_enum } lang_emulation_mode_enum_type; diff --git a/ld/ldexp.c b/ld/ldexp.c index d5ff4e5d9b..cc3427434c 100644 --- a/ld/ldexp.c +++ b/ld/ldexp.c @@ -66,8 +66,7 @@ static void exp_print_token (code) token_code_type code; { - static CONST struct - { + static CONST struct { token_code_type code; char *name; } table[] = { diff --git a/ld/ldexp.h b/ld/ldexp.h index 3ed71af5b0..4c507bd4c3 100644 --- a/ld/ldexp.h +++ b/ld/ldexp.h @@ -23,15 +23,13 @@ #define LDEXP_H /* The result of an expression tree */ -typedef struct -{ +typedef struct { bfd_vma value; struct lang_output_section_statement_struct *section; boolean valid_p; } etree_value_type; -typedef struct -{ +typedef struct { int node_code; enum { etree_binary, etree_trinary, @@ -46,8 +44,7 @@ typedef struct etree_rel } node_class; } node_type; -typedef union etree_union -{ +typedef union etree_union { node_type type; struct { node_type type; @@ -68,11 +65,11 @@ typedef union etree_union struct { node_type type; - union etree_union *child; + union etree_union *child; } unary; struct { node_type type; - CONST char *name; + CONST char *name; } name; struct { node_type type; @@ -106,7 +103,7 @@ etree_type *exp_provide PARAMS ((const char *, etree_type *)); etree_type *exp_assert PARAMS ((etree_type *, const char *)); void exp_print_tree PARAMS ((etree_type *)); bfd_vma exp_get_vma PARAMS ((etree_type *, bfd_vma, char *, lang_phase_type)); -int exp_get_value_int PARAMS ((etree_type *, int, char *,lang_phase_type)); -bfd_vma exp_get_abs_int PARAMS ((etree_type *, int, char *,lang_phase_type)); +int exp_get_value_int PARAMS ((etree_type *, int, char *, lang_phase_type)); +bfd_vma exp_get_abs_int PARAMS ((etree_type *, int, char *, lang_phase_type)); #endif diff --git a/ld/ldfile.c b/ld/ldfile.c index cab604e47d..fbb46851de 100644 --- a/ld/ldfile.c +++ b/ld/ldfile.c @@ -62,8 +62,7 @@ char *slash = ":"; static search_dirs_type **search_tail_ptr = &search_head; -typedef struct search_arch -{ +typedef struct search_arch { char *name; struct search_arch *next; } search_arch_type; @@ -165,7 +164,7 @@ ldfile_open_file_search (arch, entry, lib, suffix) } for (search = search_head; - search != (search_dirs_type *)NULL; + search != (search_dirs_type *) NULL; search = search->next) { char *string; @@ -304,16 +303,16 @@ ldfile_find_command_file (name, extend) FILE *result; char buffer[1000]; - /* First try raw name */ + /* First try raw name. */ result = try_open (name, ""); - if (result == (FILE *)NULL) + if (result == (FILE *) NULL) { - /* Try now prefixes */ + /* Try now prefixes. */ for (search = search_head; - search != (search_dirs_type *)NULL; + search != (search_dirs_type *) NULL; search = search->next) { - sprintf (buffer,"%s%s%s", search->name, slash, name); + sprintf (buffer, "%s%s%s", search->name, slash, name); result = try_open (buffer, extend); if (result) @@ -331,7 +330,7 @@ ldfile_open_command_file (name) FILE *ldlex_input_stack; ldlex_input_stack = ldfile_find_command_file (name, ""); - if (ldlex_input_stack == (FILE *)NULL) + if (ldlex_input_stack == (FILE *) NULL) { bfd_set_error (bfd_error_system_call); einfo (_("%P%F: cannot open linker script file %s: %E\n"), name); @@ -371,7 +370,7 @@ gnu960_map_archname (name) } if (tp->cmd_switch == NULL) - einfo (_("%P%F: unknown architecture: %s\n"),name); + einfo (_("%P%F: unknown architecture: %s\n"), name); return tp->arch; } @@ -381,7 +380,7 @@ ldfile_add_arch (name) char *name; { search_arch_type *new = - (search_arch_type *)xmalloc ((bfd_size_type)(sizeof (search_arch_type))); + (search_arch_type *) xmalloc ((bfd_size_type) (sizeof (search_arch_type))); if (*name != '\0') { @@ -394,17 +393,17 @@ ldfile_add_arch (name) ldfile_output_machine_name = name; } - new->next = (search_arch_type*)NULL; + new->next = (search_arch_type *) NULL; new->name = gnu960_map_archname (name); *search_arch_tail_ptr = new; search_arch_tail_ptr = &new->next; } -#else /* not GNU960 */ +#else /* not GNU960 */ void ldfile_add_arch (in_name) - CONST char * in_name; + CONST char *in_name; { char *name = buystring (in_name); search_arch_type *new = @@ -413,7 +412,7 @@ ldfile_add_arch (in_name) ldfile_output_machine_name = in_name; new->name = name; - new->next = (search_arch_type*)NULL; + new->next = (search_arch_type *) NULL; while (*name) { if (isupper ((unsigned char) *name)) @@ -426,7 +425,8 @@ ldfile_add_arch (in_name) } #endif -/* Set the output architecture */ +/* Set the output architecture. */ + void ldfile_set_output_arch (string) CONST char *string; diff --git a/ld/ldfile.h b/ld/ldfile.h index 9e1834fb62..35bd2dc21b 100644 --- a/ld/ldfile.h +++ b/ld/ldfile.h @@ -29,8 +29,7 @@ extern const char *ldfile_output_machine_name; /* Structure used to hold the list of directories to search for libraries. */ -typedef struct search_dirs -{ +typedef struct search_dirs { /* Next directory on list. */ struct search_dirs *next; /* Name of directory. */ diff --git a/ld/ldlang.c b/ld/ldlang.c index 8bd0eea583..c57dd6d87f 100644 --- a/ld/ldlang.c +++ b/ld/ldlang.c @@ -43,7 +43,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA /* FORWARDS */ static lang_statement_union_type *new_statement PARAMS ((enum statement_enum, size_t, - lang_statement_list_type*)); + lang_statement_list_type *)); /* LOCALS */ static struct obstack stat_obstack; @@ -4622,8 +4622,7 @@ static etree_type *overlay_max; /* A list of all the sections in this overlay. */ -struct overlay_list -{ +struct overlay_list { struct overlay_list *next; lang_output_section_statement_type *os; }; @@ -5030,7 +5029,7 @@ lang_do_version_exports_section () einfo (_("%X%P: unable to read .exports section contents"), sec); p = contents; - while (p < contents+len) + while (p < contents + len) { greg = lang_new_vers_regex (greg, p, NULL); p = strchr (p, '\0') + 1; diff --git a/ld/ldlang.h b/ld/ldlang.h index 58a47f23a5..d327bd3dec 100644 --- a/ld/ldlang.h +++ b/ld/ldlang.h @@ -22,8 +22,7 @@ #ifndef LDLANG_H #define LDLANG_H -typedef enum -{ +typedef enum { lang_input_file_is_l_enum, lang_input_file_is_symbols_only_enum, lang_input_file_is_marker_enum, @@ -33,14 +32,13 @@ typedef enum } lang_input_file_enum_type; typedef unsigned int fill_type; -typedef struct statement_list -{ + +typedef struct statement_list { union lang_statement_union *head; union lang_statement_union **tail; } lang_statement_list_type; -typedef struct memory_region_struct -{ +typedef struct memory_region_struct { char *name; struct memory_region_struct *next; bfd_vma origin; @@ -50,55 +48,49 @@ typedef struct memory_region_struct flagword flags; flagword not_flags; boolean had_full_message; -} lang_memory_region_type ; - -typedef struct lang_statement_header_struct -{ - union lang_statement_union *next; - enum statement_enum - { - lang_output_section_statement_enum, - lang_assignment_statement_enum, - lang_input_statement_enum, - lang_address_statement_enum, - lang_wild_statement_enum, - lang_input_section_enum, - lang_object_symbols_statement_enum, - lang_fill_statement_enum, - lang_data_statement_enum, - lang_reloc_statement_enum, - lang_target_statement_enum, - lang_output_statement_enum, - lang_padding_statement_enum, - lang_group_statement_enum, - - lang_afile_asection_pair_statement_enum, - lang_constructors_statement_enum - } type; +} lang_memory_region_type; + +typedef struct lang_statement_header_struct { + union lang_statement_union *next; + enum statement_enum { + lang_output_section_statement_enum, + lang_assignment_statement_enum, + lang_input_statement_enum, + lang_address_statement_enum, + lang_wild_statement_enum, + lang_input_section_enum, + lang_object_symbols_statement_enum, + lang_fill_statement_enum, + lang_data_statement_enum, + lang_reloc_statement_enum, + lang_target_statement_enum, + lang_output_statement_enum, + lang_padding_statement_enum, + lang_group_statement_enum, + + lang_afile_asection_pair_statement_enum, + lang_constructors_statement_enum + } type; } lang_statement_header_type; -typedef struct -{ +typedef struct { lang_statement_header_type header; union etree_union *exp; } lang_assignment_statement_type; -typedef struct lang_target_statement_struct -{ +typedef struct lang_target_statement_struct { lang_statement_header_type header; const char *target; } lang_target_statement_type; -typedef struct lang_output_statement_struct -{ +typedef struct lang_output_statement_struct { lang_statement_header_type header; const char *name; } lang_output_statement_type; /* Section types specified in a linker script. */ -enum section_type -{ +enum section_type { normal_section, dsect_section, copy_section, @@ -110,15 +102,13 @@ enum section_type /* This structure holds a list of program headers describing segments in which this section should be placed. */ -struct lang_output_section_phdr_list -{ +struct lang_output_section_phdr_list { struct lang_output_section_phdr_list *next; const char *name; boolean used; }; -typedef struct lang_output_section_statement_struct -{ +typedef struct lang_output_section_statement_struct { lang_statement_header_type header; union etree_union *addr_tree; lang_statement_list_type children; @@ -136,37 +126,33 @@ typedef struct lang_output_section_statement_struct size_t block_value; fill_type fill; - int subsection_alignment; /* alignment of components */ - int section_alignment; /* alignment of start of section */ + int subsection_alignment; /* alignment of components */ + int section_alignment; /* alignment of start of section */ union etree_union *load_base; struct lang_output_section_phdr_list *phdrs; } lang_output_section_statement_type; -typedef struct -{ +typedef struct { lang_statement_header_type header; } lang_common_statement_type; -typedef struct -{ +typedef struct { lang_statement_header_type header; } lang_object_symbols_statement_type; -typedef struct -{ +typedef struct { lang_statement_header_type header; fill_type fill; int size; asection *output_section; } lang_fill_statement_type; -typedef struct -{ +typedef struct { lang_statement_header_type header; unsigned int type; - union etree_union *exp; + union etree_union *exp; bfd_vma value; asection *output_section; bfd_vma output_vma; @@ -174,8 +160,7 @@ typedef struct /* Generate a reloc in the output file. */ -typedef struct -{ +typedef struct { lang_statement_header_type header; /* Reloc to generate. */ @@ -205,8 +190,7 @@ typedef struct bfd_vma output_vma; } lang_reloc_statement_type; -typedef struct lang_input_statement_struct -{ +typedef struct lang_input_statement_struct { lang_statement_header_type header; /* Name of this file. */ const char *filename; @@ -227,9 +211,9 @@ typedef struct lang_input_statement_struct /* Point to the next file - whatever it is, wanders up and down archives */ - union lang_statement_union *next; + union lang_statement_union *next; /* Point to the next file, but skips archive contents */ - union lang_statement_union *next_real_file; + union lang_statement_union *next_real_file; boolean is_archive; @@ -250,28 +234,27 @@ typedef struct lang_input_statement_struct boolean loaded; - /* unsigned int globals_in_this_file;*/ +#if 0 + unsigned int globals_in_this_file; +#endif const char *target; boolean real; } lang_input_statement_type; -typedef struct -{ +typedef struct { lang_statement_header_type header; asection *section; lang_input_statement_type *ifile; } lang_input_section_type; -typedef struct -{ +typedef struct { lang_statement_header_type header; asection *section; union lang_statement_union *file; } lang_afile_asection_pair_statement_type; -typedef struct lang_wild_statement_struct -{ +typedef struct lang_wild_statement_struct { lang_statement_header_type header; const char *section_name; boolean sections_sorted; @@ -282,15 +265,13 @@ typedef struct lang_wild_statement_struct lang_statement_list_type children; } lang_wild_statement_type; -typedef struct lang_address_statement_struct -{ +typedef struct lang_address_statement_struct { lang_statement_header_type header; - const char *section_name; - union etree_union *address; + const char *section_name; + union etree_union *address; } lang_address_statement_type; -typedef struct -{ +typedef struct { lang_statement_header_type header; bfd_vma output_offset; size_t size; @@ -303,14 +284,12 @@ typedef struct symbols are found. The effect is to search a group of libraries as though they were a single library. */ -typedef struct -{ +typedef struct { lang_statement_header_type header; lang_statement_list_type children; } lang_group_statement_type; -typedef union lang_statement_union -{ +typedef union lang_statement_union { lang_statement_header_type header; union lang_statement_union *next; lang_wild_statement_type wild_statement; @@ -334,8 +313,7 @@ typedef union lang_statement_union /* This structure holds information about a program header, from the PHDRS command in the linker script. */ -struct lang_phdr -{ +struct lang_phdr { struct lang_phdr *next; const char *name; unsigned long type; @@ -348,16 +326,14 @@ struct lang_phdr /* This structure is used to hold a list of sections which may not cross reference each other. */ -struct lang_nocrossref -{ +struct lang_nocrossref { struct lang_nocrossref *next; const char *name; }; /* The list of nocrossref lists. */ -struct lang_nocrossrefs -{ +struct lang_nocrossrefs { struct lang_nocrossrefs *next; struct lang_nocrossref *list; }; diff --git a/ld/ldmain.c b/ld/ldmain.c index 511e3346f4..bc38beaa4c 100644 --- a/ld/ldmain.c +++ b/ld/ldmain.c @@ -1030,8 +1030,7 @@ constructor_callback (info, constructor, name, abfd, section, value) /* A structure used by warning_callback to pass information through bfd_map_over_sections. */ -struct warning_callback_info -{ +struct warning_callback_info { boolean found; const char *warning; const char *symbol; -- 2.34.1