2010-12-07 Doug Kwan <dougkwan@google.com>
[deliverable/binutils-gdb.git] / gas / read.c
index 4afb190173e31d66abc56c79047e1f510c00f37e..ad9363a60449f2f09756fefba889344df8b65a2a 100644 (file)
@@ -629,6 +629,7 @@ read_a_source_file (char *name)
          was_new_line = is_end_of_line[(unsigned char) input_line_pointer[-1]];
          if (was_new_line)
            {
+             symbol_set_value_now (&dot_symbol);
 #ifdef md_start_line_hook
              md_start_line_hook ();
 #endif
@@ -1128,6 +1129,7 @@ read_a_source_file (char *name)
       md_after_pass_hook ();
 #endif
     }
+  symbol_set_value_now (&dot_symbol);
 
  quit:
 
@@ -1610,6 +1612,8 @@ s_mri_common (int small ATTRIBUTE_UNUSED)
 #ifdef S_SET_ALIGN
   if (align != 0)
     S_SET_ALIGN (sym, align);
+#else
+  (void) align;
 #endif
 
   if (line_label != NULL)
@@ -3865,7 +3869,15 @@ cons_worker (int nbytes, /* 1=.byte, 2=.word, 4=.long.  */
        parse_mri_cons (&exp, (unsigned int) nbytes);
       else
 #endif
-       TC_PARSE_CONS_EXPRESSION (&exp, (unsigned int) nbytes);
+        {
+         if (*input_line_pointer == '"')
+           {
+             as_bad (_("unexpected `\"' in expression"));
+             ignore_rest_of_line ();
+             return;
+           }
+         TC_PARSE_CONS_EXPRESSION (&exp, (unsigned int) nbytes);
+       }
 
       if (rva)
        {
@@ -4253,15 +4265,32 @@ emit_expr (expressionS *exp, unsigned int nbytes)
       unsigned int size;
       LITTLENUM_TYPE *nums;
 
-      know (nbytes % CHARS_PER_LITTLENUM == 0);
-
       size = exp->X_add_number * CHARS_PER_LITTLENUM;
       if (nbytes < size)
        {
-         as_warn (_("bignum truncated to %d bytes"), nbytes);
+         int i = nbytes / CHARS_PER_LITTLENUM;
+         if (i != 0)
+           {
+             LITTLENUM_TYPE sign = 0;
+             if ((generic_bignum[--i]
+                  & (1 << (LITTLENUM_NUMBER_OF_BITS - 1))) != 0)
+               sign = ~(LITTLENUM_TYPE) 0;
+             while (++i < exp->X_add_number)
+               if (generic_bignum[i] != sign)
+                 break;
+           }
+         if (i < exp->X_add_number)
+           as_warn (_("bignum truncated to %d bytes"), nbytes);
          size = nbytes;
        }
 
+      if (nbytes == 1)
+       {
+         md_number_to_chars (p, (valueT) generic_bignum[0], 1);
+         return;
+       }
+      know (nbytes % CHARS_PER_LITTLENUM == 0);
+
       if (target_big_endian)
        {
          while (nbytes > size)
@@ -5147,7 +5176,9 @@ stringer (int bits_appendzero)
   const int bitsize = bits_appendzero & ~7;
   const int append_zero = bits_appendzero & 1;
   unsigned int c;
+#if !defined(NO_LISTING) && defined (OBJ_ELF)
   char *start;
+#endif
 
 #ifdef md_flush_pending_output
   md_flush_pending_output ();
@@ -5187,7 +5218,9 @@ stringer (int bits_appendzero)
        {
        case '\"':
          ++input_line_pointer; /*->1st char of string.  */
+#if !defined(NO_LISTING) && defined (OBJ_ELF)
          start = input_line_pointer;
+#endif
 
          while (is_a_char (c = next_char_of_string ()))
            stringer_append_char (c, bitsize);
@@ -5197,8 +5230,7 @@ stringer (int bits_appendzero)
 
          know (input_line_pointer[-1] == '\"');
 
-#ifndef NO_LISTING
-#ifdef OBJ_ELF
+#if !defined(NO_LISTING) && defined (OBJ_ELF)
          /* In ELF, when gcc is emitting DWARF 1 debugging output, it
             will emit .string with a filename in the .debug section
             after a sequence of constants.  See the comment in
@@ -5214,7 +5246,6 @@ stringer (int bits_appendzero)
              listing_source_file (start);
              input_line_pointer[-1] = c;
            }
-#endif
 #endif
 
          break;
This page took 0.026684 seconds and 4 git commands to generate.