ld cleanups

Ben Elliston bje@au1.ibm.com
Fri Jan 21 00:11:00 GMT 2005


This patch removes all #if 0 chunks from the ld directory.  Anything
here that should be kept?

2005-01-21  Ben Elliston  <bje@au.ibm.com>

	* ldexp.c (exp_assop): Remove #if 0'd code.
	(exp_print_tree): Likewise.
	* ldlang.c (lang_memory_region_lookup): Likewise.
	(open_output): Likewise.
	(open_input_bfds): Likewise.
	(lang_do_assignments_1): Likewise.
	(lang_place_orphans): Likewise.
	(lang_enter_output_section_statement): Likewise.
	* ldlang.h (struct lang_input_statement_struct): Likewise.
	* mri.c (mri_draw_tree): Likewise.
	(mri_load): Likewise.
	* pe-dll.c (generate_reloc): Likewise.
	(make_import_fixup_entry): Likewise.
	(pe_as16): Likewise.
	* emultempl/beos.em (set_pe_subsystem): Likewise.
	* emultempl/hppaelf.em (hppaelf_after_parse): Likewise.
	* emultempl/pe.em: Likewise.
	* emultempl/xtensaelf.em (xtensa_colocate_literals): Likewise.

Index: ldexp.c
===================================================================
RCS file: /home/bje/src-cvs/src/ld/ldexp.c,v
retrieving revision 1.41
diff -u -p -r1.41 ldexp.c
--- ldexp.c	17 Dec 2004 15:50:02 -0000	1.41
+++ ldexp.c	21 Jan 2005 00:09:19 -0000
@@ -935,10 +935,6 @@ exp_assop (int code, const char *dst, et
   value.assign.dst = dst;
   value.assign.type.node_class = etree_assign;
 
-#if 0
-  if (exp_fold_tree_no_dot (&value, &result))
-    return exp_intop (result);
-#endif
   new = stat_alloc (sizeof (new->assign));
   memcpy (new, &value, sizeof (new->assign));
   return new;
@@ -997,13 +993,6 @@ exp_print_tree (etree_type *tree)
       minfo ("%s+0x%v", tree->rel.section->name, tree->rel.value);
       return;
     case etree_assign:
-#if 0
-      if (tree->assign.dst->sdefs != NULL)
-	fprintf (config.map_file, "%s (%x) ", tree->assign.dst->name,
-		 tree->assign.dst->sdefs->value);
-      else
-	fprintf (config.map_file, "%s (UNDEFINED)", tree->assign.dst->name);
-#endif
       fprintf (config.map_file, "%s", tree->assign.dst);
       exp_print_token (tree->type.node_code, TRUE);
       exp_print_tree (tree->assign.src);
Index: ldlang.c
===================================================================
RCS file: /home/bje/src-cvs/src/ld/ldlang.c,v
retrieving revision 1.170
diff -u -p -r1.170 ldlang.c
--- ldlang.c	18 Jan 2005 08:51:54 -0000	1.170
+++ ldlang.c	21 Jan 2005 00:09:19 -0000
@@ -553,20 +553,6 @@ lang_memory_region_lookup (const char *c
 	return p;
       }
 
-#if 0
-  /* This code used to always use the first region in the list as the
-     default region.  I changed it to instead use a region
-     encompassing all of memory as the default region.  This permits
-     NOLOAD sections to work reasonably without requiring a region.
-     People should specify what region they mean, if they really want
-     a region.  */
-  if (strcmp (name, DEFAULT_MEMORY_REGION) == 0)
-    {
-      if (lang_memory_region_list != NULL)
-	return lang_memory_region_list;
-    }
-#endif
-
   if (!create && strcmp (name, DEFAULT_MEMORY_REGION))
     einfo (_("%P:%S: warning: memory region %s not declared\n"), name);
 
@@ -2157,10 +2143,6 @@ open_output (const char *name)
 
   delete_output_file_on_failure = TRUE;
 
-#if 0
-  output->flags |= D_PAGED;
-#endif
-
   if (! bfd_set_format (output, bfd_object))
     einfo (_("%P%F:%s: can not make object file: %E\n"), name);
   if (! bfd_set_arch_mach (output,
@@ -2314,23 +2296,6 @@ open_input_bfds (lang_statement_union_ty
 static void
 lang_reasonable_defaults (void)
 {
-#if 0
-  lang_output_section_statement_lookup (".text");
-  lang_output_section_statement_lookup (".data");
-
-  default_common_section = lang_output_section_statement_lookup (".bss");
-
-  if (!placed_commons)
-    {
-      lang_wild_statement_type *new =
-      new_stat (lang_wild_statement,
-		&default_common_section->children);
-
-      new->section_name = "COMMON";
-      new->filename = NULL;
-      lang_list_init (&new->children);
-    }
-#endif
 }
 
 /* Add a symbol to a hash of symbols used in DEFINED (NAME) expressions.  */
@@ -3987,9 +3952,6 @@ lang_do_assignments_1
 	case lang_object_symbols_statement_enum:
 	case lang_output_statement_enum:
 	case lang_target_statement_enum:
-#if 0
-	case lang_common_statement_enum:
-#endif
 	  break;
 	case lang_data_statement_enum:
 	  {
@@ -4455,13 +4417,6 @@ lang_place_orphans (void)
 		    {
 		      if (default_common_section == NULL)
 			{
-#if 0
-			  /* This message happens when using the
-			     svr3.ifile linker script, so I have
-			     disabled it.  */
-			  info_msg (_("%P: no [COMMON] command,"
-				      " defaulting to .bss\n"));
-#endif
 			  default_common_section =
 			    lang_output_section_statement_lookup (".bss");
 
@@ -4630,11 +4585,6 @@ lang_enter_output_section_statement (con
     lang_output_section_statement_lookup_1 (output_section_statement_name,
 					    constraint);
 
-  /* Add this statement to tree.  */
-#if 0
-  add_statement (lang_output_section_statement_enum,
-		 output_section_statement);
-#endif
   /* Make next things chain into subchain of this.  */
 
   if (os->addr_tree == NULL)
Index: ldlang.h
===================================================================
RCS file: /home/bje/src-cvs/src/ld/ldlang.h,v
retrieving revision 1.42
diff -u -p -r1.42 ldlang.h
--- ldlang.h	26 Oct 2004 18:41:51 -0000	1.42
+++ ldlang.h	21 Jan 2005 00:09:19 -0000
@@ -279,9 +279,6 @@ typedef struct lang_input_statement_stru
 
   bfd_boolean loaded;
 
-#if 0
-  unsigned int globals_in_this_file;
-#endif
   const char *target;
   bfd_boolean real;
 } lang_input_statement_type;
Index: mri.c
===================================================================
RCS file: /home/bje/src-cvs/src/ld/mri.c,v
retrieving revision 1.16
diff -u -p -r1.16 mri.c
--- mri.c	4 Oct 2004 16:45:51 -0000	1.16
+++ mri.c	21 Jan 2005 00:09:19 -0000
@@ -120,19 +120,6 @@ mri_draw_tree (void)
   if (done_tree)
     return;
 
-#if 0   /* We don't bother with memory regions.  */
-  /* Create the regions.  */
-  {
-    lang_memory_region_type *r;
-
-    r = lang_memory_region_lookup("long");
-    r->current = r->origin = exp_get_vma (base, (bfd_vma)0, "origin",
-					  lang_first_phase_enum);
-    r->length = (bfd_size_type) exp_get_vma (0, ~(bfd_vma) 0, "length",
-					     lang_first_phase_enum);
-  }
-#endif
-
   /* Now build the statements for the ldlang machine.  */
 
   /* Attach the addresses of any which have addresses,
@@ -255,9 +242,6 @@ mri_load (const char *name)
 {
   base = 0;
   lang_add_input_file (name, lang_input_file_is_file_enum, NULL);
-#if 0
-  lang_leave_output_section_statement (0, "*default*");
-#endif
 }
 
 void
Index: pe-dll.c
===================================================================
RCS file: /home/bje/src-cvs/src/ld/pe-dll.c,v
retrieving revision 1.74
diff -u -p -r1.74 pe-dll.c
--- pe-dll.c	24 Oct 2004 01:00:12 -0000	1.74
+++ pe-dll.c	21 Jan 2005 00:09:19 -0000
@@ -1178,9 +1178,6 @@ generate_reloc (bfd *abfd, struct bfd_li
 	  free (relocs);
 	  /* Warning: the allocated symbols are remembered in BFD and
 	     reused later, so don't free them!  */
-#if 0
-	  free (symbol);
-#endif
 	}
     }
 
@@ -2037,9 +2034,6 @@ make_import_fixup_entry (const char *nam
   symtab = 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);
-#endif
   quick_symbol (abfd, U ("_nm_thnk_"), name, "", UNDSEC, BSF_GLOBAL, 0);
   quick_symbol (abfd, U (""), dll_symname, "_iname", UNDSEC, BSF_GLOBAL, 0);
   quick_symbol (abfd, "", fixup_name, "", UNDSEC, BSF_GLOBAL, 0);
@@ -2417,18 +2411,6 @@ pe_get32 (bfd *abfd, int where)
   bfd_bread (b, (bfd_size_type) 4, abfd);
   return b[0] + (b[1] << 8) + (b[2] << 16) + (b[3] << 24);
 }
-
-#if 0 /* This is not currently used.  */
-
-static unsigned int
-pe_as16 (void *ptr)
-{
-  unsigned char *b = ptr;
-
-  return b[0] + (b[1] << 8);
-}
-
-#endif
 
 static unsigned int
 pe_as32 (void *ptr)
Index: emultempl/beos.em
===================================================================
RCS file: /home/bje/src-cvs/src/ld/emultempl/beos.em,v
retrieving revision 1.25
diff -u -p -r1.25 beos.em
--- emultempl/beos.em	3 Jan 2004 11:09:07 -0000	1.25
+++ emultempl/beos.em	21 Jan 2005 00:09:43 -0000
@@ -187,10 +187,6 @@ set_pe_subsystem (void)
       { "wwindows", 2, "_wWinMainCRTStartup" },
       { "console", 3, "_mainCRTStartup" },
       { "wconsole", 3, "_wmainCRTStartup" },
-#if 0
-      /* The Microsoft linker does not recognize this.  */
-      { "os2", 5, "" },
-#endif
       { "posix", 7, "___PosixProcessStartup"},
       { 0, 0, 0 }
     };
Index: emultempl/hppaelf.em
===================================================================
RCS file: /home/bje/src-cvs/src/ld/emultempl/hppaelf.em,v
retrieving revision 1.34
diff -u -p -r1.34 hppaelf.em
--- emultempl/hppaelf.em	20 Jan 2005 07:47:49 -0000	1.34
+++ emultempl/hppaelf.em	21 Jan 2005 00:09:43 -0000
@@ -52,12 +52,6 @@ hppaelf_after_parse (void)
 {
   if (link_info.relocatable)
     lang_add_unique (".text");
-#if 0 /* Enable this once we split millicode stuff from libgcc.  */
-  else
-    lang_add_input_file ("milli",
-			 lang_input_file_is_l_enum,
-			 NULL);
-#endif
 }
 
 /* This is called before the input files are opened.  We create a new
Index: emultempl/pe.em
===================================================================
RCS file: /home/bje/src-cvs/src/ld/emultempl/pe.em,v
retrieving revision 1.101
diff -u -p -r1.101 pe.em
--- emultempl/pe.em	29 Dec 2004 05:59:29 -0000	1.101
+++ emultempl/pe.em	21 Jan 2005 00:09:43 -0000
@@ -1362,14 +1362,6 @@ gld_${EMULATION_NAME}_unrecognized_file 
 		  exp_assop ('=', "__image_base__", exp_intop (pe.ImageBase));
 	    }
 
-#if 0
-	  /* Not sure if these *should* be set.  */
-	  if (pe_def_file->version_major != -1)
-	    {
-	      pe.MajorImageVersion = pe_def_file->version_major;
-	      pe.MinorImageVersion = pe_def_file->version_minor;
-	    }
-#endif
 	  if (pe_def_file->stack_reserve != -1
 	      && ! saw_option ("__size_of_stack_reserve__"))
 	    {
Index: emultempl/xtensaelf.em
===================================================================
RCS file: /home/bje/src-cvs/src/ld/emultempl/xtensaelf.em,v
retrieving revision 1.6
diff -u -p -r1.6 xtensaelf.em
--- emultempl/xtensaelf.em	12 Oct 2004 18:33:16 -0000	1.6
+++ emultempl/xtensaelf.em	21 Jan 2005 00:09:43 -0000
@@ -873,16 +873,6 @@ xtensa_colocate_literals (reloc_deps_gra
   if (deps->count == 0)
     return;
 
-#if 0
-  ld_assign_relative_paged_dot (0x100000, statement, deps,
-				xtensa_use_literal_pages);
-
-  if (!ld_local_file_relocations_fit (statement, deps))
-    fprintf (stderr, "initial relocation placement does not fit\n");
-
-  lang_for_each_statement_worker (xtensa_ldlang_clear_addresses, statement);
-#endif
-
   iter_stack_create (stack_p, statement);
 
   while (!iter_stack_empty (stack_p))


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <https://sourceware.org/pipermail/binutils/attachments/20050121/e12730f1/attachment.sig>


More information about the Binutils mailing list