public inbox for archer-commits@sourceware.org
help / color / mirror / Atom feed
* [SCM]  users/jkratoch/dwarf5gcc-gdb: .
@ 2016-11-13 19:17 jkratoch
  0 siblings, 0 replies; 6+ messages in thread
From: jkratoch @ 2016-11-13 19:17 UTC (permalink / raw)
  To: archer-commits

The branch, users/jkratoch/dwarf5gcc-gdb has been updated
       via  5081154c2e916bbfd514f991bf0a0dc468c81fa7 (commit)
       via  cfa30da148c311244fde6d32a616ce7d97a1cae4 (commit)
       via  c11f9e415ff047f16c291252494d88667477636f (commit)
       via  b83a6bf5d493544e21bf1436e9d544ccfa556515 (commit)
       via  115c1ea532332a719649e68d453c4a5ad29289aa (commit)
       via  812e39f75ec8308cc725ab954e362edcc3566d61 (commit)
      from  ace66aaeae939d294394b5952875212aa4079bfb (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email.

- Log -----------------------------------------------------------------
commit 5081154c2e916bbfd514f991bf0a0dc468c81fa7
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Sun Nov 13 20:17:10 2016 +0100

    .

commit cfa30da148c311244fde6d32a616ce7d97a1cae4
Merge: 115c1ea c11f9e4
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Sun Nov 13 20:00:24 2016 +0100

    Merge branch 'dwarf5gcc-gdb' into dwarf5gcc-gdb-callsite

commit c11f9e415ff047f16c291252494d88667477636f
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Sun Nov 13 20:00:15 2016 +0100

    .

commit b83a6bf5d493544e21bf1436e9d544ccfa556515
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Sun Nov 13 19:35:40 2016 +0100

    .

commit 115c1ea532332a719649e68d453c4a5ad29289aa
Merge: 812e39f ace66aa
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Sun Nov 13 17:02:27 2016 +0100

    Merge branch 'dwarf5gcc-gdb' into dwarf5gcc-gdb-callsite

commit 812e39f75ec8308cc725ab954e362edcc3566d61
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Tue Nov 8 20:23:37 2016 +0100

    .

-----------------------------------------------------------------------

Summary of changes:
 gdb/block.c                                        |    4 +-
 gdb/common/common-exceptions.h                     |    2 +-
 gdb/doc/gdb.texinfo                                |   10 +-
 gdb/dwarf2-frame.c                                 |    2 +-
 gdb/dwarf2expr.c                                   |   23 +-
 gdb/dwarf2expr.h                                   |   10 +-
 gdb/dwarf2loc.c                                    |   59 ++--
 gdb/dwarf2read.c                                   |  392 ++++++++++++++------
 gdb/gdbtypes.h                                     |   22 +-
 gdb/stack.c                                        |    5 +-
 gdb/std-operator.def                               |    2 +-
 gdb/symfile.h                                      |    1 +
 gdb/testsuite/gdb.arch/amd64-entry-value-param.exp |    2 +-
 gdb/xcoffread.c                                    |    1 +
 14 files changed, 355 insertions(+), 180 deletions(-)

First 500 lines of diff:
diff --git a/gdb/block.c b/gdb/block.c
index 0dc6b9d..d6327aa 100644
--- a/gdb/block.c
+++ b/gdb/block.c
@@ -239,8 +239,8 @@ call_site_for_pc (struct gdbarch *gdbarch, CORE_ADDR pc)
       /* DW_TAG_gnu_call_site will be missing just if GCC could not determine
 	 the call target.  */
       throw_error (NO_ENTRY_VALUE_ERROR,
-		   _("DW_OP_GNU_entry_value resolving cannot find "
-		     "DW_TAG_GNU_call_site %s in %s"),
+		   _("DW_OP_entry_value resolving cannot find "
+		     "DW_TAG_call_site %s in %s"),
 		   paddress (gdbarch, pc),
 		   (msym.minsym == NULL ? "???"
 		    : MSYMBOL_PRINT_NAME (msym.minsym)));
diff --git a/gdb/common/common-exceptions.h b/gdb/common/common-exceptions.h
index 4cc56b4..2820dad 100644
--- a/gdb/common/common-exceptions.h
+++ b/gdb/common/common-exceptions.h
@@ -87,7 +87,7 @@ enum errors {
      means the register was not saved in the frame.  */
   OPTIMIZED_OUT_ERROR,
 
-  /* DW_OP_GNU_entry_value resolving failed.  */
+  /* DW_OP_entry_value resolving failed.  */
   NO_ENTRY_VALUE_ERROR,
 
   /* Target throwing an error has been closed.  Current command should be
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index df548dc..2e7d07e 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -9848,7 +9848,7 @@ this feature will behave in the @code{default} setting the same way as with the
 @code{no} setting.
 
 This functionality is currently supported only by DWARF 2 debugging format and
-the compiler has to produce @samp{DW_TAG_GNU_call_site} tags.  With
+the compiler has to produce @samp{DW_TAG_call_site} tags.  With
 @value{NGCC}, you need to specify @option{-O -g} during compilation, to get
 this information.
 
@@ -12016,7 +12016,7 @@ some cases @value{GDBN} can determine that @code{C} was tail-called from
 return address set up as if @code{B} called @code{C} normally.
 
 This functionality is currently supported only by DWARF 2 debugging format and
-the compiler has to produce @samp{DW_TAG_GNU_call_site} tags.  With
+the compiler has to produce @samp{DW_TAG_call_site} tags.  With
 @value{NGCC}, you need to specify @option{-O -g} during compilation, to get
 this information.
 
@@ -12069,8 +12069,8 @@ static void __attribute__((noinline, noclone)) a (void) @{ x++; @}
 static void __attribute__((noinline, noclone)) c (void) @{ a (); @}
 int main (void) @{ x (); return 0; @}
 
-Breakpoint 1, DW_OP_GNU_entry_value resolving cannot find
-DW_TAG_GNU_call_site 0x40039a in main
+Breakpoint 1, DW_OP_entry_value resolving cannot find
+DW_TAG_call_site 0x40039a in main
 a () at t.c:3
 3	static void __attribute__((noinline, noclone)) a (void) @{ x++; @}
 (gdb) bt
@@ -12146,7 +12146,7 @@ int main (void) @{ a (5); return 0; @}
 
 (gdb) bt
 #0  c (i=i@@entry=0) at t.c:2
-#1  0x0000000000400428 in a (DW_OP_GNU_entry_value resolving has found
+#1  0x0000000000400428 in a (DW_OP_entry_value resolving has found
 function "a" at 0x400420 can call itself via tail calls
 i=<optimized out>) at t.c:6
 #2  0x000000000040036e in main () at t.c:7
diff --git a/gdb/dwarf2-frame.c b/gdb/dwarf2-frame.c
index beab304..06ae951 100644
--- a/gdb/dwarf2-frame.c
+++ b/gdb/dwarf2-frame.c
@@ -361,7 +361,7 @@ class dwarf_expr_executor : public dwarf_expr_context
 				   union call_site_parameter_u kind_u,
 				   int deref_size) OVERRIDE
   {
-    invalid ("DW_OP_GNU_entry_value");
+    invalid ("DW_OP_entry_value");
   }
 
   CORE_ADDR get_object_address () OVERRIDE
diff --git a/gdb/dwarf2expr.c b/gdb/dwarf2expr.c
index 398ca0e..68bf8ff 100644
--- a/gdb/dwarf2expr.c
+++ b/gdb/dwarf2expr.c
@@ -423,7 +423,7 @@ dwarf_block_to_dwarf_reg (const gdb_byte *buf, const gdb_byte *buf_end)
       return *buf - DW_OP_reg0;
     }
 
-  if (*buf == DW_OP_GNU_regval_type)
+  if (*buf == DW_OP_regval_type || *buf == DW_OP_GNU_regval_type)
     {
       buf++;
       buf = gdb_read_uleb128 (buf, buf_end, &dwarf_reg);
@@ -805,12 +805,13 @@ dwarf_expr_context::execute_stack_op (const gdb_byte *op_ptr,
 	  dwarf_expr_require_composition (op_ptr, op_end, "DW_OP_stack_value");
 	  goto no_push;
 
+	case DW_OP_implicit_pointer:
 	case DW_OP_GNU_implicit_pointer:
 	  {
 	    int64_t len;
 
 	    if (this->ref_addr_size == -1)
-	      error (_("DWARF-2 expression error: DW_OP_GNU_implicit_pointer "
+	      error (_("DWARF-2 expression error: DW_OP_implicit_pointer "
 		       "is not allowed in frame context"));
 
 	    /* The referred-to DIE of sect_offset kind.  */
@@ -825,7 +826,7 @@ dwarf_expr_context::execute_stack_op (const gdb_byte *op_ptr,
 
 	    this->location = DWARF_VALUE_IMPLICIT_POINTER;
 	    dwarf_expr_require_composition (op_ptr, op_end,
-					    "DW_OP_GNU_implicit_pointer");
+					    "DW_OP_implicit_pointer");
 	  }
 	  break;
 
@@ -963,6 +964,7 @@ dwarf_expr_context::execute_stack_op (const gdb_byte *op_ptr,
 
 	case DW_OP_deref:
 	case DW_OP_deref_size:
+	case DW_OP_deref_type:
 	case DW_OP_GNU_deref_type:
 	  {
 	    int addr_size = (op == DW_OP_deref ? this->addr_size : *op_ptr++);
@@ -972,7 +974,7 @@ dwarf_expr_context::execute_stack_op (const gdb_byte *op_ptr,
 
 	    pop ();
 
-	    if (op == DW_OP_GNU_deref_type)
+	    if (op == DW_OP_deref_type || op == DW_OP_GNU_deref_type)
 	      {
 		cu_offset type_die;
 
@@ -1299,6 +1301,7 @@ dwarf_expr_context::execute_stack_op (const gdb_byte *op_ptr,
 	  }
 	  goto no_push;
 	
+	case DW_OP_entry_value:
 	case DW_OP_GNU_entry_value:
 	  {
 	    uint64_t len;
@@ -1307,7 +1310,7 @@ dwarf_expr_context::execute_stack_op (const gdb_byte *op_ptr,
 
 	    op_ptr = safe_read_uleb128 (op_ptr, op_end, &len);
 	    if (op_ptr + len > op_end)
-	      error (_("DW_OP_GNU_entry_value: too few bytes available."));
+	      error (_("DW_OP_entry_value: too few bytes available."));
 
 	    kind_u.dwarf_reg = dwarf_block_to_dwarf_reg (op_ptr, op_ptr + len);
 	    if (kind_u.dwarf_reg != -1)
@@ -1332,7 +1335,7 @@ dwarf_expr_context::execute_stack_op (const gdb_byte *op_ptr,
 		goto no_push;
 	      }
 
-	    error (_("DWARF-2 expression error: DW_OP_GNU_entry_value is "
+	    error (_("DWARF-2 expression error: DW_OP_entry_value is "
 		     "supported only for single DW_OP_reg* "
 		     "or for DW_OP_breg*(0)+DW_OP_deref*"));
 	  }
@@ -1350,6 +1353,7 @@ dwarf_expr_context::execute_stack_op (const gdb_byte *op_ptr,
 	  }
 	  goto no_push;
 
+	case DW_OP_const_type:
 	case DW_OP_GNU_const_type:
 	  {
 	    cu_offset type_die;
@@ -1368,6 +1372,7 @@ dwarf_expr_context::execute_stack_op (const gdb_byte *op_ptr,
 	  }
 	  break;
 
+	case DW_OP_regval_type:
 	case DW_OP_GNU_regval_type:
 	  {
 	    cu_offset type_die;
@@ -1382,7 +1387,9 @@ dwarf_expr_context::execute_stack_op (const gdb_byte *op_ptr,
 	  }
 	  break;
 
+	case DW_OP_convert:
 	case DW_OP_GNU_convert:
+	case DW_OP_reinterpret:
 	case DW_OP_GNU_reinterpret:
 	  {
 	    cu_offset type_die;
@@ -1399,7 +1406,7 @@ dwarf_expr_context::execute_stack_op (const gdb_byte *op_ptr,
 	    result_val = fetch (0);
 	    pop ();
 
-	    if (op == DW_OP_GNU_convert)
+	    if (op == DW_OP_convert || op == DW_OP_GNU_convert)
 	      result_val = value_cast (type, result_val);
 	    else if (type == value_type (result_val))
 	      {
@@ -1407,7 +1414,7 @@ dwarf_expr_context::execute_stack_op (const gdb_byte *op_ptr,
 	      }
 	    else if (TYPE_LENGTH (type)
 		     != TYPE_LENGTH (value_type (result_val)))
-	      error (_("DW_OP_GNU_reinterpret has wrong size"));
+	      error (_("DW_OP_reinterpret has wrong size"));
 	    else
 	      result_val
 		= value_from_contents (type,
diff --git a/gdb/dwarf2expr.h b/gdb/dwarf2expr.h
index 883c54c..7692c33 100644
--- a/gdb/dwarf2expr.h
+++ b/gdb/dwarf2expr.h
@@ -164,7 +164,7 @@ struct dwarf_expr_context
   /* Return the PC for the frame.  */
   virtual CORE_ADDR get_frame_pc ()
   {
-    error (_("%s is invalid in this context"), "DW_OP_GNU_implicit_pointer");
+    error (_("%s is invalid in this context"), "DW_OP_implicit_pointer");
   }
 
   /* Return the thread-local storage address for
@@ -187,10 +187,10 @@ struct dwarf_expr_context
     return builtin_type (this->gdbarch)->builtin_int;
   }
 
-  /* Push on DWARF stack an entry evaluated for DW_TAG_GNU_call_site's
+  /* Push on DWARF stack an entry evaluated for DW_TAG_call_site's
      parameter matching KIND and KIND_U at the caller of specified BATON.
-     If DEREF_SIZE is not -1 then use DW_AT_GNU_call_site_data_value instead of
-     DW_AT_GNU_call_site_value.  */
+     If DEREF_SIZE is not -1 then use DW_AT_call_data_value instead of
+     DW_AT_call_value.  */
   virtual void push_dwarf_reg_entry_value (enum call_site_parameter_kind kind,
 					   union call_site_parameter_u kind_u,
 					   int deref_size) = 0;
@@ -248,7 +248,7 @@ struct dwarf_expr_piece
     /* Used for DWARF_VALUE_IMPLICIT_POINTER.  */
     struct
     {
-      /* The referent DIE from DW_OP_GNU_implicit_pointer.  */
+      /* The referent DIE from DW_OP_implicit_pointer.  */
       sect_offset die;
       /* The byte offset into the resulting data.  */
       LONGEST offset;
diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c
index d33bef8..8ce0ae6 100644
--- a/gdb/dwarf2loc.c
+++ b/gdb/dwarf2loc.c
@@ -576,9 +576,9 @@ class dwarf_evaluate_loc_desc : public dwarf_expr_context
   {
     struct type *result = dwarf2_get_die_type (die_offset, per_cu);
     if (result == NULL)
-      error (_("Could not find type for DW_OP_GNU_const_type"));
+      error (_("Could not find type for DW_OP_const_type"));
     if (size != 0 && TYPE_LENGTH (result) != size)
-      error (_("DW_OP_GNU_const_type has different sizes for type and data"));
+      error (_("DW_OP_const_type has different sizes for type and data"));
     return result;
   }
 
@@ -628,7 +628,7 @@ class dwarf_evaluate_loc_desc : public dwarf_expr_context
     /* DEREF_SIZE size is not verified here.  */
     if (data_src == NULL)
       throw_error (NO_ENTRY_VALUE_ERROR,
-		   _("Cannot resolve DW_AT_GNU_call_site_data_value"));
+		   _("Cannot resolve DW_AT_call_data_value"));
 
     scoped_restore save_frame = make_scoped_restore (&this->frame,
 						     caller_frame);
@@ -720,7 +720,7 @@ show_entry_values_debug (struct ui_file *file, int from_tty,
 		    value);
 }
 
-/* Find DW_TAG_GNU_call_site's DW_AT_GNU_call_site_target address.
+/* Find DW_TAG_call_site's DW_AT_call_target address.
    CALLER_FRAME (for registers) can be NULL if it is not known.  This function
    always returns valid address or it throws NO_ENTRY_VALUE_ERROR.  */
 
@@ -745,8 +745,7 @@ call_site_to_target_addr (struct gdbarch *call_site_gdbarch,
 	    
 	    msym = lookup_minimal_symbol_by_pc (call_site->pc - 1);
 	    throw_error (NO_ENTRY_VALUE_ERROR,
-			 _("DW_AT_GNU_call_site_target is not specified "
-			   "at %s in %s"),
+			 _("DW_AT_call_target is not specified at %s in %s"),
 			 paddress (call_site_gdbarch, call_site->pc),
 			 (msym.minsym == NULL ? "???"
 			  : MSYMBOL_PRINT_NAME (msym.minsym)));
@@ -758,7 +757,7 @@ call_site_to_target_addr (struct gdbarch *call_site_gdbarch,
 	    
 	    msym = lookup_minimal_symbol_by_pc (call_site->pc - 1);
 	    throw_error (NO_ENTRY_VALUE_ERROR,
-			 _("DW_AT_GNU_call_site_target DWARF block resolving "
+			 _("DW_AT_call_target DWARF block resolving "
 			   "requires known frame which is currently not "
 			   "available at %s in %s"),
 			 paddress (call_site_gdbarch, call_site->pc),
@@ -771,8 +770,7 @@ call_site_to_target_addr (struct gdbarch *call_site_gdbarch,
 	val = dwarf2_evaluate_loc_desc (caller_core_addr_type, caller_frame,
 					dwarf_block->data, dwarf_block->size,
 					dwarf_block->per_cu);
-	/* DW_AT_GNU_call_site_target is a DWARF expression, not a DWARF
-	   location.  */
+	/* DW_AT_call_target is a DWARF expression, not a DWARF location.  */
 	if (VALUE_LVAL (val) == lval_memory)
 	  return value_address (val);
 	else
@@ -822,7 +820,7 @@ func_addr_to_tail_call_list (struct gdbarch *gdbarch, CORE_ADDR addr)
 
   if (sym == NULL || BLOCK_START (SYMBOL_BLOCK_VALUE (sym)) != addr)
     throw_error (NO_ENTRY_VALUE_ERROR,
-		 _("DW_TAG_GNU_call_site resolving failed to find function "
+		 _("DW_TAG_call_site resolving failed to find function "
 		   "name for address %s"),
 		 paddress (gdbarch, addr));
 
@@ -891,7 +889,7 @@ func_verify_no_selftailcall (struct gdbarch *gdbarch, CORE_ADDR verify_addr)
 	      
 	      msym = lookup_minimal_symbol_by_pc (verify_addr);
 	      throw_error (NO_ENTRY_VALUE_ERROR,
-			   _("DW_OP_GNU_entry_value resolving has found "
+			   _("DW_OP_entry_value resolving has found "
 			     "function \"%s\" at %s can call itself via tail "
 			     "calls"),
 			   (msym.minsym == NULL ? "???"
@@ -1264,7 +1262,7 @@ dwarf_expr_reg_to_entry_parameter (struct frame_info *frame,
       struct gdbarch *caller_gdbarch = frame_unwind_arch (frame);
 
       throw_error (NO_ENTRY_VALUE_ERROR,
-		   _("DW_OP_GNU_entry_value resolving callee gdbarch %s "
+		   _("DW_OP_entry_value resolving callee gdbarch %s "
 		     "(of %s (%s)) does not match caller gdbarch %s"),
 		   gdbarch_bfd_arch_info (gdbarch)->printable_name,
 		   paddress (gdbarch, func_addr),
@@ -1278,7 +1276,7 @@ dwarf_expr_reg_to_entry_parameter (struct frame_info *frame,
       struct bound_minimal_symbol msym
 	= lookup_minimal_symbol_by_pc (func_addr);
 
-      throw_error (NO_ENTRY_VALUE_ERROR, _("DW_OP_GNU_entry_value resolving "
+      throw_error (NO_ENTRY_VALUE_ERROR, _("DW_OP_entry_value resolving "
 					   "requires caller of %s (%s)"),
 		   paddress (gdbarch, func_addr),
 		   (msym.minsym == NULL ? "???"
@@ -1295,7 +1293,7 @@ dwarf_expr_reg_to_entry_parameter (struct frame_info *frame,
       target_msym = lookup_minimal_symbol_by_pc (target_addr).minsym;
       func_msym = lookup_minimal_symbol_by_pc (func_addr).minsym;
       throw_error (NO_ENTRY_VALUE_ERROR,
-		   _("DW_OP_GNU_entry_value resolving expects callee %s at %s "
+		   _("DW_OP_entry_value resolving expects callee %s at %s "
 		     "but the called frame is for %s at %s"),
 		   (target_msym == NULL ? "???"
 					: MSYMBOL_PRINT_NAME (target_msym)),
@@ -1319,10 +1317,10 @@ dwarf_expr_reg_to_entry_parameter (struct frame_info *frame,
       struct minimal_symbol *msym
 	= lookup_minimal_symbol_by_pc (caller_pc).minsym;
 
-      /* DW_TAG_GNU_call_site_parameter will be missing just if GCC could not
+      /* DW_TAG_call_site_parameter will be missing just if GCC could not
 	 determine its value.  */
       throw_error (NO_ENTRY_VALUE_ERROR, _("Cannot find matching parameter "
-					   "at DW_TAG_GNU_call_site %s at %s"),
+					   "at DW_TAG_call_site %s at %s"),
 		   paddress (gdbarch, caller_pc),
 		   msym == NULL ? "???" : MSYMBOL_PRINT_NAME (msym)); 
     }
@@ -1332,8 +1330,8 @@ dwarf_expr_reg_to_entry_parameter (struct frame_info *frame,
 }
 
 /* Return value for PARAMETER matching DEREF_SIZE.  If DEREF_SIZE is -1, return
-   the normal DW_AT_GNU_call_site_value block.  Otherwise return the
-   DW_AT_GNU_call_site_data_value (dereferenced) block.
+   the normal DW_AT_call_value block.  Otherwise return the
+   DW_AT_call_data_value (dereferenced) block.
 
    TYPE and CALLER_FRAME specify how to evaluate the DWARF block into returned
    struct value.
@@ -1357,9 +1355,9 @@ dwarf_entry_parameter_to_value (struct call_site_parameter *parameter,
   /* DEREF_SIZE size is not verified here.  */
   if (data_src == NULL)
     throw_error (NO_ENTRY_VALUE_ERROR,
-		 _("Cannot resolve DW_AT_GNU_call_site_data_value"));
+		 _("Cannot resolve DW_AT_call_data_value"));
 
-  /* DW_AT_GNU_call_site_value is a DWARF expression, not a DWARF
+  /* DW_AT_call_value is a DWARF expression, not a DWARF
      location.  Postprocessing of DWARF_VALUE_MEMORY would lose the type from
      DWARF block.  */
   data = (gdb_byte *) alloca (size + 1);
@@ -1410,7 +1408,7 @@ entry_data_value_free_closure (struct value *v)
 
 /* Vector for methods for an entry value reference where the referenced value
    is stored in the caller.  On the first dereference use
-   DW_AT_GNU_call_site_data_value in the caller.  */
+   DW_AT_call_data_value in the caller.  */
 
 static const struct lval_funcs entry_data_value_funcs =
 {
@@ -1425,7 +1423,7 @@ static const struct lval_funcs entry_data_value_funcs =
 
 /* Read parameter of TYPE at (callee) FRAME's function entry.  KIND and KIND_U
    are used to match DW_AT_location at the caller's
-   DW_TAG_GNU_call_site_parameter.
+   DW_TAG_call_site_parameter.
 
    Function always returns non-NULL value.  It throws NO_ENTRY_VALUE_ERROR if it
    cannot resolve the parameter for any reason.  */
@@ -1449,7 +1447,7 @@ value_of_dwarf_reg_entry (struct type *type, struct frame_info *frame,
 					      type, caller_frame,
 					      caller_per_cu);
 
-  /* Check if DW_AT_GNU_call_site_data_value cannot be used.  If it should be
+  /* Check if DW_AT_call_data_value cannot be used.  If it should be
      used and it is not available do not fall back to OUTER_VAL - dereferencing
      TYPE_CODE_REF with non-entry data value would give current value - not the
      entry value.  */
@@ -1477,7 +1475,7 @@ value_of_dwarf_reg_entry (struct type *type, struct frame_info *frame,
 
 /* Read parameter of TYPE at (callee) FRAME's function entry.  DATA and
    SIZE are DWARF block used to match DW_AT_location at the caller's
-   DW_TAG_GNU_call_site_parameter.
+   DW_TAG_call_site_parameter.
 
    Function always returns non-NULL value.  It throws NO_ENTRY_VALUE_ERROR if it
    cannot resolve the parameter for any reason.  */
@@ -1501,7 +1499,7 @@ value_of_dwarf_block_entry (struct type *type, struct frame_info *frame,
      suppressed during normal operation.  The expression can be arbitrary if
      there is no caller-callee entry value binding expected.  */
   throw_error (NO_ENTRY_VALUE_ERROR,
-	       _("DWARF-2 expression error: DW_OP_GNU_entry_value is supported "
+	       _("DWARF-2 expression error: DW_OP_entry_value is supported "
 		 "only for single DW_OP_reg* or for DW_OP_fbreg(*)"));
 }
 
@@ -2196,7 +2194,7 @@ indirect_pieced_value (struct value *value)
 	return NULL;
 
       if (bit_length != 0)
-	error (_("Invalid use of DW_OP_GNU_implicit_pointer"));
+	error (_("Invalid use of DW_OP_implicit_pointer"));
 
       piece = p;
       break;
@@ -2792,7 +2790,7 @@ class symbol_needs_eval_context : public dwarf_expr_context
     per_cu_dwarf_call (this, die_offset, per_cu);
   }
 
-  /* DW_OP_GNU_entry_value accesses require a caller, therefore a
+  /* DW_OP_entry_value accesses require a caller, therefore a
      frame.  */
 
   void push_dwarf_reg_entry_value (enum call_site_parameter_kind kind,
@@ -4153,6 +4151,7 @@ disassemble_dwarf_expression (struct ui_file *stream,
 	  }
 	  break;
 
+	case DW_OP_implicit_pointer:
 	case DW_OP_GNU_implicit_pointer:
 	  {
 	    ul = extract_unsigned_integer (data, offset_size,
@@ -4167,6 +4166,7 @@ disassemble_dwarf_expression (struct ui_file *stream,
 	  }
 	  break;
 
+	case DW_OP_deref_type:
 	case DW_OP_GNU_deref_type:
 	  {
 	    int addr_size = *data++;
@@ -4183,6 +4183,7 @@ disassemble_dwarf_expression (struct ui_file *stream,
 	  }
 	  break;
 
+	case DW_OP_const_type:
 	case DW_OP_GNU_const_type:
 	  {
 	    cu_offset type_die;
@@ -4197,6 +4198,7 @@ disassemble_dwarf_expression (struct ui_file *stream,
 	  }
 	  break;
 
+	case DW_OP_regval_type:
 	case DW_OP_GNU_regval_type:
 	  {
 	    uint64_t reg;
@@ -4216,7 +4218,9 @@ disassemble_dwarf_expression (struct ui_file *stream,
 	  }
 	  break;
 
+	case DW_OP_convert:
 	case DW_OP_GNU_convert:
+	case DW_OP_reinterpret:
 	case DW_OP_GNU_reinterpret:
 	  {
 	    cu_offset type_die;
@@ -4238,6 +4242,7 @@ disassemble_dwarf_expression (struct ui_file *stream,
 	  }
 	  break;
 
+	case DW_OP_entry_value:
 	case DW_OP_GNU_entry_value:
 	  data = safe_read_uleb128 (data, end, &ul);
 	  fputc_filtered ('\n', stream);


hooks/post-receive
--
Repository for Project Archer.


^ permalink raw reply	[flat|nested] 6+ messages in thread
* [SCM]  users/jkratoch/dwarf5gcc-gdb: .
@ 2016-11-15 21:48 jkratoch
  0 siblings, 0 replies; 6+ messages in thread
From: jkratoch @ 2016-11-15 21:48 UTC (permalink / raw)
  To: archer-commits

The branch, users/jkratoch/dwarf5gcc-gdb has been updated
       via  8aa283e8758ef15b2f4d3fd53371b865de6f0ba9 (commit)
       via  7ea4d982c44088b89ce4366d3f48f2067d518948 (commit)
      from  5081154c2e916bbfd514f991bf0a0dc468c81fa7 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email.

- Log -----------------------------------------------------------------
commit 8aa283e8758ef15b2f4d3fd53371b865de6f0ba9
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Tue Nov 15 22:48:18 2016 +0100

    .

commit 7ea4d982c44088b89ce4366d3f48f2067d518948
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Tue Nov 15 22:34:21 2016 +0100

    .

-----------------------------------------------------------------------

Summary of changes:
 binutils/dwarf.c |   56 +++++++++++++++++++-------------------
 gdb/dwarf2read.c |   78 +++++++++++++++++++++++++++--------------------------
 2 files changed, 68 insertions(+), 66 deletions(-)

First 500 lines of diff:
diff --git a/binutils/dwarf.c b/binutils/dwarf.c
index 5253f0b..b778014 100644
--- a/binutils/dwarf.c
+++ b/binutils/dwarf.c
@@ -4508,9 +4508,9 @@ display_debug_macro (struct dwarf_section *section,
       unsigned char **extended_ops = NULL;
 
       SAFE_BYTE_GET_AND_INC (version, curr, 2, end);
-      if (version != 4)
+      if (version != 4 && version != 5)
 	{
-	  error (_("Only GNU extension to DWARF 4 of %s is currently supported.\n"),
+	  error (_("Only GNU extension to DWARF 4 or 5 of %s is currently supported.\n"),
 		 section->name);
 	  return 0;
 	}
@@ -4547,10 +4547,10 @@ display_debug_macro (struct dwarf_section *section,
 		  nargs = read_uleb128 (curr, &bytes_read, end);
 		  curr += bytes_read;
 		  if (nargs == 0)
-		    printf (_("    DW_MACRO_GNU_%02x has no arguments\n"), op);
+		    printf (_("    DW_MACRO_%02x has no arguments\n"), op);
 		  else
 		    {
-		      printf (_("    DW_MACRO_GNU_%02x arguments: "), op);
+		      printf (_("    DW_MACRO_%02x arguments: "), op);
 		      for (n = 0; n < nargs; n++)
 			{
 			  unsigned int form;
@@ -4603,7 +4603,7 @@ display_debug_macro (struct dwarf_section *section,
 
 	  switch (op)
 	    {
-	    case DW_MACRO_GNU_start_file:
+	    case DW_MACRO_start_file:
 	      {
 		unsigned int filenum;
 		unsigned char *file_name = NULL, *dir_name = NULL;
@@ -4614,87 +4614,87 @@ display_debug_macro (struct dwarf_section *section,
 		curr += bytes_read;
 
 		if ((flags & 2) == 0)
-		  error (_("DW_MACRO_GNU_start_file used, but no .debug_line offset provided.\n"));
+		  error (_("DW_MACRO_start_file used, but no .debug_line offset provided.\n"));
 		else
 		  file_name
 		    = get_line_filename_and_dirname (line_offset, filenum,
 						     &dir_name);
 		if (file_name == NULL)
-		  printf (_(" DW_MACRO_GNU_start_file - lineno: %d filenum: %d\n"),
+		  printf (_(" DW_MACRO_start_file - lineno: %d filenum: %d\n"),
 			  lineno, filenum);
 		else
-		  printf (_(" DW_MACRO_GNU_start_file - lineno: %d filenum: %d filename: %s%s%s\n"),
+		  printf (_(" DW_MACRO_start_file - lineno: %d filenum: %d filename: %s%s%s\n"),
 			  lineno, filenum,
 			  dir_name != NULL ? (const char *) dir_name : "",
 			  dir_name != NULL ? "/" : "", file_name);
 	      }
 	      break;
 
-	    case DW_MACRO_GNU_end_file:
-	      printf (_(" DW_MACRO_GNU_end_file\n"));
+	    case DW_MACRO_end_file:
+	      printf (_(" DW_MACRO_end_file\n"));
 	      break;
 
-	    case DW_MACRO_GNU_define:
+	    case DW_MACRO_define:
 	      lineno = read_uleb128 (curr, &bytes_read, end);
 	      curr += bytes_read;
 	      string = curr;
 	      curr += strnlen ((char *) string, end - string) + 1;
-	      printf (_(" DW_MACRO_GNU_define - lineno : %d macro : %s\n"),
+	      printf (_(" DW_MACRO_define - lineno : %d macro : %s\n"),
 		      lineno, string);
 	      break;
 
-	    case DW_MACRO_GNU_undef:
+	    case DW_MACRO_undef:
 	      lineno = read_uleb128 (curr, &bytes_read, end);
 	      curr += bytes_read;
 	      string = curr;
 	      curr += strnlen ((char *) string, end - string) + 1;
-	      printf (_(" DW_MACRO_GNU_undef - lineno : %d macro : %s\n"),
+	      printf (_(" DW_MACRO_undef - lineno : %d macro : %s\n"),
 		      lineno, string);
 	      break;
 
-	    case DW_MACRO_GNU_define_indirect:
+	    case DW_MACRO_define_strp:
 	      lineno = read_uleb128 (curr, &bytes_read, end);
 	      curr += bytes_read;
 	      SAFE_BYTE_GET_AND_INC (offset, curr, offset_size, end);
 	      string = fetch_indirect_string (offset);
-	      printf (_(" DW_MACRO_GNU_define_indirect - lineno : %d macro : %s\n"),
+	      printf (_(" DW_MACRO_define_strp - lineno : %d macro : %s\n"),
 		      lineno, string);
 	      break;
 
-	    case DW_MACRO_GNU_undef_indirect:
+	    case DW_MACRO_undef_strp:
 	      lineno = read_uleb128 (curr, &bytes_read, end);
 	      curr += bytes_read;
 	      SAFE_BYTE_GET_AND_INC (offset, curr, offset_size, end);
 	      string = fetch_indirect_string (offset);
-	      printf (_(" DW_MACRO_GNU_undef_indirect - lineno : %d macro : %s\n"),
+	      printf (_(" DW_MACRO_undef_strp - lineno : %d macro : %s\n"),
 		      lineno, string);
 	      break;
 
-	    case DW_MACRO_GNU_transparent_include:
+	    case DW_MACRO_import:
 	      SAFE_BYTE_GET_AND_INC (offset, curr, offset_size, end);
-	      printf (_(" DW_MACRO_GNU_transparent_include - offset : 0x%lx\n"),
+	      printf (_(" DW_MACRO_import - offset : 0x%lx\n"),
 		      (unsigned long) offset);
 	      break;
 
-	    case DW_MACRO_GNU_define_indirect_alt:
+	    case DW_MACRO_define_sup:
 	      lineno = read_uleb128 (curr, &bytes_read, end);
 	      curr += bytes_read;
 	      SAFE_BYTE_GET_AND_INC (offset, curr, offset_size, end);
-	      printf (_(" DW_MACRO_GNU_define_indirect_alt - lineno : %d macro offset : 0x%lx\n"),
+	      printf (_(" DW_MACRO_define_sup - lineno : %d macro offset : 0x%lx\n"),
 		      lineno, (unsigned long) offset);
 	      break;
 
-	    case DW_MACRO_GNU_undef_indirect_alt:
+	    case DW_MACRO_undef_sup:
 	      lineno = read_uleb128 (curr, &bytes_read, end);
 	      curr += bytes_read;
 	      SAFE_BYTE_GET_AND_INC (offset, curr, offset_size, end);
-	      printf (_(" DW_MACRO_GNU_undef_indirect_alt - lineno : %d macro offset : 0x%lx\n"),
+	      printf (_(" DW_MACRO_undef_sup - lineno : %d macro offset : 0x%lx\n"),
 		      lineno, (unsigned long) offset);
 	      break;
 
-	    case DW_MACRO_GNU_transparent_include_alt:
+	    case DW_MACRO_import_sup:
 	      SAFE_BYTE_GET_AND_INC (offset, curr, offset_size, end);
-	      printf (_(" DW_MACRO_GNU_transparent_include_alt - offset : 0x%lx\n"),
+	      printf (_(" DW_MACRO_import_sup - offset : 0x%lx\n"),
 		      (unsigned long) offset);
 	      break;
 
@@ -4713,10 +4713,10 @@ display_debug_macro (struct dwarf_section *section,
 		  desc += bytes_read;
 		  if (nargs == 0)
 		    {
-		      printf (_(" DW_MACRO_GNU_%02x\n"), op);
+		      printf (_(" DW_MACRO_%02x\n"), op);
 		      break;
 		    }
-		  printf (_(" DW_MACRO_GNU_%02x -"), op);
+		  printf (_(" DW_MACRO_%02x -"), op);
 		  for (n = 0; n < nargs; n++)
 		    {
 		      int val;
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 61c948a..714253b 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -9326,12 +9326,14 @@ read_file_scope (struct die_info *die, struct dwarf2_cu *cu)
      refers to information in the line number info statement program
      header, so we can only read it if we've read the header
      successfully.  */
-  attr = dwarf2_attr (die, DW_AT_GNU_macros, cu);
+  attr = dwarf2_attr (die, DW_AT_macros, cu);
+  if (attr == NULL)
+    attr = dwarf2_attr (die, DW_AT_GNU_macros, cu);
   if (attr && cu->line_header)
     {
       if (dwarf2_attr (die, DW_AT_macro_info, cu))
 	complaint (&symfile_complaints,
-		   _("CU refers to both DW_AT_GNU_macros and DW_AT_macro_info"));
+		   _("CU refers to both DW_AT_macros and DW_AT_macro_info"));
 
       dwarf_decode_macros (cu, DW_UNSND (attr), 1);
     }
@@ -21691,7 +21693,7 @@ dwarf_parse_macro_header (const gdb_byte **opcode_definitions,
       unsigned int version, flags;
 
       version = read_2_bytes (abfd, mac_ptr);
-      if (version != 4)
+      if (version != 4 && version != 5)
 	{
 	  complaint (&symfile_complaints,
 		     _("unrecognized version `%d' in .debug_macro section"),
@@ -21734,7 +21736,7 @@ dwarf_parse_macro_header (const gdb_byte **opcode_definitions,
 }
 
 /* A helper for dwarf_decode_macros that handles the GNU extensions,
-   including DW_MACRO_GNU_transparent_include.  */
+   including DW_MACRO_import.  */
 
 static void
 dwarf_decode_macro_bytes (bfd *abfd,
@@ -21789,12 +21791,12 @@ dwarf_decode_macro_bytes (bfd *abfd,
 	case 0:
 	  break;
 
-        case DW_MACRO_GNU_define:
-        case DW_MACRO_GNU_undef:
-	case DW_MACRO_GNU_define_indirect:
-	case DW_MACRO_GNU_undef_indirect:
-	case DW_MACRO_GNU_define_indirect_alt:
-	case DW_MACRO_GNU_undef_indirect_alt:
+        case DW_MACRO_define:
+        case DW_MACRO_undef:
+	case DW_MACRO_define_strp:
+	case DW_MACRO_undef_strp:
+	case DW_MACRO_define_sup:
+	case DW_MACRO_undef_sup:
           {
             unsigned int bytes_read;
             int line;
@@ -21804,8 +21806,8 @@ dwarf_decode_macro_bytes (bfd *abfd,
 	    line = read_unsigned_leb128 (abfd, mac_ptr, &bytes_read);
 	    mac_ptr += bytes_read;
 
-	    if (macinfo_type == DW_MACRO_GNU_define
-		|| macinfo_type == DW_MACRO_GNU_undef)
+	    if (macinfo_type == DW_MACRO_define
+		|| macinfo_type == DW_MACRO_undef)
 	      {
 		body = read_direct_string (abfd, mac_ptr, &bytes_read);
 		mac_ptr += bytes_read;
@@ -21817,8 +21819,8 @@ dwarf_decode_macro_bytes (bfd *abfd,
 		str_offset = read_offset_1 (abfd, mac_ptr, offset_size);
 		mac_ptr += offset_size;
 
-		if (macinfo_type == DW_MACRO_GNU_define_indirect_alt
-		    || macinfo_type == DW_MACRO_GNU_undef_indirect_alt
+		if (macinfo_type == DW_MACRO_define_sup
+		    || macinfo_type == DW_MACRO_undef_sup
 		    || section_is_dwz)
 		  {
 		    struct dwz_file *dwz = dwarf2_get_dwz_file ();
@@ -21829,9 +21831,9 @@ dwarf_decode_macro_bytes (bfd *abfd,
 		  body = read_indirect_string_at_offset (abfd, str_offset);
 	      }
 
-	    is_define = (macinfo_type == DW_MACRO_GNU_define
-			 || macinfo_type == DW_MACRO_GNU_define_indirect
-			 || macinfo_type == DW_MACRO_GNU_define_indirect_alt);
+	    is_define = (macinfo_type == DW_MACRO_define
+			 || macinfo_type == DW_MACRO_define_strp
+			 || macinfo_type == DW_MACRO_define_sup);
             if (! current_file)
 	      {
 		/* DWARF violation as no main source is present.  */
@@ -21854,15 +21856,15 @@ dwarf_decode_macro_bytes (bfd *abfd,
 	      parse_macro_definition (current_file, line, body);
 	    else
 	      {
-		gdb_assert (macinfo_type == DW_MACRO_GNU_undef
-			    || macinfo_type == DW_MACRO_GNU_undef_indirect
-			    || macinfo_type == DW_MACRO_GNU_undef_indirect_alt);
+		gdb_assert (macinfo_type == DW_MACRO_undef
+			    || macinfo_type == DW_MACRO_undef_strp
+			    || macinfo_type == DW_MACRO_undef_sup);
 		macro_undef (current_file, line, body);
 	      }
           }
           break;
 
-        case DW_MACRO_GNU_start_file:
+        case DW_MACRO_start_file:
           {
             unsigned int bytes_read;
             int line, file;
@@ -21882,7 +21884,7 @@ dwarf_decode_macro_bytes (bfd *abfd,
 
 	    if (at_commandline)
 	      {
-		/* This DW_MACRO_GNU_start_file was executed in the
+		/* This DW_MACRO_start_file was executed in the
 		   pass one.  */
 		at_commandline = 0;
 	      }
@@ -21891,7 +21893,7 @@ dwarf_decode_macro_bytes (bfd *abfd,
           }
           break;
 
-        case DW_MACRO_GNU_end_file:
+        case DW_MACRO_end_file:
           if (! current_file)
 	    complaint (&symfile_complaints,
 		       _("macro debug info has an unmatched "
@@ -21930,8 +21932,8 @@ dwarf_decode_macro_bytes (bfd *abfd,
             }
           break;
 
-	case DW_MACRO_GNU_transparent_include:
-	case DW_MACRO_GNU_transparent_include_alt:
+	case DW_MACRO_import:
+	case DW_MACRO_import_sup:
 	  {
 	    LONGEST offset;
 	    void **slot;
@@ -21944,7 +21946,7 @@ dwarf_decode_macro_bytes (bfd *abfd,
 	    offset = read_offset_1 (abfd, mac_ptr, offset_size);
 	    mac_ptr += offset_size;
 
-	    if (macinfo_type == DW_MACRO_GNU_transparent_include_alt)
+	    if (macinfo_type == DW_MACRO_import_sup)
 	      {
 		struct dwz_file *dwz = dwarf2_get_dwz_file ();
 
@@ -21964,7 +21966,7 @@ dwarf_decode_macro_bytes (bfd *abfd,
 		/* This has actually happened; see
 		   http://sourceware.org/bugzilla/show_bug.cgi?id=13568.  */
 		complaint (&symfile_complaints,
-			   _("recursive DW_MACRO_GNU_transparent_include in "
+			   _("recursive DW_MACRO_import in "
 			     ".debug_macro section"));
 	      }
 	    else
@@ -22107,8 +22109,8 @@ dwarf_decode_macros (struct dwarf2_cu *cu, unsigned int offset,
         case 0:
 	  break;
 
-	case DW_MACRO_GNU_define:
-	case DW_MACRO_GNU_undef:
+	case DW_MACRO_define:
+	case DW_MACRO_undef:
 	  /* Only skip the data by MAC_PTR.  */
 	  {
 	    unsigned int bytes_read;
@@ -22120,7 +22122,7 @@ dwarf_decode_macros (struct dwarf2_cu *cu, unsigned int offset,
 	  }
 	  break;
 
-	case DW_MACRO_GNU_start_file:
+	case DW_MACRO_start_file:
 	  {
 	    unsigned int bytes_read;
 	    int line, file;
@@ -22134,14 +22136,14 @@ dwarf_decode_macros (struct dwarf2_cu *cu, unsigned int offset,
 	  }
 	  break;
 
-	case DW_MACRO_GNU_end_file:
+	case DW_MACRO_end_file:
 	  /* No data to skip by MAC_PTR.  */
 	  break;
 
-	case DW_MACRO_GNU_define_indirect:
-	case DW_MACRO_GNU_undef_indirect:
-	case DW_MACRO_GNU_define_indirect_alt:
-	case DW_MACRO_GNU_undef_indirect_alt:
+	case DW_MACRO_define_strp:
+	case DW_MACRO_undef_strp:
+	case DW_MACRO_define_sup:
+	case DW_MACRO_undef_sup:
 	  {
 	    unsigned int bytes_read;
 
@@ -22151,10 +22153,10 @@ dwarf_decode_macros (struct dwarf2_cu *cu, unsigned int offset,
 	  }
 	  break;
 
-	case DW_MACRO_GNU_transparent_include:
-	case DW_MACRO_GNU_transparent_include_alt:
+	case DW_MACRO_import:
+	case DW_MACRO_import_sup:
 	  /* Note that, according to the spec, a transparent include
-	     chain cannot call DW_MACRO_GNU_start_file.  So, we can just
+	     chain cannot call DW_MACRO_start_file.  So, we can just
 	     skip this opcode.  */
 	  mac_ptr += offset_size;
 	  break;


hooks/post-receive
--
Repository for Project Archer.


^ permalink raw reply	[flat|nested] 6+ messages in thread
* [SCM]  users/jkratoch/dwarf5gcc-gdb: .
@ 2016-11-07 22:51 jkratoch
  0 siblings, 0 replies; 6+ messages in thread
From: jkratoch @ 2016-11-07 22:51 UTC (permalink / raw)
  To: archer-commits

The branch, users/jkratoch/dwarf5gcc-gdb has been updated
       via  5f99143a907a0191391a4c691deb530b4420216d (commit)
       via  df3771590d6773e93604a8b6f8a6208b46efed88 (commit)
       via  3e11dd8696f156b8e79f5b2188be1cf8f894e85b (commit)
       via  7a34932bce1342c970a03128bbccc5a81ae3da6b (commit)
       via  e680a6b69b4bd173a180419e973a9bf18a000151 (commit)
       via  9af89fbaecca21b2ca34c142584165066807fb10 (commit)
       via  b93bfa1980fa4d1229874067dd36acd9ac5685cd (commit)
      from  4cd5f9f6dd33da4a2186ca8bc1e46739a36ba493 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email.

- Log -----------------------------------------------------------------
commit 5f99143a907a0191391a4c691deb530b4420216d
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Mon Nov 7 23:50:53 2016 +0100

    .

commit df3771590d6773e93604a8b6f8a6208b46efed88
Merge: 4cd5f9f 3e11dd8
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Mon Nov 7 21:58:40 2016 +0100

    Merge branch 'dwarf5gcc' into dwarf5gcc-gdb

-----------------------------------------------------------------------

Summary of changes:
 bfd/version.h         |    2 +-
 binutils/dwarf.c      |  498 ++++++++++++++++++++++++++++++++-----------------
 gold/ChangeLog        |    5 +
 gold/configure        |    2 +-
 gold/configure.ac     |    2 +-
 ld/ChangeLog          |   14 ++
 ld/emultempl/elf32.em |   75 +++++---
 ld/ld.texinfo         |   43 +++-
 8 files changed, 431 insertions(+), 210 deletions(-)

First 500 lines of diff:
diff --git a/bfd/version.h b/bfd/version.h
index f2750d9..fd3d5fd 100644
--- a/bfd/version.h
+++ b/bfd/version.h
@@ -1,4 +1,4 @@
-#define BFD_VERSION_DATE 20161106
+#define BFD_VERSION_DATE 20161107
 #define BFD_VERSION @bfd_version@
 #define BFD_VERSION_STRING  @bfd_version_package@ @bfd_version_string@
 #define REPORT_BUGS_TO @report_bugs_to@
diff --git a/binutils/dwarf.c b/binutils/dwarf.c
index 26af574..333b10e 100644
--- a/binutils/dwarf.c
+++ b/binutils/dwarf.c
@@ -2931,45 +2931,18 @@ read_debug_line_header (struct dwarf_section * section,
 }
 
 static unsigned char *
-display_formatted_entry (unsigned char *format, unsigned char *data,
-			 unsigned char *end,
-			 const DWARF2_Internal_LineInfo * linfo,
-			 struct dwarf_section * section)
-{
-  unsigned char format_count;
-  unsigned int bytes_read;
-  int i;
-
-  SAFE_BYTE_GET_AND_INC (format_count, format, 1, end);
-  for (i = 0; i < format_count; i++)
-    {
-      dwarf_vma form;
-
-      read_uleb128 (format, & bytes_read, end);
-      format += bytes_read;
-      form = read_uleb128 (format, & bytes_read, end);
-      format += bytes_read;
-      putchar ('\t');
-      data = read_and_display_attr_value (0, form, 0, data, end, 0, 0,
-					  linfo->li_offset_size,
-					  linfo->li_version, NULL, 0, section,
-					  NULL);
-    }
-  return data;
-}
-
-static unsigned char *
 display_formatted_table (unsigned char *data,
 			 unsigned char *start, unsigned char *end,
 			 const DWARF2_Internal_LineInfo *linfo,
 			 struct dwarf_section *section, const char *what)
 {
-  unsigned char *format = data;
-  unsigned char format_count;
+  unsigned char *format_start, format_count, *format;
   dwarf_vma data_count, i;
   unsigned int bytes_read;
+  unsigned int last_entry = 0;
 
   SAFE_BYTE_GET_AND_INC (format_count, data, 1, end);
+  format_start = data;
   for (i = 0; i < format_count; i++)
     {
       read_uleb128 (data, & bytes_read, end);
@@ -2978,7 +2951,7 @@ display_formatted_table (unsigned char *data,
       data += bytes_read;
       if (data == end)
 	{
-	  warn (_("Corrupt directory entry format table entry\n"));
+	  warn (_("Corrupt %s entry format table entry\n"), what);
 	  return data;
 	}
     }
@@ -2987,65 +2960,77 @@ display_formatted_table (unsigned char *data,
   data += bytes_read;
   if (data == end)
     {
-      warn (_("Corrupt directories list\n"));
+      warn (_("Corrupt %s list\n"), what);
       return data;
     }
 
   if (data_count == 0)
-    printf (_("\n The %s Table is empty.\n"), what);
-  else
     {
-      unsigned int last_entry = 0;
-      unsigned char *format_header = format;
+      printf (_("\n The %s Table is empty.\n"), what);
+      return data;
+    }
 
-      printf (_("\n The %s Table (offset 0x%lx):\n"), what,
-	      (long)(data - start));
+  printf (_("\n The %s Table (offset 0x%lx):\n"), what,
+	  (long)(data - start));
 
-      printf (_("  Entry"));
-      SAFE_BYTE_GET_AND_INC (format_count, format_header, 1, end);
+  printf (_("  Entry"));
+  format = format_start;
+  for (i = 0; i < format_count; i++)
+    {
+      dwarf_vma content_type;
+
+      content_type = read_uleb128 (format, & bytes_read, end);
+      format += bytes_read;
+      switch (content_type)
+	{
+	case DW_LNCT_path:
+	  printf (_("\tName"));
+	  break;
+	case DW_LNCT_directory_index:
+	  printf (_("\tDir"));
+	  break;
+	case DW_LNCT_timestamp:
+	  printf (_("\tTime"));
+	  break;
+	case DW_LNCT_size:
+	  printf (_("\tSize"));
+	  break;
+	case DW_LNCT_MD5:
+	  printf (_("\tMD5"));
+	  break;
+	default:
+	  printf (_("\t(Unknown format content type %s)"),
+		  dwarf_vmatoa ("u", content_type));
+	}
+      read_uleb128 (format, & bytes_read, end);
+      format += bytes_read;
+    }
+  putchar ('\n');
+
+  for (i = 0; i < data_count; i++)
+    {
+      format = format_start;
+      printf ("  %d", last_entry++);
       for (i = 0; i < format_count; i++)
 	{
-	  dwarf_vma content_type;
+	  dwarf_vma form;
 
-	  content_type = read_uleb128 (format_header, & bytes_read, end);
-	  format_header += bytes_read;
-	  switch (content_type)
-	    {
-	    case DW_LNCT_path:
-	      printf (_("\tName"));
-	      break;
-	    case DW_LNCT_directory_index:
-	      printf (_("\tDir"));
-	      break;
-	    case DW_LNCT_timestamp:
-	      printf (_("\tTime"));
-	      break;
-	    case DW_LNCT_size:
-	      printf (_("\tSize"));
-	      break;
-	    case DW_LNCT_MD5:
-	      printf (_("\tMD5"));
-	      break;
-	    default:
-	      printf (_("\t(Unknown format content type %s)"),
-		      dwarf_vmatoa ("u", content_type));
-	    }
-	  read_uleb128 (format_header, & bytes_read, end);
-	  format_header += bytes_read;
+	  read_uleb128 (format, & bytes_read, end);
+	  format += bytes_read;
+	  form = read_uleb128 (format, & bytes_read, end);
+	  format += bytes_read;
+	  putchar ('\t');
+	  data = read_and_display_attr_value (0, form, 0, data, end, 0, 0,
+					      linfo->li_offset_size,
+					      linfo->li_version, NULL, 0,
+					      section, NULL);
 	}
-      putchar ('\n');
-
-      for (i = 0; i < data_count; i++)
+      if (data == end)
 	{
-	  printf ("  %d\t", last_entry++);
-	  data = display_formatted_entry (format, data, end, linfo, section);
-	  if (data == end)
-	    {
-	      warn (_("Corrupt directory entries list\n"));
-	      return data;
-	    }
-	  putchar ('\n');
+	  warn (_("Corrupt %s entries list\n"), what);
+	  return data;
 	}
+      putchar ('\n');
     }
   return data;
 }
@@ -3143,13 +3128,12 @@ display_debug_lines_raw (struct dwarf_section *section,
 
 	  if (linfo.li_version >= 5)
 	    {
-	      load_debug_section (str, file);
 	      load_debug_section (line_str, file);
 
 	      data = display_formatted_table (data, start, end, &linfo, section,
-					      "Directory");
+					      _("Directory"));
 	      data = display_formatted_table (data, start, end, &linfo, section,
-					      "File name");
+					      _("File name"));
 	    }
 	  else
 	    {
@@ -3431,7 +3415,7 @@ typedef struct
 static int
 display_debug_lines_decoded (struct dwarf_section *section,
 			     unsigned char *data,
-			     unsigned char *end)
+			     unsigned char *end, void *fileptr)
 {
   static DWARF2_Internal_LineInfo saved_linfo;
 
@@ -3448,7 +3432,7 @@ display_debug_lines_decoded (struct dwarf_section *section,
       File_Entry *file_table = NULL;
       unsigned int n_files = 0;
       unsigned char **directory_table = NULL;
-      unsigned int n_directories = 0;
+      dwarf_vma n_directories = 0;
 
       if (const_strneq (section->name, ".debug_line.")
 	  /* Note: the following does not apply to .debug_line.dwo sections.
@@ -3496,129 +3480,304 @@ display_debug_lines_decoded (struct dwarf_section *section,
 	      return 0;
 	    }
 
-	  if (*data != 0)
+	  if (linfo.li_version >= 5)
 	    {
-	      unsigned char *ptr_directory_table = data;
+	      unsigned char *format_start, format_count, *format;
+	      dwarf_vma formati, entryi;
+	      unsigned int bytes_read;
+
+	      load_debug_section (line_str, fileptr);
 
-	      while (data < end && *data != 0)
+	      /* Skip directories format.  */
+	      SAFE_BYTE_GET_AND_INC (format_count, data, 1, end);
+	      format_start = data;
+	      for (formati = 0; formati < format_count; formati++)
 		{
-		  data += strnlen ((char *) data, end - data) + 1;
-		  n_directories++;
+		  read_uleb128 (data, & bytes_read, end);
+		  data += bytes_read;
+		  read_uleb128 (data, & bytes_read, end);
+		  data += bytes_read;
 		}
 
-	      /* PR 20440 */
-	      if (data >= end)
+	      n_directories = read_uleb128 (data, & bytes_read, end);
+	      data += bytes_read;
+	      if (data == end)
 		{
-		  warn (_("directory table ends unexpectedly\n"));
-		  n_directories = 0;
+		  warn (_("Corrupt directories list\n"));
 		  break;
 		}
 
-	      /* Go through the directory table again to save the directories.  */
 	      directory_table = (unsigned char **)
 		xmalloc (n_directories * sizeof (unsigned char *));
 
-	      i = 0;
-	      while (*ptr_directory_table != 0)
+	      for (entryi = 0; entryi < n_directories; entryi++)
 		{
-		  directory_table[i] = ptr_directory_table;
-		  ptr_directory_table += strnlen ((char *) ptr_directory_table,
-						  ptr_directory_table - end) + 1;
-		  i++;
-		}
-	    }
-	  /* Skip the NUL at the end of the table.  */
-	  data++;
+		  unsigned char **pathp = &directory_table[entryi];
 
-	  /* Traverse the File Name table just to count the entries.  */
-	  if (data < end && *data != 0)
-	    {
-	      unsigned char *ptr_file_name_table = data;
+		  format = format_start;
+		  for (formati = 0; formati < format_count; formati++)
+		    {
+		      dwarf_vma content_type, form;
+		      dwarf_vma uvalue;
 
-	      while (data < end && *data != 0)
-		{
-		  unsigned int bytes_read;
+		      content_type = read_uleb128 (format, & bytes_read, end);
+		      format += bytes_read;
+		      form = read_uleb128 (format, & bytes_read, end);
+		      format += bytes_read;
+		      if (data == end)
+			{
+			  warn (_("Corrupt directories list\n"));
+			  break;
+			}
+		      switch (content_type)
+			{
+			case DW_LNCT_path:
+			  switch (form)
+			    {
+			    case DW_FORM_string:
+			      *pathp = data;
+			      break;
+			    case DW_FORM_line_strp:
+			      SAFE_BYTE_GET (uvalue, data, linfo.li_offset_size,
+					     end);
+			      /* Remove const by the cast.  */
+			      *pathp = (unsigned char *)
+				       fetch_indirect_line_string (uvalue);
+			      break;
+			    }
+			  break;
+			}
+		      data = read_and_display_attr_value (0, form, 0, data, end,
+		                                          0, 0,
+							  linfo.li_offset_size,
+							  linfo.li_version,
+							  NULL, 1, section,
+							  NULL);
+		    }
+		  if (data == end)
+		    {
+		      warn (_("Corrupt directories list\n"));
+		      break;
+		    }
+		}
 
-		  /* Skip Name, directory index, last modification time and length
-		     of file.  */
-		  data += strnlen ((char *) data, end - data) + 1;
-		  read_uleb128 (data, & bytes_read, end);
-		  data += bytes_read;
+	      /* Skip files format.  */
+	      SAFE_BYTE_GET_AND_INC (format_count, data, 1, end);
+	      format_start = data;
+	      for (formati = 0; formati < format_count; formati++)
+		{
 		  read_uleb128 (data, & bytes_read, end);
 		  data += bytes_read;
 		  read_uleb128 (data, & bytes_read, end);
 		  data += bytes_read;
-
-		  n_files++;
 		}
 
-	      if (data >= end)
+	      n_files = read_uleb128 (data, & bytes_read, end);
+	      data += bytes_read;
+	      if (data == end)
 		{
-		  warn (_("file table ends unexpectedly\n"));
-		  n_files = 0;
+		  warn (_("Corrupt file name list\n"));
 		  break;
 		}
 
-	      /* Go through the file table again to save the strings.  */
-	      file_table = (File_Entry *) xmalloc (n_files * sizeof (File_Entry));
+	      file_table = (File_Entry *) xcalloc (1, n_files
+						      * sizeof (File_Entry));
 
-	      i = 0;
-	      while (*ptr_file_name_table != 0)
+	      for (entryi = 0; entryi < n_files; entryi++)
 		{
-		  unsigned int bytes_read;
-
-		  file_table[i].name = ptr_file_name_table;
-		  ptr_file_name_table += strnlen ((char *) ptr_file_name_table,
-						  end - ptr_file_name_table) + 1;
-
-		  /* We are not interested in directory, time or size.  */
-		  file_table[i].directory_index = read_uleb128 (ptr_file_name_table,
-								& bytes_read, end);
-		  ptr_file_name_table += bytes_read;
-		  file_table[i].modification_date = read_uleb128 (ptr_file_name_table,
-								  & bytes_read, end);
-		  ptr_file_name_table += bytes_read;
-		  file_table[i].length = read_uleb128 (ptr_file_name_table, & bytes_read, end);
-		  ptr_file_name_table += bytes_read;
-		  i++;
-		}
-	      i = 0;
+		  File_Entry *file = &file_table[entryi];
+
+		  format = format_start;
+		  for (formati = 0; formati < format_count; formati++)
+		    {
+		      dwarf_vma content_type, form;
+		      dwarf_vma uvalue;
 
-	      /* Print the Compilation Unit's name and a header.  */
-	      if (directory_table == NULL)
+		      content_type = read_uleb128 (format, & bytes_read, end);
+		      format += bytes_read;
+		      form = read_uleb128 (format, & bytes_read, end);
+		      format += bytes_read;
+		      if (data == end)
+			{
+			  warn (_("Corrupt file name list\n"));
+			  break;
+			}
+		      switch (content_type)
+			{
+			case DW_LNCT_path:
+			  switch (form)
+			    {
+			    case DW_FORM_string:
+			      file->name = data;
+			      break;
+			    case DW_FORM_line_strp:
+			      SAFE_BYTE_GET (uvalue, data, linfo.li_offset_size,
+					     end);
+			      /* Remove const by the cast.  */
+			      file->name = (unsigned char *)
+					   fetch_indirect_line_string (uvalue);
+			      break;
+			    }
+			  break;
+			case DW_LNCT_directory_index:
+			  switch (form)
+			    {
+			    case DW_FORM_data1:
+			      SAFE_BYTE_GET (file->directory_index, data, 1,
+					     end);
+			      break;
+			    case DW_FORM_data2:
+			      SAFE_BYTE_GET (file->directory_index, data, 2,
+					     end);
+			      break;
+			    case DW_FORM_udata:
+			      file->directory_index = read_uleb128 (data, NULL,
+								    end);
+			      break;
+			    }
+			  break;
+			}
+		      data = read_and_display_attr_value (0, form, 0, data, end,
+							  0, 0,
+							  linfo.li_offset_size,
+							  linfo.li_version,
+							  NULL, 1, section,
+							  NULL);
+		    }
+		  if (data == end)
+		    {
+		      warn (_("Corrupt file name list\n"));
+		      break;
+		    }
+		}
+	    }
+	  else
+	    {
+	      if (*data != 0)
 		{
-		  printf (_("CU: %s:\n"), file_table[0].name);
-		  printf (_("File name                            Line number    Starting address\n"));
+		  unsigned char *ptr_directory_table = data;
+
+		  while (data < end && *data != 0)
+		    {
+		      data += strnlen ((char *) data, end - data) + 1;
+		      n_directories++;
+		    }
+
+		  /* PR 20440 */
+		  if (data >= end)
+		    {
+		      warn (_("directory table ends unexpectedly\n"));
+		      n_directories = 0;
+		      break;
+		    }
+
+		  /* Go through the directory table again to save the directories.  */
+		  directory_table = (unsigned char **)
+		    xmalloc (n_directories * sizeof (unsigned char *));
+
+		  i = 0;
+		  while (*ptr_directory_table != 0)
+		    {
+		      directory_table[i] = ptr_directory_table;
+		      ptr_directory_table += strnlen ((char *) ptr_directory_table,
+						      ptr_directory_table - end) + 1;
+		      i++;
+		    }


hooks/post-receive
--
Repository for Project Archer.


^ permalink raw reply	[flat|nested] 6+ messages in thread
* [SCM]  users/jkratoch/dwarf5gcc-gdb: .
@ 2016-11-03 18:32 jkratoch
  0 siblings, 0 replies; 6+ messages in thread
From: jkratoch @ 2016-11-03 18:32 UTC (permalink / raw)
  To: archer-commits

The branch, users/jkratoch/dwarf5gcc-gdb has been updated
       via  af98ca37c4e54857543252bf8a81a653bde8bbb1 (commit)
      from  3339a3d5dadae7d79ba6a0773debbd8a193e2596 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email.

- Log -----------------------------------------------------------------
commit af98ca37c4e54857543252bf8a81a653bde8bbb1
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Thu Nov 3 19:32:27 2016 +0100

    .

-----------------------------------------------------------------------

Summary of changes:
 gdb/dwarf2loc.c  |   67 +++++++++++++++++++++++++++++++++++---
 gdb/dwarf2loc.h  |    2 +
 gdb/dwarf2read.c |   95 ++++++++++++++++++++++++++++++++++++++++++++++--------
 gdb/symfile.h    |    1 +
 gdb/xcoffread.c  |    1 +
 5 files changed, 147 insertions(+), 19 deletions(-)

First 500 lines of diff:
diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c
index 6f25314..d7d784d 100644
--- a/gdb/dwarf2loc.c
+++ b/gdb/dwarf2loc.c
@@ -141,6 +141,57 @@ decode_debug_loc_addresses (const gdb_byte *loc_ptr, const gdb_byte *buf_end,
   return DEBUG_LOC_START_END;
 }
 
+/* Decode the addresses in .debug_loclists entry.
+   A pointer to the next byte to examine is returned in *NEW_PTR.
+   The encoded low,high addresses are return in *LOW,*HIGH.
+   The result indicates the kind of entry found.  */
+
+static enum debug_loc_kind
+decode_debug_loclists_addresses (struct dwarf2_per_cu_data *per_cu,
+				 const gdb_byte *loc_ptr,
+				 const gdb_byte *buf_end,
+				 const gdb_byte **new_ptr,
+				 CORE_ADDR *low, CORE_ADDR *high,
+				 enum bfd_endian byte_order,
+				 unsigned int addr_size,
+				 int signed_addr_p)
+{
+  uint64_t u64;
+
+  if (loc_ptr == buf_end)
+    return DEBUG_LOC_BUFFER_OVERFLOW;
+
+  switch (*loc_ptr++)
+    {
+    case DW_LLE_end_of_list:
+      *new_ptr = loc_ptr;
+      return DEBUG_LOC_END_OF_LIST;
+    case DW_LLE_base_address:
+      if (loc_ptr + addr_size > buf_end)
+	return DEBUG_LOC_BUFFER_OVERFLOW;
+      if (signed_addr_p)
+	*high = extract_signed_integer (loc_ptr, addr_size, byte_order);
+      else
+	*high = extract_unsigned_integer (loc_ptr, addr_size, byte_order);
+      loc_ptr += addr_size;
+      *new_ptr = loc_ptr;
+      return DEBUG_LOC_BASE_ADDRESS;
+    case DW_LLE_offset_pair:
+      loc_ptr = gdb_read_uleb128 (loc_ptr, buf_end, &u64);
+      if (loc_ptr == NULL)
+	return DEBUG_LOC_BUFFER_OVERFLOW;
+      *low = u64;
+      loc_ptr = gdb_read_uleb128 (loc_ptr, buf_end, &u64);
+      if (loc_ptr == NULL)
+	return DEBUG_LOC_BUFFER_OVERFLOW;
+      *high = u64;
+      *new_ptr = loc_ptr;
+      return DEBUG_LOC_START_END;
+    default:
+      return DEBUG_LOC_INVALID_ENTRY;
+    }
+}
+
 /* Decode the addresses in .debug_loc.dwo entry.
    A pointer to the next byte to examine is returned in *NEW_PTR.
    The encoded low,high addresses are return in *LOW,*HIGH.
@@ -161,10 +212,10 @@ decode_debug_loc_dwo_addresses (struct dwarf2_per_cu_data *per_cu,
 
   switch (*loc_ptr++)
     {
-    case DEBUG_LOC_END_OF_LIST:
+    case DW_LLE_GNU_end_of_list_entry:
       *new_ptr = loc_ptr;
       return DEBUG_LOC_END_OF_LIST;
-    case DEBUG_LOC_BASE_ADDRESS:
+    case DW_LLE_GNU_base_address_selection_entry:
       *low = 0;
       loc_ptr = gdb_read_uleb128 (loc_ptr, buf_end, &high_index);
       if (loc_ptr == NULL)
@@ -172,7 +223,7 @@ decode_debug_loc_dwo_addresses (struct dwarf2_per_cu_data *per_cu,
       *high = dwarf2_read_addr_index (per_cu, high_index);
       *new_ptr = loc_ptr;
       return DEBUG_LOC_BASE_ADDRESS;
-    case DEBUG_LOC_START_END:
+    case DW_LLE_GNU_start_end_entry:
       loc_ptr = gdb_read_uleb128 (loc_ptr, buf_end, &low_index);
       if (loc_ptr == NULL)
 	return DEBUG_LOC_BUFFER_OVERFLOW;
@@ -183,7 +234,7 @@ decode_debug_loc_dwo_addresses (struct dwarf2_per_cu_data *per_cu,
       *high = dwarf2_read_addr_index (per_cu, high_index);
       *new_ptr = loc_ptr;
       return DEBUG_LOC_START_END;
-    case DEBUG_LOC_START_LENGTH:
+    case DW_LLE_GNU_start_length_entry:
       loc_ptr = gdb_read_uleb128 (loc_ptr, buf_end, &low_index);
       if (loc_ptr == NULL)
 	return DEBUG_LOC_BUFFER_OVERFLOW;
@@ -235,11 +286,17 @@ dwarf2_find_location_expression (struct dwarf2_loclist_baton *baton,
 	kind = decode_debug_loc_dwo_addresses (baton->per_cu,
 					       loc_ptr, buf_end, &new_ptr,
 					       &low, &high, byte_order);
-      else
+      else if (dwarf2_version (baton->per_cu) < 5)
 	kind = decode_debug_loc_addresses (loc_ptr, buf_end, &new_ptr,
 					   &low, &high,
 					   byte_order, addr_size,
 					   signed_addr_p);
+      else
+	kind = decode_debug_loclists_addresses (baton->per_cu,
+						loc_ptr, buf_end, &new_ptr,
+						&low, &high, byte_order,
+						addr_size, signed_addr_p);
+
       loc_ptr = new_ptr;
       switch (kind)
 	{
diff --git a/gdb/dwarf2loc.h b/gdb/dwarf2loc.h
index fa83459..912d1cd 100644
--- a/gdb/dwarf2loc.h
+++ b/gdb/dwarf2loc.h
@@ -56,6 +56,8 @@ int dwarf2_per_cu_offset_size (struct dwarf2_per_cu_data *cu);
    offset in the parent objfile.  */
 CORE_ADDR dwarf2_per_cu_text_offset (struct dwarf2_per_cu_data *cu);
 
+short dwarf2_version (struct dwarf2_per_cu_data *per_cu);
+
 /* Find a particular location expression from a location list.  */
 const gdb_byte *dwarf2_find_location_expression
   (struct dwarf2_loclist_baton *baton,
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 4aed261..1fe176b 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -225,6 +225,7 @@ struct dwarf2_per_objfile
   struct dwarf2_section_info macinfo;
   struct dwarf2_section_info macro;
   struct dwarf2_section_info str;
+  struct dwarf2_section_info line_str;
   struct dwarf2_section_info ranges;
   struct dwarf2_section_info addr;
   struct dwarf2_section_info frame;
@@ -337,6 +338,7 @@ static const struct dwarf2_debug_sections dwarf2_elf_names =
   { ".debug_macinfo", ".zdebug_macinfo" },
   { ".debug_macro", ".zdebug_macro" },
   { ".debug_str", ".zdebug_str" },
+  { ".debug_line_str", ".zdebug_line_str" },
   { ".debug_ranges", ".zdebug_ranges" },
   { ".debug_types", ".zdebug_types" },
   { ".debug_addr", ".zdebug_addr" },
@@ -576,6 +578,8 @@ struct dwarf2_per_cu_data
   sect_offset offset;
   unsigned int length;
 
+  short dwarf_version;
+
   /* Flag indicating this compilation unit will be read in before
      any of the current compilation units are processed.  */
   unsigned int queued : 1;
@@ -1510,6 +1514,10 @@ static const char *read_indirect_string (bfd *, const gdb_byte *,
 					 const struct comp_unit_head *,
 					 unsigned int *);
 
+static const char *read_indirect_line_string (bfd *, const gdb_byte *,
+					      const struct comp_unit_head *,
+					      unsigned int *);
+
 static const char *read_indirect_string_from_dwz (struct dwz_file *, LONGEST);
 
 static ULONGEST read_unsigned_leb128 (bfd *, const gdb_byte *, unsigned int *);
@@ -2227,6 +2235,11 @@ dwarf2_locate_sections (bfd *abfd, asection *sectp, void *vnames)
       dwarf2_per_objfile->loc.s.section = sectp;
       dwarf2_per_objfile->loc.size = bfd_get_section_size (sectp);
     }
+  else if (section_is_p (sectp->name, &names->loclists))
+    {
+      dwarf2_per_objfile->loclists.s.section = sectp;
+      dwarf2_per_objfile->loclists.size = bfd_get_section_size (sectp);
+    }
   else if (section_is_p (sectp->name, &names->macinfo))
     {
       dwarf2_per_objfile->macinfo.s.section = sectp;
@@ -2242,6 +2255,11 @@ dwarf2_locate_sections (bfd *abfd, asection *sectp, void *vnames)
       dwarf2_per_objfile->str.s.section = sectp;
       dwarf2_per_objfile->str.size = bfd_get_section_size (sectp);
     }
+  else if (section_is_p (sectp->name, &names->line_str))
+    {
+      dwarf2_per_objfile->line_str.s.section = sectp;
+      dwarf2_per_objfile->line_str.size = bfd_get_section_size (sectp);
+    }
   else if (section_is_p (sectp->name, &names->addr))
     {
       dwarf2_per_objfile->addr.s.section = sectp;
@@ -5593,6 +5611,8 @@ init_cutu_and_read_dies (struct dwarf2_per_cu_data *this_cu,
 	  /* Establish the type offset that can be used to lookup the type.  */
 	  sig_type->type_offset_in_section.sect_off =
 	    this_cu->offset.sect_off + sig_type->type_offset_in_tu.cu_off;
+
+	  this_cu->dwarf_version = cu->header.version;
 	}
       else
 	{
@@ -5602,6 +5622,7 @@ init_cutu_and_read_dies (struct dwarf2_per_cu_data *this_cu,
 
 	  gdb_assert (this_cu->offset.sect_off == cu->header.offset.sect_off);
 	  gdb_assert (this_cu->length == get_cu_length (&cu->header));
+	  this_cu->dwarf_version = cu->header.version;
 	}
     }
 
@@ -16388,6 +16409,16 @@ read_attribute_value (const struct die_reader_specs *reader,
 	  break;
 	}
       /* FALLTHROUGH */
+    case DW_FORM_line_strp:
+      if (!cu->per_cu->is_dwz)
+	{
+	  DW_STRING (attr) = read_indirect_line_string (abfd, info_ptr,
+							cu_header, &bytes_read);
+	  DW_STRING_IS_CANONICAL (attr) = 0;
+	  info_ptr += bytes_read;
+	  break;
+	}
+      /* FALLTHROUGH */
     case DW_FORM_GNU_strp_alt:
       {
 	struct dwz_file *dwz = dwarf2_get_dwz_file ();
@@ -16801,20 +16832,39 @@ read_direct_string (bfd *abfd, const gdb_byte *buf,
 }
 
 static const char *
-read_indirect_string_at_offset (bfd *abfd, LONGEST str_offset)
-{
-  dwarf2_read_section (dwarf2_per_objfile->objfile, &dwarf2_per_objfile->str);
-  if (dwarf2_per_objfile->str.buffer == NULL)
-    error (_("DW_FORM_strp used without .debug_str section [in module %s]"),
-	   bfd_get_filename (abfd));
-  if (str_offset >= dwarf2_per_objfile->str.size)
-    error (_("DW_FORM_strp pointing outside of "
-	     ".debug_str section [in module %s]"),
-	   bfd_get_filename (abfd));
+read_indirect_string_at_offset_from (bfd *abfd, LONGEST str_offset,
+				     struct dwarf2_section_info *sect,
+				     const char *form_name,
+				     const char *sect_name)
+{
+  dwarf2_read_section (dwarf2_per_objfile->objfile, sect);
+  if (sect->buffer == NULL)
+    error (_("%s used without %s section [in module %s]"),
+	   form_name, sect_name, bfd_get_filename (abfd));
+  if (str_offset >= sect->size)
+    error (_("%s pointing outside of %s section [in module %s]"),
+	   form_name, sect_name, bfd_get_filename (abfd));
   gdb_assert (HOST_CHAR_BIT == 8);
-  if (dwarf2_per_objfile->str.buffer[str_offset] == '\0')
+  if (sect->buffer[str_offset] == '\0')
     return NULL;
-  return (const char *) (dwarf2_per_objfile->str.buffer + str_offset);
+  return (const char *) (sect->buffer + str_offset);
+}
+
+static const char *
+read_indirect_string_at_offset (bfd *abfd, LONGEST str_offset)
+{
+  return read_indirect_string_at_offset_from (abfd, str_offset,
+					      &dwarf2_per_objfile->str,
+					      "DW_FORM_strp", ".debug_str");
+}
+
+static const char *
+read_indirect_line_string_at_offset (bfd *abfd, LONGEST str_offset)
+{
+  return read_indirect_string_at_offset_from (abfd, str_offset,
+					      &dwarf2_per_objfile->line_str,
+					      "DW_FORM_line_strp",
+					      ".debug_line_str");
 }
 
 /* Read a string at offset STR_OFFSET in the .debug_str section from
@@ -16851,6 +16901,16 @@ read_indirect_string (bfd *abfd, const gdb_byte *buf,
   return read_indirect_string_at_offset (abfd, str_offset);
 }
 
+static const char *
+read_indirect_line_string (bfd *abfd, const gdb_byte *buf,
+			   const struct comp_unit_head *cu_header,
+			   unsigned int *bytes_read_ptr)
+{
+  LONGEST str_offset = read_offset (abfd, buf, cu_header, bytes_read_ptr);
+
+  return read_indirect_line_string_at_offset (abfd, str_offset);
+}
+
 static ULONGEST
 read_unsigned_leb128 (bfd *abfd, const gdb_byte *buf,
 		      unsigned int *bytes_read_ptr)
@@ -17213,8 +17273,8 @@ dwarf2_string_attr (struct die_info *die, unsigned int name, struct dwarf2_cu *c
 
   if (attr != NULL)
     {
-      if (attr->form == DW_FORM_strp || attr->form == DW_FORM_string
-	  || attr->form == DW_FORM_GNU_strp_alt)
+      if (attr->form == DW_FORM_strp || attr->form == DW_FORM_line_strp
+	  || attr->form == DW_FORM_string || attr->form == DW_FORM_GNU_strp_alt)
 	str = DW_STRING (attr);
       else
         complaint (&symfile_complaints,
@@ -19881,6 +19941,7 @@ dump_die_shallow (struct ui_file *f, int indent, struct die_info *die)
 	  break;
 	case DW_FORM_string:
 	case DW_FORM_strp:
+	case DW_FORM_line_strp:
 	case DW_FORM_GNU_str_index:
 	case DW_FORM_GNU_strp_alt:
 	  fprintf_unfiltered (f, "string: \"%s\" (%s canonicalized)",
@@ -22093,6 +22154,12 @@ dwarf2_per_cu_text_offset (struct dwarf2_per_cu_data *per_cu)
   return ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
 }
 
+short
+dwarf2_version (struct dwarf2_per_cu_data *per_cu)
+{
+  return per_cu->dwarf_version;
+}
+
 /* Locate the .debug_info compilation unit from CU's objfile which contains
    the DIE at OFFSET.  Raises an error on failure.  */
 
diff --git a/gdb/symfile.h b/gdb/symfile.h
index ae7c34b..51362b0 100644
--- a/gdb/symfile.h
+++ b/gdb/symfile.h
@@ -603,6 +603,7 @@ struct dwarf2_debug_sections {
   struct dwarf2_section_names macinfo;
   struct dwarf2_section_names macro;
   struct dwarf2_section_names str;
+  struct dwarf2_section_names line_str;
   struct dwarf2_section_names ranges;
   struct dwarf2_section_names types;
   struct dwarf2_section_names addr;
diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c
index 1ae83aa..3337aba 100644
--- a/gdb/xcoffread.c
+++ b/gdb/xcoffread.c
@@ -166,6 +166,7 @@ static const struct dwarf2_debug_sections dwarf2_xcoff_names = {
   { NULL, NULL },
   { ".dwmac", NULL },
   { ".dwstr", NULL },
+  { NULL, NULL }, /* debug_line_str */
   { ".dwrnges", NULL },
   { ".dwpbtyp", NULL },
   { NULL, NULL }, /* debug_addr */


hooks/post-receive
--
Repository for Project Archer.


^ permalink raw reply	[flat|nested] 6+ messages in thread
* [SCM]  users/jkratoch/dwarf5gcc-gdb: .
@ 2016-11-02 20:53 jkratoch
  0 siblings, 0 replies; 6+ messages in thread
From: jkratoch @ 2016-11-02 20:53 UTC (permalink / raw)
  To: archer-commits

The branch, users/jkratoch/dwarf5gcc-gdb has been updated
       via  c798ab9a523c411797894d7085f825d69fd5bfc8 (commit)
      from  f3127892db71eac1c92d554b74e5023cc1ea8bbb (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email.

- Log -----------------------------------------------------------------
commit c798ab9a523c411797894d7085f825d69fd5bfc8
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Wed Nov 2 21:53:28 2016 +0100

    .

-----------------------------------------------------------------------

Summary of changes:
 gdb/dwarf2read.c |    6 ++++--
 gdb/xcoffread.c  |    1 +
 2 files changed, 5 insertions(+), 2 deletions(-)

First 500 lines of diff:
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index a13493e..4aed261 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -221,6 +221,7 @@ struct dwarf2_per_objfile
   struct dwarf2_section_info abbrev;
   struct dwarf2_section_info line;
   struct dwarf2_section_info loc;
+  struct dwarf2_section_info loclists;
   struct dwarf2_section_info macinfo;
   struct dwarf2_section_info macro;
   struct dwarf2_section_info str;
@@ -759,6 +760,7 @@ struct dwo_sections
   struct dwarf2_section_info abbrev;
   struct dwarf2_section_info line;
   struct dwarf2_section_info loc;
+  struct dwarf2_section_info loclists;
   struct dwarf2_section_info macinfo;
   struct dwarf2_section_info macro;
   struct dwarf2_section_info str;
@@ -21908,9 +21910,9 @@ cu_debug_loc_section (struct dwarf2_cu *cu)
 {
   if (cu->dwo_unit)
     {
-      const struct dwo_sections *sections = &cu->dwo_unit->dwo_file->sections;
+      struct dwo_sections *sections = &cu->dwo_unit->dwo_file->sections;
       
-      return cu->header.version >= 5 ? sections->loclists : sections->loc;
+      return cu->header.version >= 5 ? &sections->loclists : &sections->loc;
     }
   return (cu->header.version >= 5 ? &dwarf2_per_objfile->loclists
 				  : &dwarf2_per_objfile->loc);
diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c
index 90d0753..1ae83aa 100644
--- a/gdb/xcoffread.c
+++ b/gdb/xcoffread.c
@@ -159,6 +159,7 @@ static const struct dwarf2_debug_sections dwarf2_xcoff_names = {
   { ".dwabrev", NULL },
   { ".dwline", NULL },
   { ".dwloc", NULL },
+  { NULL, NULL }, /* debug_loclists */
   /* AIX XCOFF defines one, named DWARF section for macro debug information.
      XLC does not generate debug_macinfo for DWARF4 and below.
      The section is assigned to debug_macro for DWARF5 and above. */


hooks/post-receive
--
Repository for Project Archer.


^ permalink raw reply	[flat|nested] 6+ messages in thread
* [SCM]  users/jkratoch/dwarf5gcc-gdb: .
@ 2016-11-02 20:46 jkratoch
  0 siblings, 0 replies; 6+ messages in thread
From: jkratoch @ 2016-11-02 20:46 UTC (permalink / raw)
  To: archer-commits

The branch, users/jkratoch/dwarf5gcc-gdb has been updated
       via  f3127892db71eac1c92d554b74e5023cc1ea8bbb (commit)
       via  527ebef0eeae9a062efe77f4eeb2f1a006bc18d9 (commit)
       via  2e6305d981cdd51a7349fb82f83b00a9c52c81d1 (commit)
       via  e23eba971dd409b999dd83d8df0f842680c1c642 (commit)
       via  4e56efac8b4d5e251e8edc13febec93992bd6eb4 (commit)
       via  c50730217d606814cda69a2bb6975730c0f1ee63 (commit)
       via  7e3d947dd6ae45d71aa175b96fbd42a51e93b3f8 (commit)
       via  de4bfa865e5ea54f2ab5b7af53e4abe825da699e (commit)
       via  fb47deda560b754008c35b5ec13fe02ef0593019 (commit)
       via  c646b02fdcae5f37bd88f33a0c4683ef13ad5c82 (commit)
       via  1964088538cbf9483a1c9f411ad9d9054ea7be90 (commit)
      from  8ac14c4c6fc26c02b6333792728cbc0c0eece05a (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email.

- Log -----------------------------------------------------------------
commit f3127892db71eac1c92d554b74e5023cc1ea8bbb
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Wed Nov 2 21:46:09 2016 +0100

    .

commit 527ebef0eeae9a062efe77f4eeb2f1a006bc18d9
Merge: 8ac14c4 2e6305d
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Tue Nov 1 18:46:28 2016 +0100

    Merge branch 'dwarf5gcc' into dwarf5gcc-gdb

commit 2e6305d981cdd51a7349fb82f83b00a9c52c81d1
Merge: e64174f e23eba9
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Tue Nov 1 18:46:28 2016 +0100

    Merge remote-tracking branch 'gdb/master' into dwarf5gcc

commit e23eba971dd409b999dd83d8df0f842680c1c642
Author: Nick Clifton <nickc@redhat.com>
Date:   Tue Nov 1 16:45:57 2016 +0000

    Add support for RISC-V architecture.
    
    bfd	* Makefile.am: Add entries for riscv32-elf and riscv64-elf.
    	* config.bdf: Likewise.
    	* configure.ac: Likewise.
    	* Makefile.in: Regenerate.
    	* configure: Regenerate.
    	* archures.c: Add bfd_riscv_arch.
    	* reloc.c: Add riscv relocs.
    	* targets.c: Add riscv_elf32_vec and riscv_elf64_vec.
    	* bfd-in2.h: Regenerate.
    	* libbfd.h: Regenerate.
    	* elf-bfd.h: Add RISCV_ELF_DATA to enum elf_target_id.
    	* elfnn-riscv.c: New file.
    	* elfxx-riscv.c: New file.
    	* elfxx-riscv.h: New file.
    
    binutils* readelf.c (guess_is_rela): Add EM_RISCV.
    	(get_machine_name): Likewise.
    	(dump_relocations): Add support for riscv relocations.
    	(get_machine_flags): Add support for riscv flags.
    	(is_32bit_abs_reloc): Add R_RISCV_32.
    	(is_64bit_abs_reloc): Add R_RISCV_64.
    	(is_none_reloc): Add R_RISCV_NONE.
    	* testsuite/binutils-all/objdump.exp (cpus_expected): Add riscv.
    	Expect the debug_ranges test to fail.
    
    gas	* Makefile.am: Add riscv files.
    	* Makefile.in: Regenerate.
    	* NEWS: Mention the support for this architecture.
    	* configure.in: Define a default architecture.
    	* configure: Regenerate.
    	* configure.tgt: Add entries for riscv.
    	* doc/as.texinfo: Likewise.
    	* testsuite/gas/all/gas.exp: Expect the redef tests to fail.
    	* testsuite/gas/elf/elf.exp: Expect the groupauto tests to fail.
    	* config/tc-riscv.c: New file.
    	* config/tc-riscv.h: New file.
    	* doc/c-riscv.texi: New file.
    	* testsuite/gas/riscv: New directory.
    	* testsuite/gas/riscv/riscv.exp: New file.
    	* testsuite/gas/riscv/t_insns.d: New file.
    	* testsuite/gas/riscv/t_insns.s: New file.
    
    ld	* Makefile.am: Add riscv files.
    	* Makefile.in: Regenerate.
    	* NEWS: Mention the support for this target.
    	* configure.tgt: Add riscv entries.
    	* emulparams/elf32lriscv-defs.sh: New file.
    	* emulparams/elf32lriscv.sh: New file.
    	* emulparams/elf64lriscv-defs.sh: New file.
    	* emulparams/elf64lriscv.sh: New file.
    	* emultempl/riscvelf.em: New file.
    
    opcodes	* configure.ac: Add entry for bfd_riscv_arch.
    	* configure: Regenerate.
    	* disassemble.c (disassembler): Add support for riscv.
    	(disassembler_usage): Likewise.
    	* riscv-dis.c: New file.
    	* riscv-opc.c: New file.
    
    include	* dis-asm.h: Add prototypes for print_insn_riscv and
    	print_riscv_disassembler_options.
    	* elf/riscv.h: New file.
    	* opcode/riscv-opc.h: New file.
    	* opcode/riscv.h: New file.

commit 4e56efac8b4d5e251e8edc13febec93992bd6eb4
Author: GDB Administrator <gdbadmin@sourceware.org>
Date:   Tue Nov 1 00:00:19 2016 +0000

    Automatic date update in version.in

commit c50730217d606814cda69a2bb6975730c0f1ee63
Author: Maciej W. Rozycki <macro@imgtec.com>
Date:   Mon Oct 31 16:24:04 2016 +0000

    Remove IRIX 5 <sys/proc.h> _KMEMUSER workaround
    
    Complement commit 3831839c089c ("Delete IRIX support") and remove the
    IRIX 5 <sys/proc.h> _KMEMUSER workaround from the `configure' script, as
    IRIX is no longer a supported host configuration.
    
    	gdb/
    	* configure.ac <mips-sgi-irix5*>: Remove <sys/proc.h> _KMEMUSER
    	workaround.
    	* configure: Regenerate.
    	* config.in: Regenerate.

commit 7e3d947dd6ae45d71aa175b96fbd42a51e93b3f8
Author: Maciej W. Rozycki <macro@imgtec.com>
Date:   Mon Oct 31 02:08:06 2016 +0000

    MIPS: Remove remains of legacy remote target support
    
    Complement commit f7c382926d78 ("Remove support for "target m32rsdi" and
    "target mips/pmon/ddb/rockhopper/lsi"") and remove dead MIPS target code
    which used to support these legacy remote targets.
    
    	gdb/
    	* mips-tdep.c (mips_r3041_reg_names): Remove.
    	(mips_breakpoint_from_pc): Remove IDT and PMON breakpoint
    	encodings.

commit de4bfa865e5ea54f2ab5b7af53e4abe825da699e
Author: Maciej W. Rozycki <macro@imgtec.com>
Date:   Mon Oct 31 02:07:26 2016 +0000

    MIPS: Remove remains of IRIX OS ABI support
    
    Complement commit 3831839c089c ("Delete IRIX support") and remove dead
    MIPS target IRIX OS ABI support code.
    
    	gdb/
    	* defs.h (gdb_osabi): Remove GDB_OSABI_IRIX enum value.
    	* osabi.c (gdb_osabi_names): Remove "Irix" entry.
    	* mips-tdep.c (mips_irix_reg_names): Remove.
    	(mips_register_type): Remove GDB_OSABI_IRIX code.
    	(mips_pseudo_register_type): Likewise.
    	(mips_breakpoint_from_pc): Likewise.
    	(mips_gdbarch_init): Likewise.

commit fb47deda560b754008c35b5ec13fe02ef0593019
Author: Thomas Preud'homme <thomas.preudhomme@arm.com>
Date:   Mon Oct 31 09:44:18 2016 +0000

    Initialize input statement created in add_archive_member
    
    2016-10-31  Thomas Preud'homme  <thomas.preudhomme@arm.com>
    
    ld/
    	* ldmain.c (add_archive_element): Initialize input->header.type.
    	* plugin.c (plugin_maybe_claim): Assert the statement is an input
    	statement.

commit c646b02fdcae5f37bd88f33a0c4683ef13ad5c82
Author: Alan Modra <amodra@gmail.com>
Date:   Mon Oct 31 12:46:38 2016 +1030

    Revert part "Set dynamic tag VMA and size from dynamic section when possible"
    
    	PR 20748
    	* elf32-microblaze.c (microblaze_elf_finish_dynamic_sections): Revert
    	2016-05-13 change.

commit 1964088538cbf9483a1c9f411ad9d9054ea7be90
Author: GDB Administrator <gdbadmin@sourceware.org>
Date:   Mon Oct 31 00:00:22 2016 +0000

    Automatic date update in version.in

-----------------------------------------------------------------------

Summary of changes:
 bfd/ChangeLog                               |   25 +
 bfd/Makefile.am                             |   28 +-
 bfd/Makefile.in                             |   32 +-
 bfd/archures.c                              |    7 +-
 bfd/bfd-in2.h                               |   43 +
 bfd/config.bfd                              |   15 +
 bfd/configure                               |    2 +
 bfd/configure.ac                            |    2 +
 bfd/cpu-riscv.c                             |   79 +
 bfd/elf-bfd.h                               |    1 +
 bfd/elf32-microblaze.c                      |    4 +-
 bfd/elfnn-riscv.c                           | 3160 +++++++++++++++++++++++++++
 bfd/elfxx-riscv.c                           |  815 +++++++
 bfd/elfxx-riscv.h                           |   33 +
 bfd/libbfd.h                                |   38 +
 bfd/reloc.c                                 |   80 +
 bfd/targets.c                               |    6 +
 bfd/version.h                               |    2 +-
 binutils/ChangeLog                          |   14 +
 binutils/dwarf.c                            |  442 ++++-
 binutils/dwarf.h                            |    4 +
 binutils/readelf.c                          |   20 +-
 binutils/testsuite/binutils-all/objdump.exp |    4 +-
 gas/ChangeLog                               |   21 +
 gas/Makefile.am                             |    2 +
 gas/Makefile.in                             |   17 +
 gas/NEWS                                    |    2 +
 gas/config/tc-riscv.c                       | 2408 ++++++++++++++++++++
 gas/config/tc-riscv.h                       |  101 +
 gas/configure                               |    2 +-
 gas/configure.ac                            |    2 +-
 gas/configure.tgt                           |    6 +-
 gas/doc/as.texinfo                          |   19 +
 gas/doc/c-riscv.texi                        |   48 +
 gas/testsuite/gas/all/gas.exp               |    8 +-
 gas/testsuite/gas/elf/elf.exp               |    3 +
 gas/testsuite/gas/riscv/riscv.exp           |   23 +
 gas/testsuite/gas/riscv/t_insns.d           |   10 +
 gas/testsuite/gas/riscv/t_insns.s           |    2 +
 gdb/ChangeLog                               |   23 +
 gdb/config.in                               |    4 -
 gdb/configure                               |    6 -
 gdb/configure.ac                            |    6 -
 gdb/defs.h                                  |    1 -
 gdb/dwarf2read.c                            |   12 +-
 gdb/mips-tdep.c                             |   77 +-
 gdb/osabi.c                                 |    1 -
 gdb/symfile.h                               |    1 +
 include/ChangeLog                           |   10 +
 include/dis-asm.h                           |    2 +
 include/elf/riscv.h                         |   92 +
 include/opcode/riscv-opc.h                  | 1160 ++++++++++
 include/opcode/riscv.h                      |  342 +++
 ld/ChangeLog                                |   20 +
 ld/Makefile.am                              |   13 +
 ld/Makefile.in                              |   15 +
 ld/NEWS                                     |    2 +-
 ld/configure.tgt                            |    6 +
 ld/emulparams/elf32lriscv-defs.sh           |   42 +
 ld/emulparams/elf32lriscv.sh                |    2 +
 ld/emulparams/elf64lriscv-defs.sh           |   13 +
 ld/emulparams/elf64lriscv.sh                |    2 +
 ld/emultempl/riscvelf.em                    |   68 +
 ld/ldmain.c                                 |    1 +
 ld/plugin.c                                 |    1 +
 opcodes/ChangeLog                           |   11 +
 opcodes/configure                           |    1 +
 opcodes/configure.ac                        |    1 +
 opcodes/disassemble.c                       |    8 +
 opcodes/riscv-dis.c                         |  502 +++++
 opcodes/riscv-opc.c                         |  624 ++++++
 71 files changed, 10470 insertions(+), 129 deletions(-)
 create mode 100644 bfd/cpu-riscv.c
 create mode 100644 bfd/elfnn-riscv.c
 create mode 100644 bfd/elfxx-riscv.c
 create mode 100644 bfd/elfxx-riscv.h
 create mode 100644 gas/config/tc-riscv.c
 create mode 100644 gas/config/tc-riscv.h
 create mode 100644 gas/doc/c-riscv.texi
 create mode 100644 gas/testsuite/gas/riscv/riscv.exp
 create mode 100644 gas/testsuite/gas/riscv/t_insns.d
 create mode 100644 gas/testsuite/gas/riscv/t_insns.s
 create mode 100644 include/elf/riscv.h
 create mode 100644 include/opcode/riscv-opc.h
 create mode 100644 include/opcode/riscv.h
 create mode 100644 ld/emulparams/elf32lriscv-defs.sh
 create mode 100644 ld/emulparams/elf32lriscv.sh
 create mode 100644 ld/emulparams/elf64lriscv-defs.sh
 create mode 100644 ld/emulparams/elf64lriscv.sh
 create mode 100644 ld/emultempl/riscvelf.em
 create mode 100644 opcodes/riscv-dis.c
 create mode 100644 opcodes/riscv-opc.c

First 500 lines of diff:
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 3fbac7e..75ffab5 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,28 @@
+2016-11-01  Palmer Dabbelt  <palmer@dabbelt.com>
+	    Andrew Waterman <andrew@sifive.com>
+
+	Add support for RISC-V architecture.
+	* Makefile.am: Add entries for riscv32-elf and riscv64-elf.
+	* config.bdf: Likewise.
+	* configure.ac: Likewise.
+	* Makefile.in: Regenerate.
+	* configure: Regenerate.
+	* archures.c: Add bfd_riscv_arch.
+	* reloc.c: Add riscv relocs.
+	* targets.c: Add riscv_elf32_vec and riscv_elf64_vec.
+	* bfd-in2.h: Regenerate.
+	* libbfd.h: Regenerate.
+	* elf-bfd.h: Add RISCV_ELF_DATA to enum elf_target_id.
+	* elfnn-riscv.c: New file.
+	* elfxx-riscv.c: New file.
+	* elfxx-riscv.h: New file.
+
+2016-10-31  Alan Modra  <amodra@gmail.com>
+
+	PR 20748
+	* elf32-microblaze.c (microblaze_elf_finish_dynamic_sections): Revert
+	2016-05-13 change.
+
 2016-10-27  Andrew Burgess  <andrew.burgess@embecosm.com>
 
 	* cpu-arc.c (arc_get_mach): Delete.
diff --git a/bfd/Makefile.am b/bfd/Makefile.am
index e04be5a..0d5dd4a 100644
--- a/bfd/Makefile.am
+++ b/bfd/Makefile.am
@@ -148,6 +148,7 @@ ALL_MACHINES = \
 	cpu-plugin.lo \
 	cpu-powerpc.lo \
 	cpu-rs6000.lo \
+	cpu-riscv.lo \
 	cpu-rl78.lo \
 	cpu-rx.lo \
 	cpu-s390.lo \
@@ -235,6 +236,7 @@ ALL_MACHINES_CFILES = \
 	cpu-plugin.c \
 	cpu-powerpc.c \
 	cpu-rs6000.c \
+	cpu-riscv.c \
 	cpu-rl78.c \
 	cpu-rx.c \
 	cpu-s390.c \
@@ -671,18 +673,21 @@ BFD64_BACKENDS = \
 	elf64-hppa.lo \
 	elf64-ia64.lo \
 	elf64-ia64-vms.lo \
+	elfxx-ia64.lo \
+	elfn32-mips.lo \
 	elf64-mips.lo \
+	elfxx-mips.lo \
 	elf64-mmix.lo \
 	elf64-ppc.lo \
+	elf32-riscv.lo \
+	elf64-riscv.lo \
+	elfxx-riscv.lo \
 	elf64-s390.lo \
 	elf64-sh64.lo \
 	elf64-sparc.lo \
 	elf64-tilegx.lo \
 	elf64-x86-64.lo \
 	elf64.lo \
-	elfn32-mips.lo \
-	elfxx-ia64.lo \
-	elfxx-mips.lo \
 	mach-o-aarch64.lo \
 	mach-o-x86-64.lo \
 	mmo.lo \
@@ -722,6 +727,7 @@ BFD64_BACKENDS_CFILES = \
 	elfxx-aarch64.c \
 	elfxx-ia64.c \
 	elfxx-mips.c \
+	elfxx-riscv.c \
 	mach-o-aarch64.c \
 	mach-o-x86-64.c \
 	mmo.c \
@@ -785,7 +791,9 @@ SOURCE_CFILES = \
 
 BUILD_CFILES = \
 	elf32-aarch64.c elf64-aarch64.c \
-	elf32-ia64.c elf64-ia64.c peigen.c pepigen.c pex64igen.c
+	elf32-ia64.c elf64-ia64.c \
+	elf32-riscv.c elf64-riscv.c \
+	peigen.c pepigen.c pex64igen.c
 
 CFILES = $(SOURCE_CFILES) $(BUILD_CFILES)
 
@@ -955,6 +963,18 @@ elf64-ia64.c : elfnn-ia64.c
 	$(SED) -e s/NN/64/g < $(srcdir)/elfnn-ia64.c > elf64-ia64.new
 	mv -f elf64-ia64.new elf64-ia64.c
 
+elf32-riscv.c : elfnn-riscv.c
+	rm -f elf32-riscv.c
+	echo "#line 1 \"$(srcdir)/elfnn-riscv.c\"" > elf32-riscv.new
+	sed -e s/NN/32/g < $(srcdir)/elfnn-riscv.c >> elf32-riscv.new
+	mv -f elf32-riscv.new elf32-riscv.c
+
+elf64-riscv.c : elfnn-riscv.c
+	rm -f elf64-riscv.c
+	echo "#line 1 \"$(srcdir)/elfnn-riscv.c\"" > elf64-riscv.new
+	sed -e s/NN/64/g < $(srcdir)/elfnn-riscv.c >> elf64-riscv.new
+	mv -f elf64-riscv.new elf64-riscv.c
+
 peigen.c : peXXigen.c
 	rm -f peigen.c
 	$(SED) -e s/XX/pe/g < $(srcdir)/peXXigen.c > peigen.new
diff --git a/bfd/Makefile.in b/bfd/Makefile.in
index 64658c5..661155c 100644
--- a/bfd/Makefile.in
+++ b/bfd/Makefile.in
@@ -481,6 +481,7 @@ ALL_MACHINES = \
 	cpu-plugin.lo \
 	cpu-powerpc.lo \
 	cpu-rs6000.lo \
+	cpu-riscv.lo \
 	cpu-rl78.lo \
 	cpu-rx.lo \
 	cpu-s390.lo \
@@ -568,6 +569,7 @@ ALL_MACHINES_CFILES = \
 	cpu-plugin.c \
 	cpu-powerpc.c \
 	cpu-rs6000.c \
+	cpu-riscv.c \
 	cpu-rl78.c \
 	cpu-rx.c \
 	cpu-s390.c \
@@ -1006,18 +1008,21 @@ BFD64_BACKENDS = \
 	elf64-hppa.lo \
 	elf64-ia64.lo \
 	elf64-ia64-vms.lo \
+	elfxx-ia64.lo \
+	elfn32-mips.lo \
 	elf64-mips.lo \
+	elfxx-mips.lo \
 	elf64-mmix.lo \
 	elf64-ppc.lo \
+	elf32-riscv.lo \
+	elf64-riscv.lo \
+	elfxx-riscv.lo \
 	elf64-s390.lo \
 	elf64-sh64.lo \
 	elf64-sparc.lo \
 	elf64-tilegx.lo \
 	elf64-x86-64.lo \
 	elf64.lo \
-	elfn32-mips.lo \
-	elfxx-ia64.lo \
-	elfxx-mips.lo \
 	mach-o-aarch64.lo \
 	mach-o-x86-64.lo \
 	mmo.lo \
@@ -1057,6 +1062,7 @@ BFD64_BACKENDS_CFILES = \
 	elfxx-aarch64.c \
 	elfxx-ia64.c \
 	elfxx-mips.c \
+	elfxx-riscv.c \
 	mach-o-aarch64.c \
 	mach-o-x86-64.c \
 	mmo.c \
@@ -1122,7 +1128,9 @@ SOURCE_CFILES = \
 
 BUILD_CFILES = \
 	elf32-aarch64.c elf64-aarch64.c \
-	elf32-ia64.c elf64-ia64.c peigen.c pepigen.c pex64igen.c
+	elf32-ia64.c elf64-ia64.c \
+	elf32-riscv.c elf64-riscv.c \
+	peigen.c pepigen.c pex64igen.c
 
 CFILES = $(SOURCE_CFILES) $(BUILD_CFILES)
 SOURCE_HFILES = \
@@ -1412,6 +1420,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-pj.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-plugin.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-powerpc.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-riscv.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-rl78.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-rs6000.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-rx.Plo@am__quote@
@@ -1501,6 +1510,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32-or1k.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32-pj.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32-ppc.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32-riscv.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32-rl78.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32-rx.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32-s390.Plo@am__quote@
@@ -1532,6 +1542,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-mips.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-mmix.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-ppc.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-riscv.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-s390.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-sh64.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-sparc.Plo@am__quote@
@@ -1543,6 +1554,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elfxx-aarch64.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elfxx-ia64.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elfxx-mips.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elfxx-riscv.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elfxx-sparc.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elfxx-tilegx.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/epoc-pe-arm.Plo@am__quote@
@@ -2080,6 +2092,18 @@ elf64-ia64.c : elfnn-ia64.c
 	$(SED) -e s/NN/64/g < $(srcdir)/elfnn-ia64.c > elf64-ia64.new
 	mv -f elf64-ia64.new elf64-ia64.c
 
+elf32-riscv.c : elfnn-riscv.c
+	rm -f elf32-riscv.c
+	echo "#line 1 \"$(srcdir)/elfnn-riscv.c\"" > elf32-riscv.new
+	sed -e s/NN/32/g < $(srcdir)/elfnn-riscv.c >> elf32-riscv.new
+	mv -f elf32-riscv.new elf32-riscv.c
+
+elf64-riscv.c : elfnn-riscv.c
+	rm -f elf64-riscv.c
+	echo "#line 1 \"$(srcdir)/elfnn-riscv.c\"" > elf64-riscv.new
+	sed -e s/NN/64/g < $(srcdir)/elfnn-riscv.c >> elf64-riscv.new
+	mv -f elf64-riscv.new elf64-riscv.c
+
 peigen.c : peXXigen.c
 	rm -f peigen.c
 	$(SED) -e s/XX/pe/g < $(srcdir)/peXXigen.c > peigen.new
diff --git a/bfd/archures.c b/bfd/archures.c
index af70b18..e503492 100644
--- a/bfd/archures.c
+++ b/bfd/archures.c
@@ -457,6 +457,9 @@ DESCRIPTION
 .#define bfd_mach_cris_v0_v10	255
 .#define bfd_mach_cris_v32	32
 .#define bfd_mach_cris_v10_v32	1032
+.  bfd_arch_riscv,
+.#define bfd_mach_riscv32	132
+.#define bfd_mach_riscv64	164
 .  bfd_arch_rl78,
 .#define bfd_mach_rl78	0x75
 .  bfd_arch_rx,        {* Renesas RX.  *}
@@ -628,6 +631,7 @@ extern const bfd_arch_info_type bfd_pj_arch;
 extern const bfd_arch_info_type bfd_plugin_arch;
 extern const bfd_arch_info_type bfd_powerpc_archs[];
 #define bfd_powerpc_arch bfd_powerpc_archs[0]
+extern const bfd_arch_info_type bfd_riscv_arch;
 extern const bfd_arch_info_type bfd_rs6000_arch;
 extern const bfd_arch_info_type bfd_rl78_arch;
 extern const bfd_arch_info_type bfd_rx_arch;
@@ -717,8 +721,9 @@ static const bfd_arch_info_type * const bfd_archures_list[] =
     &bfd_or1k_arch,
     &bfd_pdp11_arch,
     &bfd_powerpc_arch,
-    &bfd_rs6000_arch,
+    &bfd_riscv_arch,
     &bfd_rl78_arch,
+    &bfd_rs6000_arch,
     &bfd_rx_arch,
     &bfd_s390_arch,
     &bfd_score_arch,
diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
index 3c0ff9d..fdb7878 100644
--- a/bfd/bfd-in2.h
+++ b/bfd/bfd-in2.h
@@ -2295,6 +2295,9 @@ enum bfd_architecture
 #define bfd_mach_cris_v0_v10   255
 #define bfd_mach_cris_v32      32
 #define bfd_mach_cris_v10_v32  1032
+  bfd_arch_riscv,
+#define bfd_mach_riscv32       132
+#define bfd_mach_riscv64       164
   bfd_arch_rl78,
 #define bfd_mach_rl78  0x75
   bfd_arch_rx,        /* Renesas RX.  */
@@ -4691,6 +4694,46 @@ number for the IN and OUT instructions  */
 number for the SBIC, SBIS, SBI and CBI instructions  */
   BFD_RELOC_AVR_PORT5,
 
+/* RISC-V relocations.  */
+  BFD_RELOC_RISCV_HI20,
+  BFD_RELOC_RISCV_PCREL_HI20,
+  BFD_RELOC_RISCV_PCREL_LO12_I,
+  BFD_RELOC_RISCV_PCREL_LO12_S,
+  BFD_RELOC_RISCV_LO12_I,
+  BFD_RELOC_RISCV_LO12_S,
+  BFD_RELOC_RISCV_GPREL12_I,
+  BFD_RELOC_RISCV_GPREL12_S,
+  BFD_RELOC_RISCV_TPREL_HI20,
+  BFD_RELOC_RISCV_TPREL_LO12_I,
+  BFD_RELOC_RISCV_TPREL_LO12_S,
+  BFD_RELOC_RISCV_TPREL_ADD,
+  BFD_RELOC_RISCV_CALL,
+  BFD_RELOC_RISCV_CALL_PLT,
+  BFD_RELOC_RISCV_ADD8,
+  BFD_RELOC_RISCV_ADD16,
+  BFD_RELOC_RISCV_ADD32,
+  BFD_RELOC_RISCV_ADD64,
+  BFD_RELOC_RISCV_SUB8,
+  BFD_RELOC_RISCV_SUB16,
+  BFD_RELOC_RISCV_SUB32,
+  BFD_RELOC_RISCV_SUB64,
+  BFD_RELOC_RISCV_GOT_HI20,
+  BFD_RELOC_RISCV_TLS_GOT_HI20,
+  BFD_RELOC_RISCV_TLS_GD_HI20,
+  BFD_RELOC_RISCV_JMP,
+  BFD_RELOC_RISCV_TLS_DTPMOD32,
+  BFD_RELOC_RISCV_TLS_DTPREL32,
+  BFD_RELOC_RISCV_TLS_DTPMOD64,
+  BFD_RELOC_RISCV_TLS_DTPREL64,
+  BFD_RELOC_RISCV_TLS_TPREL32,
+  BFD_RELOC_RISCV_TLS_TPREL64,
+  BFD_RELOC_RISCV_ALIGN,
+  BFD_RELOC_RISCV_RVC_BRANCH,
+  BFD_RELOC_RISCV_RVC_JUMP,
+  BFD_RELOC_RISCV_RVC_LUI,
+  BFD_RELOC_RISCV_GPREL_I,
+  BFD_RELOC_RISCV_GPREL_S,
+
 /* Renesas RL78 Relocations.  */
   BFD_RELOC_RL78_NEG8,
   BFD_RELOC_RL78_NEG16,
diff --git a/bfd/config.bfd b/bfd/config.bfd
index 6400722..98663fd 100644
--- a/bfd/config.bfd
+++ b/bfd/config.bfd
@@ -122,6 +122,7 @@ or1k*|or1knd*)	 targ_archs=bfd_or1k_arch ;;
 pdp11*)		 targ_archs=bfd_pdp11_arch ;;
 pj*)		 targ_archs="bfd_pj_arch bfd_i386_arch";;
 powerpc*)	 targ_archs="bfd_rs6000_arch bfd_powerpc_arch" ;;
+riscv*)		 targ_archs=bfd_riscv_arch ;;
 rs6000)		 targ_archs="bfd_rs6000_arch bfd_powerpc_arch" ;;
 s390*)		 targ_archs=bfd_s390_arch ;;
 sh*)		 targ_archs=bfd_sh_arch ;;
@@ -1359,6 +1360,20 @@ case "${targ}" in
     targ_selvecs="powerpc_pei_le_vec powerpc_pei_vec powerpc_pe_le_vec powerpc_pe_vec"
     ;;
 
+#ifdef BFD64
+  riscv32-*-*)
+    targ_defvec=riscv_elf32_vec
+    targ_selvecs="riscv_elf32_vec"
+    want64=true
+    ;;
+
+  riscv64-*-*)
+    targ_defvec=riscv_elf64_vec
+    targ_selvecs="riscv_elf32_vec riscv_elf64_vec"
+    want64=true
+    ;;
+#endif
+
   rl78-*-elf)
     targ_defvec=rl78_elf32_vec
     ;;
diff --git a/bfd/configure b/bfd/configure
index 8284069..68db12f 100755
--- a/bfd/configure
+++ b/bfd/configure
@@ -14475,6 +14475,8 @@ do
     powerpc_pei_vec)		 tb="$tb pei-ppc.lo peigen.lo $coff" ;;
     powerpc_pei_le_vec)		 tb="$tb pei-ppc.lo peigen.lo $coff" ;;
     powerpc_xcoff_vec)		 tb="$tb coff-rs6000.lo $xcoff" ;;
+    riscv_elf32_vec)		 tb="$tb elf32-riscv.lo elfxx-riscv.lo elf32.lo $elf" ;;
+    riscv_elf64_vec)		 tb="$tb elf64-riscv.lo elf64.lo elfxx-riscv.lo elf32.lo $elf"; target_size=64 ;;
     rl78_elf32_vec)		 tb="$tb elf32-rl78.lo elf32.lo $elf" ;;
     rs6000_xcoff64_vec)		 tb="$tb coff64-rs6000.lo aix5ppc-core.lo $xcoff"; target_size=64 ;;
     rs6000_xcoff64_aix_vec)	 tb="$tb coff64-rs6000.lo aix5ppc-core.lo $xcoff"; target_size=64 ;;
diff --git a/bfd/configure.ac b/bfd/configure.ac
index 669cff7..6f11d29 100644
--- a/bfd/configure.ac
+++ b/bfd/configure.ac
@@ -606,6 +606,8 @@ do
     powerpc_pei_vec)		 tb="$tb pei-ppc.lo peigen.lo $coff" ;;
     powerpc_pei_le_vec)		 tb="$tb pei-ppc.lo peigen.lo $coff" ;;
     powerpc_xcoff_vec)		 tb="$tb coff-rs6000.lo $xcoff" ;;
+    riscv_elf32_vec)		 tb="$tb elf32-riscv.lo elfxx-riscv.lo elf32.lo $elf" ;;
+    riscv_elf64_vec)		 tb="$tb elf64-riscv.lo elf64.lo elfxx-riscv.lo elf32.lo $elf"; target_size=64 ;;
     rl78_elf32_vec)		 tb="$tb elf32-rl78.lo elf32.lo $elf" ;;
     rs6000_xcoff64_vec)		 tb="$tb coff64-rs6000.lo aix5ppc-core.lo $xcoff"; target_size=64 ;;
     rs6000_xcoff64_aix_vec)	 tb="$tb coff64-rs6000.lo aix5ppc-core.lo $xcoff"; target_size=64 ;;
diff --git a/bfd/cpu-riscv.c b/bfd/cpu-riscv.c
new file mode 100644
index 0000000..a938199
--- /dev/null
+++ b/bfd/cpu-riscv.c
@@ -0,0 +1,79 @@
+/* BFD backend for RISC-V
+   Copyright 2011-2016 Free Software Foundation, Inc.
+
+   Contributed by Andrew Waterman (andrew@sifive.com).
+   Based on MIPS target.
+
+   This file is part of BFD, the Binary File Descriptor library.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; see the file COPYING3. If not,
+   see <http://www.gnu.org/licenses/>.  */
+
+#include "sysdep.h"
+#include "bfd.h"
+#include "libbfd.h"
+
+/* This routine is provided two arch_infos and returns an arch_info
+   that is compatible with both, or NULL if none exists.  */
+
+static const bfd_arch_info_type *
+riscv_compatible (const bfd_arch_info_type *a, const bfd_arch_info_type *b)
+{
+  if (a->arch != b->arch)
+    return NULL;
+
+  /* Machine compatibility is checked in
+     _bfd_riscv_elf_merge_private_bfd_data.  */
+
+  return a;
+}
+
+#define N(BITS_WORD, BITS_ADDR, NUMBER, PRINT, DEFAULT, NEXT)	\
+  {								\
+    BITS_WORD, /*  bits in a word */				\
+    BITS_ADDR, /* bits in an address */				\
+    8,	/* 8 bits in a byte */					\
+    bfd_arch_riscv,						\
+    NUMBER,							\
+    "riscv",							\
+    PRINT,							\
+    3,								\
+    DEFAULT,							\
+    riscv_compatible,						\
+    bfd_default_scan,						\
+    bfd_arch_default_fill,					\
+    NEXT,							\
+  }
+
+/* This enum must be kept in the same order as arch_info_struct.  */
+enum
+{
+  I_riscv64,
+  I_riscv32
+};
+
+#define NN(index) (&arch_info_struct[(index) + 1])
+
+/* This array must be kept in the same order as the anonymous enum above,
+   and each entry except the last should end with NN (my enum value).  */
+static const bfd_arch_info_type arch_info_struct[] =
+{
+  N (64, 64, bfd_mach_riscv64, "riscv:rv64", FALSE, NN (I_riscv64)),
+  N (32, 32, bfd_mach_riscv32, "riscv:rv32", FALSE, 0)
+};
+
+/* The default architecture is riscv:rv64.  */
+
+const bfd_arch_info_type bfd_riscv_arch =
+  N (64, 64, 0, "riscv", TRUE, &arch_info_struct[0]);
diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h
index af2af2c..50151cb 100644
--- a/bfd/elf-bfd.h
+++ b/bfd/elf-bfd.h
@@ -477,6 +477,7 @@ enum elf_target_id
   XGATE_ELF_DATA,
   TILEGX_ELF_DATA,
   TILEPRO_ELF_DATA,
+  RISCV_ELF_DATA,
   GENERIC_ELF_DATA
 };
 
diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c
index 477e7b3..5c66808 100644
--- a/bfd/elf32-microblaze.c
+++ b/bfd/elf32-microblaze.c
@@ -3396,13 +3396,13 @@ microblaze_elf_finish_dynamic_sections (bfd *output_bfd,
             {
               asection *s;
 
-              s = bfd_get_linker_section (dynobj, name);
+              s = bfd_get_section_by_name (output_bfd, name);
               if (s == NULL)
                 dyn.d_un.d_val = 0;
               else
                 {
                   if (! size)
-                    dyn.d_un.d_ptr = s->output_section->vma + s->output_offset;
+                    dyn.d_un.d_ptr = s->vma;
                   else
                     dyn.d_un.d_val = s->size;


hooks/post-receive
--
Repository for Project Archer.


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-11-15 21:48 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-13 19:17 [SCM] users/jkratoch/dwarf5gcc-gdb: jkratoch
  -- strict thread matches above, loose matches on Subject: below --
2016-11-15 21:48 jkratoch
2016-11-07 22:51 jkratoch
2016-11-03 18:32 jkratoch
2016-11-02 20:53 jkratoch
2016-11-02 20:46 jkratoch

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).