bfd/ChangeLog:
[platform/upstream/binutils.git] / gas / as.c
index 246ee68..e494fa5 100644 (file)
--- a/gas/as.c
+++ b/gas/as.c
@@ -1,6 +1,6 @@
 /* as.c - GAS main program.
    Copyright 1987, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
-   1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
+   1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
    Free Software Foundation, Inc.
 
    This file is part of GAS, the GNU Assembler.
@@ -98,6 +98,9 @@ int debug_memory = 0;
 /* Enable verbose mode.  */
 int verbose = 0;
 
+/* Keep the output file.  */
+int keep_it = 0;
+
 segT reg_section;
 segT expr_section;
 segT text_section;
@@ -434,7 +437,9 @@ parse_args (int * pargc, char *** pargv)
       OPTION_AL,
       OPTION_HASH_TABLE_SIZE,
       OPTION_REDUCE_MEMORY_OVERHEADS,
-      OPTION_WARN_FATAL
+      OPTION_WARN_FATAL,
+      OPTION_COMPRESS_DEBUG,
+      OPTION_NOCOMPRESS_DEBUG
     /* When you add options here, check that they do
        not collide with OPTION_MD_BASE.  See as.h.  */
     };
@@ -452,6 +457,8 @@ parse_args (int * pargc, char *** pargv)
     ,{"a", optional_argument, NULL, 'a'}
     /* Handle -al=<FILE>.  */
     ,{"al", optional_argument, NULL, OPTION_AL}
+    ,{"compress-debug-sections", no_argument, NULL, OPTION_COMPRESS_DEBUG}
+    ,{"nocompress-debug-sections", no_argument, NULL, OPTION_NOCOMPRESS_DEBUG}
     ,{"debug-prefix-map", required_argument, NULL, OPTION_DEBUG_PREFIX_MAP}
     ,{"defsym", required_argument, NULL, OPTION_DEFSYM}
     ,{"dump-config", no_argument, NULL, OPTION_DUMPCONFIG}
@@ -506,7 +513,8 @@ parse_args (int * pargc, char *** pargv)
      dependent list.  Include space for an extra NULL option and
      always NULL terminate.  */
   shortopts = concat (std_shortopts, md_shortopts, (char *) NULL);
-  longopts = xmalloc (sizeof (std_longopts) + md_longopts_size + sizeof (struct option));
+  longopts = (struct option *) xmalloc (sizeof (std_longopts)
+                                        + md_longopts_size + sizeof (struct option));
   memcpy (longopts, std_longopts, sizeof (std_longopts));
   memcpy (((char *) longopts) + sizeof (std_longopts), md_longopts, md_longopts_size);
   memset (((char *) longopts) + sizeof (std_longopts) + md_longopts_size,
@@ -517,7 +525,7 @@ parse_args (int * pargc, char *** pargv)
   old_argv = *pargv;
 
   /* Initialize a new argv that contains no options.  */
-  new_argv = xmalloc (sizeof (char *) * (old_argc + 1));
+  new_argv = (char **) xmalloc (sizeof (char *) * (old_argc + 1));
   new_argv[0] = old_argv[0];
   new_argc = 1;
   new_argv[new_argc] = NULL;
@@ -600,7 +608,7 @@ parse_args (int * pargc, char *** pargv)
        case OPTION_VERSION:
          /* This output is intended to follow the GNU standards document.  */
          printf (_("GNU assembler %s\n"), BFD_VERSION_STRING);
-         printf (_("Copyright 2008 Free Software Foundation, Inc.\n"));
+         printf (_("Copyright 2010 Free Software Foundation, Inc.\n"));
          printf (_("\
 This program is free software; you may redistribute it under the terms of\n\
 the GNU General Public License version 3 or later.\n\
@@ -630,6 +638,14 @@ This program has absolutely no warranty.\n"));
 #endif
          exit (EXIT_SUCCESS);
 
+       case OPTION_COMPRESS_DEBUG:
+         flag_compress_debug = 1;
+         break;
+
+       case OPTION_NOCOMPRESS_DEBUG:
+         flag_compress_debug = 0;
+         break;
+
        case OPTION_DEBUG_PREFIX_MAP:
          add_debug_prefix_map (optarg);
          break;
@@ -646,7 +662,7 @@ This program has absolutely no warranty.\n"));
              as_fatal (_("bad defsym; format is --defsym name=value"));
            *s++ = '\0';
            i = bfd_scan_vma (s, (const char **) NULL, 0);
-           n = xmalloc (sizeof *n);
+           n = (struct defsym_list *) xmalloc (sizeof *n);
            n->next = defsyms;
            n->name = optarg;
            n->value = i;
@@ -948,13 +964,13 @@ dump_statistics (void)
 #endif
 }
 
-#ifndef OBJ_VMS
 static void
 close_output_file (void)
 {
   output_file_close (out_file_name);
+  if (!keep_it)
+    unlink_if_ordinary (out_file_name);
 }
-#endif
 
 /* The interface between the macro code and gas expression handling.  */
 
@@ -1056,7 +1072,6 @@ create_obj_attrs_section (void)
 {
   segT s;
   char *p;
-  addressT addr;
   offsetT size;
   const char *name;
 
@@ -1070,7 +1085,7 @@ create_obj_attrs_section (void)
       elf_section_type (s)
        = get_elf_backend_data (stdoutput)->obj_attrs_section_type;
       bfd_set_section_flags (stdoutput, s, SEC_READONLY | SEC_DATA);
-      addr = frag_now_fix ();
+      frag_now_fix ();
       p = frag_more (size);
       bfd_elf_set_obj_attr_contents (stdoutput, (bfd_byte *)p, size);
     }
@@ -1084,7 +1099,6 @@ main (int argc, char ** argv)
   char ** argv_orig = argv;
 
   int macro_strip_at;
-  int keep_it;
 
   start_time = get_run_time ();
 
@@ -1136,10 +1150,8 @@ main (int argc, char ** argv)
   input_scrub_begin ();
   expr_begin ();
 
-#ifndef OBJ_VMS /* Does its own file handling.  */
   /* It has to be called after dump_statistics ().  */
   xatexit (close_output_file);
-#endif
 
   if (flag_print_statistics)
     xatexit (dump_statistics);
@@ -1154,7 +1166,7 @@ main (int argc, char ** argv)
   PROGRESS (1);
 
   output_file_create (out_file_name);
-  assert (stdoutput != 0);
+  gas_assert (stdoutput != 0);
 
 #ifdef tc_init_after_args
   tc_init_after_args ();
@@ -1162,6 +1174,8 @@ main (int argc, char ** argv)
 
   itbl_init ();
 
+  dwarf2_init ();
+
   /* Now that we have fully initialized, and have created the output
      file, define any symbols requested by --defsym command line
      arguments.  */
@@ -1247,9 +1261,6 @@ main (int argc, char ** argv)
   if (had_errors () > 0 && ! flag_always_generate_output)
     keep_it = 0;
 
-  if (!keep_it)
-    unlink_if_ordinary (out_file_name);
-
   input_scrub_end ();
 
   END_PROGRESS (myname);