This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

linker var init


Tidy.

	* ld.h (args_type, ld_config_type): Reorder fields.
	* ldmain.c (main): Don't initialise a bunch of vars we know are
	zero already.

Index: ld/ld.h
===================================================================
RCS file: /cvs/src/src/ld/ld.h,v
retrieving revision 1.38
diff -u -p -r1.38 ld.h
--- ld/ld.h	3 May 2007 09:24:16 -0000	1.38
+++ ld/ld.h	7 May 2007 14:58:47 -0000
@@ -147,22 +147,6 @@ typedef struct {
   bfd_boolean inhibit_common_definition;
   bfd_boolean relax;
 
-  /* Name of runtime interpreter to invoke.  */
-  char *interpreter;
-
-  /* Name to give runtime libary from the -soname argument.  */
-  char *soname;
-
-  /* Runtime library search path from the -rpath argument.  */
-  char *rpath;
-
-  /* Link time runtime library search path from the -rpath-link
-     argument.  */
-  char *rpath_link;
-
-  /* Big or little endian as set on command line.  */
-  enum { ENDIAN_UNSET = 0, ENDIAN_BIG, ENDIAN_LITTLE } endian;
-
   /* If TRUE, build MIPS embedded PIC relocation tables in the output
      file.  */
   bfd_boolean embedded_relocs;
@@ -181,20 +165,6 @@ typedef struct {
      search.  */
   bfd_boolean warn_search_mismatch;
 
-  /* Name of shared object whose symbol table should be filtered with
-     this shared object.  From the --filter option.  */
-  char *filter_shlib;
-
-  /* Name of shared object for whose symbol table this shared object
-     is an auxiliary filter.  From the --auxiliary option.  */
-  char **auxiliary_filters;
-
-  /* A version symbol to be applied to the symbol names found in the
-     .exports sections.  */
-  char *version_exports_section;
-
-  /* Default linker script.  */
-  char *default_script;
 
   /* If TRUE (the default) check section addresses, once compute,
      fpor overlaps.  */
@@ -206,6 +176,9 @@ typedef struct {
      input files.  */
   bfd_boolean accept_unknown_input_arch;
 
+  /* Big or little endian as set on command line.  */
+  enum { ENDIAN_UNSET = 0, ENDIAN_BIG, ENDIAN_LITTLE } endian;
+
   /* -Bsymbolic and -Bsymbolic-functions, as set on command line.  */
   enum
     {
@@ -222,6 +195,34 @@ typedef struct {
       dynamic_list_data,
       dynamic_list
     } dynamic_list;
+
+  /* Name of runtime interpreter to invoke.  */
+  char *interpreter;
+
+  /* Name to give runtime libary from the -soname argument.  */
+  char *soname;
+
+  /* Runtime library search path from the -rpath argument.  */
+  char *rpath;
+
+  /* Link time runtime library search path from the -rpath-link
+     argument.  */
+  char *rpath_link;
+
+  /* Name of shared object whose symbol table should be filtered with
+     this shared object.  From the --filter option.  */
+  char *filter_shlib;
+
+  /* Name of shared object for whose symbol table this shared object
+     is an auxiliary filter.  From the --auxiliary option.  */
+  char **auxiliary_filters;
+
+  /* A version symbol to be applied to the symbol names found in the
+     .exports sections.  */
+  char *version_exports_section;
+
+  /* Default linker script.  */
+  char *default_script;
 } args_type;
 
 extern args_type command_line;
@@ -229,7 +230,6 @@ extern args_type command_line;
 typedef int token_code_type;
 
 typedef struct {
-  bfd_size_type specified_data_size;
   bfd_boolean magic_demand_paged;
   bfd_boolean make_executable;
 
@@ -269,24 +269,26 @@ typedef struct {
 
   bfd_boolean text_read_only;
 
-  char *map_filename;
-  FILE *map_file;
-
   bfd_boolean stats;
 
   /* If set, orphan input sections will be mapped to separate output
      sections.  */
   bfd_boolean unique_orphan_sections;
 
-  unsigned int split_by_reloc;
-  bfd_size_type split_by_file;
+  /* If set, only search library directories explicitly selected
+     on the command line.  */
+  bfd_boolean only_cmd_line_lib_dirs;
 
   /* The rpath separation character.  Usually ':'.  */
   char rpath_separator;
 
-  /* If set, only search library directories explicitly selected
-     on the command line.  */
-  bfd_boolean only_cmd_line_lib_dirs;
+  char *map_filename;
+  FILE *map_file;
+
+  unsigned int split_by_reloc;
+  bfd_size_type split_by_file;
+
+  bfd_size_type specified_data_size;
 
   /* The size of the hash table to use.  */
   bfd_size_type hash_table_size;
Index: ld/ldmain.c
===================================================================
RCS file: /cvs/src/src/ld/ldmain.c,v
retrieving revision 1.122
diff -u -p -r1.122 ldmain.c
--- ld/ldmain.c	3 May 2007 09:24:16 -0000	1.122
+++ ld/ldmain.c	7 May 2007 11:36:55 -0000
@@ -242,28 +242,17 @@ main (int argc, char **argv)
   }
 #endif
 
-  /* Initialize the data about options.  */
-  trace_files = trace_file_tries = version_printed = FALSE;
-  whole_archive = FALSE;
   config.build_constructors = TRUE;
-  config.dynamic_link = FALSE;
-  config.has_shared = FALSE;
   config.rpath_separator = ':';
   config.split_by_reloc = (unsigned) -1;
   config.split_by_file = (bfd_size_type) -1;
-  config.hash_table_size = 0;
-  command_line.force_common_definition = FALSE;
-  command_line.inhibit_common_definition = FALSE;
-  command_line.interpreter = NULL;
-  command_line.rpath = NULL;
+  config.make_executable = TRUE;
+  config.magic_demand_paged = TRUE;
+  config.text_read_only = TRUE;
+
   command_line.warn_mismatch = TRUE;
   command_line.warn_search_mismatch = TRUE;
   command_line.check_section_addresses = TRUE;
-  command_line.accept_unknown_input_arch = FALSE;
-  command_line.symbolic = symbolic_unset;
-  command_line.dynamic_list = dynamic_list_unset;
-
-  sort_section = none;
 
   /* We initialize DEMANGLING based on the environment variable
      COLLECT_NO_DEMANGLE.  The gcc collect2 program will demangle the
@@ -272,73 +261,21 @@ main (int argc, char **argv)
      interface by default.  */
   demangling = getenv ("COLLECT_NO_DEMANGLE") == NULL;
 
-  link_info.relocatable = FALSE;
-  link_info.emitrelocations = FALSE;
-  link_info.task_link = FALSE;
-  link_info.shared = FALSE;
-  link_info.pie = FALSE;
-  link_info.executable = FALSE;
-  link_info.symbolic = FALSE;
-  link_info.export_dynamic = FALSE;
-  link_info.static_link = FALSE;
-  link_info.traditional_format = FALSE;
-  link_info.optimize = FALSE;
-  link_info.unresolved_syms_in_objects = RM_NOT_YET_SET;
-  link_info.unresolved_syms_in_shared_libs = RM_NOT_YET_SET;
-  link_info.allow_multiple_definition = FALSE;
   link_info.allow_undefined_version = TRUE;
-  link_info.create_default_symver = FALSE;
-  link_info.default_imported_symver = FALSE;
   link_info.keep_memory = TRUE;
-  link_info.notice_all = FALSE;
-  link_info.nocopyreloc = FALSE;
-  link_info.new_dtags = FALSE;
   link_info.combreloc = TRUE;
-  link_info.eh_frame_hdr = FALSE;
-  link_info.relro = FALSE;
   link_info.strip_discarded = TRUE;
-  link_info.strip = strip_none;
-  link_info.discard = discard_sec_merge;
-  link_info.common_skip_ar_aymbols = bfd_link_common_skip_none;
   link_info.callbacks = &link_callbacks;
-  link_info.hash = NULL;
-  link_info.keep_hash = NULL;
-  link_info.notice_hash = NULL;
-  link_info.wrap_hash = NULL;
-  link_info.input_bfds = NULL;
-  link_info.create_object_symbols_section = NULL;
-  link_info.gc_sym_list = NULL;
-  link_info.base_file = NULL;
   link_info.emit_hash = TRUE;
-  link_info.emit_gnu_hash = FALSE;
   /* SVR4 linkers seem to set DT_INIT and DT_FINI based on magic _init
      and _fini symbols.  We are compatible.  */
   link_info.init_function = "_init";
   link_info.fini_function = "_fini";
   link_info.pei386_auto_import = -1;
-  link_info.pei386_runtime_pseudo_reloc = FALSE;
   link_info.spare_dynamic_tags = 5;
-  link_info.flags = 0;
-  link_info.flags_1 = 0;
   link_info.relax_pass = 1;
-  link_info.warn_shared_textrel = FALSE;
-  link_info.gc_sections = FALSE;
-  link_info.print_gc_sections = FALSE;
-  link_info.dynamic = FALSE;
-  link_info.dynamic_list = NULL;
-  link_info.dynamic_data = FALSE;
-  link_info.reduce_memory_overheads = FALSE;
-
-  config.maxpagesize = 0;
-  config.commonpagesize = 0;
 
   ldfile_add_arch ("");
-
-  config.make_executable = TRUE;
-  force_make_executable = FALSE;
-  config.magic_demand_paged = TRUE;
-  config.text_read_only = TRUE;
-
   emulation = get_emulation (argc, argv);
   ldemul_choose_mode (emulation);
   default_target = ldemul_choose_target (argc, argv);

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]