]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - gas/config/tc-hppa.c
daily update
[thirdparty/binutils-gdb.git] / gas / config / tc-hppa.c
index 8823db2d27f0566f48d928859226ff7b48c8074a..e688f71fba7ea8a2b2b32e03bb9ea38550adfa6d 100644 (file)
@@ -1,6 +1,7 @@
 /* tc-hppa.c -- Assemble for the PA
    Copyright 1989, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-   2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+   2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+   Free Software Foundation, Inc.
 
    This file is part of GAS, the GNU Assembler.
 
@@ -1401,7 +1402,8 @@ tc_gen_reloc (asection *section, fixS *fixp)
   /* ??? It might be better to hide this +8 stuff in tc_cfi_emit_pcrel_expr,
      undefine DIFF_EXPR_OK, and let these sorts of complex expressions fail
      when R_HPPA_COMPLEX == R_PARISC_UNIMPLEMENTED.  */
-  if (fixp->fx_r_type == R_HPPA_COMPLEX && fixp->fx_pcrel)
+  if (fixp->fx_r_type == (bfd_reloc_code_real_type) R_HPPA_COMPLEX
+      && fixp->fx_pcrel)
     {
       fixp->fx_r_type = R_HPPA_PCREL_CALL;
       fixp->fx_offset += 8;
@@ -2561,7 +2563,6 @@ pa_get_absolute_expression (struct pa_it *insn, char **strp)
   if (insn->exp.X_op == O_modulus)
     {
       char *s, c;
-      int retval;
 
       input_line_pointer = *strp;
       s = *strp;
@@ -2571,7 +2572,7 @@ pa_get_absolute_expression (struct pa_it *insn, char **strp)
       c = *s;
       *s = 0;
 
-      retval = pa_get_absolute_expression (insn, strp);
+      pa_get_absolute_expression (insn, strp);
 
       input_line_pointer = save_in;
       *s = c;
@@ -3203,7 +3204,7 @@ pa_ip (char *str)
   const char *args;
   int match = FALSE;
   int comma = 0;
-  int cmpltr, nullif, flag, cond, num;
+  int cmpltr, nullif, flag, cond, need_cond, num;
   int immediate_check = 0, pos = -1, len = -1;
   unsigned long opcode;
   struct pa_opcode *insn;
@@ -3263,6 +3264,7 @@ pa_ip (char *str)
       opcode = insn->match;
       strict = (insn->flags & FLAG_STRICT);
       memset (&the_insn, 0, sizeof (the_insn));
+      need_cond = 1;
 
       the_insn.reloc = R_HPPA_NONE;
 
@@ -3757,6 +3759,8 @@ pa_ip (char *str)
                  else
                    break;
 
+                 /* Condition is not required with "dc".  */
+                 need_cond = 0;
                  INSERT_FIELD_AND_CONTINUE (opcode, flag, 11);
 
                /* Handle 32 bit carry for ADD.  */
@@ -3825,6 +3829,8 @@ pa_ip (char *str)
                  else
                    break;
 
+                 /* Condition is not required with "db".  */
+                 need_cond = 0;
                  INSERT_FIELD_AND_CONTINUE (opcode, flag, 11);
 
                /* Handle 32 bit borrow for SUB.  */
@@ -4050,6 +4056,11 @@ pa_ip (char *str)
                          as_bad (_("Invalid Add Condition: %s"), name);
                        *s = c;
                      }
+                   /* Except with "dc", we have a match failure with
+                      'A' if we don't have a doubleword condition.  */
+                   else if (*args == 'A' && need_cond)
+                     break;
+
                    opcode |= cmpltr << 13;
                    INSERT_FIELD_AND_CONTINUE (opcode, flag, 12);
 
@@ -4129,8 +4140,11 @@ pa_ip (char *str)
                            s += 2;
                          }
                        else
-                         as_bad (_("Invalid Bit Branch Condition: %c"), *s);
+                         as_bad (_("Invalid Branch On Bit Condition: %c"), *s);
                      }
+                   else
+                     as_bad (_("Missing Branch On Bit Condition"));
+
                    INSERT_FIELD_AND_CONTINUE (opcode, cmpltr, 15);
 
                  /* Handle a compare/subtract condition.  */
@@ -4218,6 +4232,11 @@ pa_ip (char *str)
                                  name);
                        *s = c;
                      }
+                   /* Except with "db", we have a match failure with
+                      'S' if we don't have a doubleword condition.  */
+                   else if (*args == 'S' && need_cond)
+                     break;
+
                    opcode |= cmpltr << 13;
                    INSERT_FIELD_AND_CONTINUE (opcode, flag, 12);
 
@@ -4276,7 +4295,7 @@ pa_ip (char *str)
 
                    INSERT_FIELD_AND_CONTINUE (opcode, cmpltr, 13);
 
-                   /* Handle a logical instruction condition.  */
+                 /* Handle a logical instruction condition.  */
                  case 'L':
                  case 'l':
                    cmpltr = 0;
@@ -4340,6 +4359,10 @@ pa_ip (char *str)
                          as_bad (_("Invalid Logical Instruction Condition."));
                        *s = c;
                      }
+                   /* 32-bit is default for no condition.  */
+                   else if (*args == 'L')
+                     break;
+
                    opcode |= cmpltr << 13;
                    INSERT_FIELD_AND_CONTINUE (opcode, flag, 12);
 
@@ -4398,6 +4421,7 @@ pa_ip (char *str)
                          as_bad (_("Invalid Shift/Extract/Deposit Condition."));
                        *s = c;
                      }
+
                    INSERT_FIELD_AND_CONTINUE (opcode, cmpltr, 13);
 
                  /* Handle a unit instruction condition.  */
@@ -4509,6 +4533,10 @@ pa_ip (char *str)
                        else if (*args != 'U' || (*s != ' ' && *s != '\t'))
                          as_bad (_("Invalid Unit Instruction Condition."));
                      }
+                   /* 32-bit is default for no condition.  */
+                   else if (*args == 'U')
+                     break;
+
                    opcode |= cmpltr << 13;
                    INSERT_FIELD_AND_CONTINUE (opcode, flag, 12);
 
@@ -5969,6 +5997,10 @@ pa_build_unwind_subspace (struct call_info *call_info)
       != (SEC_ALLOC | SEC_LOAD | SEC_READONLY))
     return;
 
+  if (call_info->start_symbol == NULL)
+    /* This can happen if there were errors earlier on in the assembly.  */
+    return;
+
   /* Replace the start symbol with a local symbol that will be reduced
      to a section offset.  This avoids problems with weak functions with
      multiple definitions, etc.  */
@@ -6492,6 +6524,7 @@ process_exit (void)
   /* Mark the end of the function, stuff away the location of the frag
      for the end of the function, and finally call pa_build_unwind_subspace
      to add an entry in the unwind table.  */
+  (void) where;
   hppa_elf_mark_end_of_function ();
   pa_build_unwind_subspace (last_call_info);
 #else
@@ -6633,6 +6666,8 @@ pa_type_args (symbolS *symbolP, int is_export)
      to the SOM BFD backend.  */
 #ifdef obj_set_symbol_type
   obj_set_symbol_type (bfdsym, (int) type);
+#else
+  (void) type;
 #endif
 
   /* Now that the type of the exported symbol has been handled,
@@ -6655,6 +6690,8 @@ pa_type_args (symbolS *symbolP, int is_export)
          arg_reloc = pa_align_arg_reloc (temp, pa_build_arg_reloc (name));
 #if defined (OBJ_SOM) || defined (ELF_ARG_RELOC)
          symbol_arg_reloc_info (symbolP) |= arg_reloc;
+#else
+         (void) arg_reloc;
 #endif
          *input_line_pointer = c;
        }
@@ -6669,6 +6706,8 @@ pa_type_args (symbolS *symbolP, int is_export)
          arg_reloc = pa_build_arg_reloc (name);
 #if defined (OBJ_SOM) || defined (ELF_ARG_RELOC)
          symbol_arg_reloc_info (symbolP) |= arg_reloc;
+#else
+         (void) arg_reloc;
 #endif
          *input_line_pointer = c;
        }
@@ -7369,7 +7408,7 @@ pa_subspace (int create_new)
 {
   char *name, *ss_name, c;
   char loadable, code_only, comdat, common, dup_common, zero, sort;
-  int i, access, space_index, alignment, quadrant, applicable, flags;
+  int i, access_ctr, space_index, alignment, quadrant, applicable, flags;
   sd_chain_struct *space;
   ssd_chain_struct *ssd;
   asection *section;
@@ -7392,7 +7431,7 @@ pa_subspace (int create_new)
 
       /* Load default values.  */
       sort = 0;
-      access = 0x7f;
+      access_ctr = 0x7f;
       loadable = 1;
       comdat = 0;
       common = 0;
@@ -7437,7 +7476,7 @@ pa_subspace (int create_new)
                  space_index = pa_def_subspaces[i].space_index;
                  alignment = pa_def_subspaces[i].alignment;
                  quadrant = pa_def_subspaces[i].quadrant;
-                 access = pa_def_subspaces[i].access;
+                 access_ctr = pa_def_subspaces[i].access;
                  sort = pa_def_subspaces[i].sort;
                  break;
                }
@@ -7475,7 +7514,7 @@ pa_subspace (int create_new)
                {
                  *input_line_pointer = c;
                  input_line_pointer++;
-                 access = get_absolute_expression ();
+                 access_ctr = get_absolute_expression ();
                }
              else if ((strncasecmp (name, "sort", 4) == 0))
                {
@@ -7583,14 +7622,14 @@ pa_subspace (int create_new)
 
        current_subspace = update_subspace (space, ss_name, loadable,
                                            code_only, comdat, common,
-                                           dup_common, sort, zero, access,
+                                           dup_common, sort, zero, access_ctr,
                                            space_index, alignment, quadrant,
                                            section);
       else
        current_subspace = create_new_subspace (space, ss_name, loadable,
                                                code_only, comdat, common,
                                                dup_common, zero, sort,
-                                               access, space_index,
+                                               access_ctr, space_index,
                                                alignment, quadrant, section);
 
       demand_empty_rest_of_line ();
@@ -7821,7 +7860,7 @@ create_new_subspace (sd_chain_struct *space,
                     int dup_common,
                     int is_zero ATTRIBUTE_UNUSED,
                     int sort,
-                    int access,
+                    int access_ctr,
                     int space_index ATTRIBUTE_UNUSED,
                     int alignment ATTRIBUTE_UNUSED,
                     int quadrant,
@@ -7876,7 +7915,7 @@ create_new_subspace (sd_chain_struct *space,
     }
 
 #ifdef obj_set_subsection_attributes
-  obj_set_subsection_attributes (seg, space->sd_seg, access, sort,
+  obj_set_subsection_attributes (seg, space->sd_seg, access_ctr, sort,
                                 quadrant, comdat, common, dup_common);
 #endif
 
@@ -7896,7 +7935,7 @@ update_subspace (sd_chain_struct *space,
                 int dup_common,
                 int sort,
                 int zero ATTRIBUTE_UNUSED,
-                int access,
+                int access_ctr,
                 int space_index ATTRIBUTE_UNUSED,
                 int alignment ATTRIBUTE_UNUSED,
                 int quadrant,
@@ -7907,7 +7946,7 @@ update_subspace (sd_chain_struct *space,
   chain_entry = is_defined_subspace (name);
 
 #ifdef obj_set_subsection_attributes
-  obj_set_subsection_attributes (section, space->sd_seg, access, sort,
+  obj_set_subsection_attributes (section, space->sd_seg, access_ctr, sort,
                                 quadrant, comdat, common, dup_common);
 #endif