dwarf2out.c (dwarf_op): Renamed to ...
authorJakub Jelinek <jakub@redhat.com>
Mon, 31 Oct 2016 17:14:29 +0000 (18:14 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Mon, 31 Oct 2016 17:14:29 +0000 (18:14 +0100)
* dwarf2out.c (dwarf_op): Renamed to ...
(dwarf_OP): ... this.
(convert_descriptor_to_mode, scompare_loc_descriptor,
minmax_loc_descriptor, typed_binop, mem_loc_descriptor,
implicit_ptr_descriptor, optimize_one_addr_into_implicit_ptr): Adjust
callers.
(dwarf_AT, dwarf_TAG): New functions.
(check_die): Disallow DW_AT_call_all_calls next to
DW_AT_GNU_all_call_sites.
(gen_call_site_die): Use dwarf_TAG and dwarf_AT with DWARF 5 tag
and attributes instead of the corresponding GNU tag and attributes.
(gen_subprogram_die): Likewise.  Emit call site information even
for -gdwarf-5 -gstrict-dwarf.  Replace DW_AT_GNU_defaulted with
DW_AT_defaulted in comment.
(resolve_addr): Handle DW_AT_call_origin attribute on
DW_TAG_call_site DIE like DW_AT_abstract_origin on
DW_TAG_GNU_call_site DIE.

From-SVN: r241713

gcc/ChangeLog
gcc/dwarf2out.c

index b760528..b6c04b1 100644 (file)
@@ -1,5 +1,23 @@
 2016-10-31  Jakub Jelinek  <jakub@redhat.com>
 
+       * dwarf2out.c (dwarf_op): Renamed to ...
+       (dwarf_OP): ... this.
+       (convert_descriptor_to_mode, scompare_loc_descriptor,
+       minmax_loc_descriptor, typed_binop, mem_loc_descriptor,
+       implicit_ptr_descriptor, optimize_one_addr_into_implicit_ptr): Adjust
+       callers.
+       (dwarf_AT, dwarf_TAG): New functions.
+       (check_die): Disallow DW_AT_call_all_calls next to
+       DW_AT_GNU_all_call_sites.
+       (gen_call_site_die): Use dwarf_TAG and dwarf_AT with DWARF 5 tag
+       and attributes instead of the corresponding GNU tag and attributes.
+       (gen_subprogram_die): Likewise.  Emit call site information even
+       for -gdwarf-5 -gstrict-dwarf.  Replace DW_AT_GNU_defaulted with
+       DW_AT_defaulted in comment.
+       (resolve_addr): Handle DW_AT_call_origin attribute on
+       DW_TAG_call_site DIE like DW_AT_abstract_origin on
+       DW_TAG_GNU_call_site DIE.
+
        * dwarf2out.c (dwarf_op): New function.
        (size_of_loc_descr): Handle DW_OP_{implicit_pointer,entry_value},
        DW_OP_{const,regval,deref}_type and DW_OP_{convert,reinterpret}.
index 8cb4309..8c646a0 100644 (file)
@@ -1520,7 +1520,7 @@ loc_list_plus_const (dw_loc_list_ref list_head, HOST_WIDE_INT offset)
 /* Utility inline function for construction of ops that were GNU extension
    before DWARF 5.  */
 static inline enum dwarf_location_atom
-dwarf_op (enum dwarf_location_atom op)
+dwarf_OP (enum dwarf_location_atom op)
 {
   switch (op)
     {
@@ -1565,6 +1565,90 @@ dwarf_op (enum dwarf_location_atom op)
   return op;
 }
 
+/* Similarly for attributes.  */
+static inline enum dwarf_attribute
+dwarf_AT (enum dwarf_attribute at)
+{
+  switch (at)
+    {
+    case DW_AT_call_return_pc:
+      if (dwarf_version < 5)
+       return DW_AT_low_pc;
+      break;
+
+    case DW_AT_call_tail_call:
+      if (dwarf_version < 5)
+       return DW_AT_GNU_tail_call;
+      break;
+
+    case DW_AT_call_origin:
+      if (dwarf_version < 5)
+       return DW_AT_abstract_origin;
+      break;
+
+    case DW_AT_call_target:
+      if (dwarf_version < 5)
+       return DW_AT_GNU_call_site_target;
+      break;
+
+    case DW_AT_call_target_clobbered:
+      if (dwarf_version < 5)
+       return DW_AT_GNU_call_site_target_clobbered;
+      break;
+
+    case DW_AT_call_parameter:
+      if (dwarf_version < 5)
+       return DW_AT_abstract_origin;
+      break;
+
+    case DW_AT_call_value:
+      if (dwarf_version < 5)
+       return DW_AT_GNU_call_site_value;
+      break;
+
+    case DW_AT_call_data_value:
+      if (dwarf_version < 5)
+       return DW_AT_GNU_call_site_data_value;
+      break;
+
+    case DW_AT_call_all_calls:
+      if (dwarf_version < 5)
+       return DW_AT_GNU_all_call_sites;
+      break;
+
+    case DW_AT_call_all_tail_calls:
+      if (dwarf_version < 5)
+       return DW_AT_GNU_all_tail_call_sites;
+      break;
+
+    default:
+      break;
+    }
+  return at;
+}
+
+/* And similarly for tags.  */
+static inline enum dwarf_tag
+dwarf_TAG (enum dwarf_tag tag)
+{
+  switch (tag)
+    {
+    case DW_TAG_call_site:
+      if (dwarf_version < 5)
+       return DW_TAG_GNU_call_site;
+      break;
+
+    case DW_TAG_call_site_parameter:
+      if (dwarf_version < 5)
+       return DW_TAG_GNU_call_site_parameter;
+      break;
+
+    default:
+      break;
+    }
+  return tag;
+}
+
 static unsigned long int get_base_type_offset (dw_die_ref);
 
 /* Return the size of a location descriptor.  */
@@ -5978,6 +6062,7 @@ check_die (dw_die_ref die)
                    && a->dw_attr != DW_AT_high_pc
                    && a->dw_attr != DW_AT_location
                    && a->dw_attr != DW_AT_frame_base
+                   && a->dw_attr != DW_AT_call_all_calls
                    && a->dw_attr != DW_AT_GNU_all_call_sites);
     }
 }
@@ -12884,13 +12969,13 @@ convert_descriptor_to_mode (machine_mode mode, dw_loc_descr_ref op)
 
   if (GET_MODE_SIZE (mode) <= DWARF2_ADDR_SIZE)
     {
-      add_loc_descr (&op, new_loc_descr (dwarf_op (DW_OP_convert), 0, 0));
+      add_loc_descr (&op, new_loc_descr (dwarf_OP (DW_OP_convert), 0, 0));
       return op;
     }
   type_die = base_type_for_mode (outer_mode, 1);
   if (type_die == NULL)
     return NULL;
-  cvt = new_loc_descr (dwarf_op (DW_OP_convert), 0, 0);
+  cvt = new_loc_descr (dwarf_OP (DW_OP_convert), 0, 0);
   cvt->dw_loc_oprnd1.val_class = dw_val_class_die_ref;
   cvt->dw_loc_oprnd1.v.val_die_ref.die = type_die;
   cvt->dw_loc_oprnd1.v.val_die_ref.external = 0;
@@ -12955,12 +13040,12 @@ scompare_loc_descriptor (enum dwarf_location_atom op, rtx rtl,
 
       if (type_die == NULL)
        return NULL;
-      cvt = new_loc_descr (dwarf_op (DW_OP_convert), 0, 0);
+      cvt = new_loc_descr (dwarf_OP (DW_OP_convert), 0, 0);
       cvt->dw_loc_oprnd1.val_class = dw_val_class_die_ref;
       cvt->dw_loc_oprnd1.v.val_die_ref.die = type_die;
       cvt->dw_loc_oprnd1.v.val_die_ref.external = 0;
       add_loc_descr (&op0, cvt);
-      cvt = new_loc_descr (dwarf_op (DW_OP_convert), 0, 0);
+      cvt = new_loc_descr (dwarf_OP (DW_OP_convert), 0, 0);
       cvt->dw_loc_oprnd1.val_class = dw_val_class_die_ref;
       cvt->dw_loc_oprnd1.v.val_die_ref.die = type_die;
       cvt->dw_loc_oprnd1.v.val_die_ref.external = 0;
@@ -13158,12 +13243,12 @@ minmax_loc_descriptor (rtx rtl, machine_mode mode,
       dw_loc_descr_ref cvt;
       if (type_die == NULL)
        return NULL;
-      cvt = new_loc_descr (dwarf_op (DW_OP_convert), 0, 0);
+      cvt = new_loc_descr (dwarf_OP (DW_OP_convert), 0, 0);
       cvt->dw_loc_oprnd1.val_class = dw_val_class_die_ref;
       cvt->dw_loc_oprnd1.v.val_die_ref.die = type_die;
       cvt->dw_loc_oprnd1.v.val_die_ref.external = 0;
       add_loc_descr (&op0, cvt);
-      cvt = new_loc_descr (dwarf_op (DW_OP_convert), 0, 0);
+      cvt = new_loc_descr (dwarf_OP (DW_OP_convert), 0, 0);
       cvt->dw_loc_oprnd1.val_class = dw_val_class_die_ref;
       cvt->dw_loc_oprnd1.v.val_die_ref.die = type_die;
       cvt->dw_loc_oprnd1.v.val_die_ref.external = 0;
@@ -13209,12 +13294,12 @@ typed_binop (enum dwarf_location_atom op, rtx rtl, dw_die_ref type_die,
                            VAR_INIT_STATUS_INITIALIZED);
   if (op0 == NULL || op1 == NULL)
     return NULL;
-  cvt = new_loc_descr (dwarf_op (DW_OP_convert), 0, 0);
+  cvt = new_loc_descr (dwarf_OP (DW_OP_convert), 0, 0);
   cvt->dw_loc_oprnd1.val_class = dw_val_class_die_ref;
   cvt->dw_loc_oprnd1.v.val_die_ref.die = type_die;
   cvt->dw_loc_oprnd1.v.val_die_ref.external = 0;
   add_loc_descr (&op0, cvt);
-  cvt = new_loc_descr (dwarf_op (DW_OP_convert), 0, 0);
+  cvt = new_loc_descr (dwarf_OP (DW_OP_convert), 0, 0);
   cvt->dw_loc_oprnd1.val_class = dw_val_class_die_ref;
   cvt->dw_loc_oprnd1.v.val_die_ref.die = type_die;
   cvt->dw_loc_oprnd1.v.val_die_ref.external = 0;
@@ -13708,9 +13793,9 @@ mem_loc_descriptor (rtx rtl, machine_mode mode,
            }
          if (GET_MODE_SIZE (mode)
              != GET_MODE_SIZE (GET_MODE (inner)))
-           cvt = new_loc_descr (dwarf_op (DW_OP_convert), 0, 0);
+           cvt = new_loc_descr (dwarf_OP (DW_OP_convert), 0, 0);
          else
-           cvt = new_loc_descr (dwarf_op (DW_OP_reinterpret), 0, 0);
+           cvt = new_loc_descr (dwarf_OP (DW_OP_reinterpret), 0, 0);
          cvt->dw_loc_oprnd1.val_class = dw_val_class_die_ref;
          cvt->dw_loc_oprnd1.v.val_die_ref.die = type_die;
          cvt->dw_loc_oprnd1.v.val_die_ref.external = 0;
@@ -13719,7 +13804,7 @@ mem_loc_descriptor (rtx rtl, machine_mode mode,
              && GET_MODE_SIZE (mode) <= DWARF2_ADDR_SIZE)
            {
              /* Convert it to untyped afterwards.  */
-             cvt = new_loc_descr (dwarf_op (DW_OP_convert), 0, 0);
+             cvt = new_loc_descr (dwarf_OP (DW_OP_convert), 0, 0);
              add_loc_descr (&mem_loc_result, cvt);
            }
        }
@@ -13749,7 +13834,7 @@ mem_loc_descriptor (rtx rtl, machine_mode mode,
          dbx_regnum = dbx_reg_number (rtl);
          if (dbx_regnum == IGNORED_DWARF_REGNUM)
            break;
-         mem_loc_result = new_loc_descr (dwarf_op (DW_OP_regval_type),
+         mem_loc_result = new_loc_descr (dwarf_OP (DW_OP_regval_type),
                                          dbx_regnum, 0);
          mem_loc_result->dw_loc_oprnd2.val_class = dw_val_class_die_ref;
          mem_loc_result->dw_loc_oprnd2.v.val_die_ref.die = type_die;
@@ -13834,12 +13919,12 @@ mem_loc_descriptor (rtx rtl, machine_mode mode,
          if (type_die2 == NULL)
            break;
          mem_loc_result = op0;
-         cvt = new_loc_descr (dwarf_op (DW_OP_convert), 0, 0);
+         cvt = new_loc_descr (dwarf_OP (DW_OP_convert), 0, 0);
          cvt->dw_loc_oprnd1.val_class = dw_val_class_die_ref;
          cvt->dw_loc_oprnd1.v.val_die_ref.die = type_die1;
          cvt->dw_loc_oprnd1.v.val_die_ref.external = 0;
          add_loc_descr (&mem_loc_result, cvt);
-         cvt = new_loc_descr (dwarf_op (DW_OP_convert), 0, 0);
+         cvt = new_loc_descr (dwarf_OP (DW_OP_convert), 0, 0);
          cvt->dw_loc_oprnd1.val_class = dw_val_class_die_ref;
          cvt->dw_loc_oprnd1.v.val_die_ref.die = type_die2;
          cvt->dw_loc_oprnd1.v.val_die_ref.external = 0;
@@ -13877,7 +13962,7 @@ mem_loc_descriptor (rtx rtl, machine_mode mode,
                = base_type_for_mode (mode, SCALAR_INT_MODE_P (mode));
              if (type_die == NULL)
                return NULL;
-             deref = new_loc_descr (dwarf_op (DW_OP_deref_type),
+             deref = new_loc_descr (dwarf_OP (DW_OP_deref_type),
                                     GET_MODE_SIZE (mode), 0);
              deref->dw_loc_oprnd2.val_class = dw_val_class_die_ref;
              deref->dw_loc_oprnd2.v.val_die_ref.die = type_die;
@@ -13977,7 +14062,7 @@ mem_loc_descriptor (rtx rtl, machine_mode mode,
        gcc_unreachable ();
       if (op0 == NULL)
        return NULL;
-      mem_loc_result = new_loc_descr (dwarf_op (DW_OP_entry_value), 0, 0);
+      mem_loc_result = new_loc_descr (dwarf_OP (DW_OP_entry_value), 0, 0);
       mem_loc_result->dw_loc_oprnd1.val_class = dw_val_class_loc;
       mem_loc_result->dw_loc_oprnd1.v.val_loc = op0;
       break;
@@ -14221,14 +14306,14 @@ mem_loc_descriptor (rtx rtl, machine_mode mode,
                 < (unsigned long) 1 + 1 + 1 + GET_MODE_SIZE (mode))
            {
              mem_loc_result = int_loc_descriptor (INTVAL (rtl));
-             op0 = new_loc_descr (dwarf_op (DW_OP_convert), 0, 0);
+             op0 = new_loc_descr (dwarf_OP (DW_OP_convert), 0, 0);
              op0->dw_loc_oprnd1.val_class = dw_val_class_die_ref;
              op0->dw_loc_oprnd1.v.val_die_ref.die = type_die;
              op0->dw_loc_oprnd1.v.val_die_ref.external = 0;
              add_loc_descr (&mem_loc_result, op0);
              return mem_loc_result;
            }
-         mem_loc_result = new_loc_descr (dwarf_op (DW_OP_const_type), 0,
+         mem_loc_result = new_loc_descr (dwarf_OP (DW_OP_const_type), 0,
                                          INTVAL (rtl));
          mem_loc_result->dw_loc_oprnd1.val_class = dw_val_class_die_ref;
          mem_loc_result->dw_loc_oprnd1.v.val_die_ref.die = type_die;
@@ -14265,7 +14350,7 @@ mem_loc_descriptor (rtx rtl, machine_mode mode,
          type_die = base_type_for_mode (mode, SCALAR_INT_MODE_P (mode));
          if (type_die == NULL)
            return NULL;
-         mem_loc_result = new_loc_descr (dwarf_op (DW_OP_const_type), 0, 0);
+         mem_loc_result = new_loc_descr (dwarf_OP (DW_OP_const_type), 0, 0);
          mem_loc_result->dw_loc_oprnd1.val_class = dw_val_class_die_ref;
          mem_loc_result->dw_loc_oprnd1.v.val_die_ref.die = type_die;
          mem_loc_result->dw_loc_oprnd1.v.val_die_ref.external = 0;
@@ -14300,7 +14385,7 @@ mem_loc_descriptor (rtx rtl, machine_mode mode,
          type_die = base_type_for_mode (mode, SCALAR_INT_MODE_P (mode));
          if (type_die == NULL)
            return NULL;
-         mem_loc_result = new_loc_descr (dwarf_op (DW_OP_const_type), 0, 0);
+         mem_loc_result = new_loc_descr (dwarf_OP (DW_OP_const_type), 0, 0);
          mem_loc_result->dw_loc_oprnd1.val_class = dw_val_class_die_ref;
          mem_loc_result->dw_loc_oprnd1.v.val_die_ref.die = type_die;
          mem_loc_result->dw_loc_oprnd1.v.val_die_ref.external = 0;
@@ -14454,7 +14539,7 @@ mem_loc_descriptor (rtx rtl, machine_mode mode,
                                             GET_CODE (rtl) == UNSIGNED_FLOAT);
              if (type_die == NULL)
                break;
-             cvt = new_loc_descr (dwarf_op (DW_OP_convert), 0, 0);
+             cvt = new_loc_descr (dwarf_OP (DW_OP_convert), 0, 0);
              cvt->dw_loc_oprnd1.val_class = dw_val_class_die_ref;
              cvt->dw_loc_oprnd1.v.val_die_ref.die = type_die;
              cvt->dw_loc_oprnd1.v.val_die_ref.external = 0;
@@ -14463,7 +14548,7 @@ mem_loc_descriptor (rtx rtl, machine_mode mode,
          type_die = base_type_for_mode (mode, GET_CODE (rtl) == UNSIGNED_FIX);
          if (type_die == NULL)
            break;
-         cvt = new_loc_descr (dwarf_op (DW_OP_convert), 0, 0);
+         cvt = new_loc_descr (dwarf_OP (DW_OP_convert), 0, 0);
          cvt->dw_loc_oprnd1.val_class = dw_val_class_die_ref;
          cvt->dw_loc_oprnd1.v.val_die_ref.die = type_die;
          cvt->dw_loc_oprnd1.v.val_die_ref.external = 0;
@@ -14640,7 +14725,7 @@ implicit_ptr_descriptor (rtx rtl, HOST_WIDE_INT offset)
              || TREE_CODE (DEBUG_IMPLICIT_PTR_DECL (rtl)) == PARM_DECL
              || TREE_CODE (DEBUG_IMPLICIT_PTR_DECL (rtl)) == RESULT_DECL);
   ref = lookup_decl_die (DEBUG_IMPLICIT_PTR_DECL (rtl));
-  ret = new_loc_descr (dwarf_op (DW_OP_implicit_pointer), 0, offset);
+  ret = new_loc_descr (dwarf_OP (DW_OP_implicit_pointer), 0, offset);
   ret->dw_loc_oprnd2.val_class = dw_val_class_const;
   if (ref)
     {
@@ -20635,7 +20720,7 @@ premark_types_used_by_global_vars (void)
       ->traverse<void *, premark_types_used_by_global_vars_helper> (NULL);
 }
 
-/* Generate a DW_TAG_GNU_call_site DIE in function DECL under SUBR_DIE
+/* Generate a DW_TAG_call_site DIE in function DECL under SUBR_DIE
    for CA_LOC call arg loc node.  */
 
 static dw_die_ref
@@ -20656,17 +20741,18 @@ gen_call_site_die (tree decl, dw_die_ref subr_die,
     }
   if (stmt_die == NULL)
     stmt_die = subr_die;
-  die = new_die (DW_TAG_GNU_call_site, stmt_die, NULL_TREE);
-  add_AT_lbl_id (die, DW_AT_low_pc, ca_loc->label);
+  die = new_die (dwarf_TAG (DW_TAG_call_site), stmt_die, NULL_TREE);
+  add_AT_lbl_id (die, dwarf_AT (DW_AT_call_return_pc), ca_loc->label);
   if (ca_loc->tail_call_p)
-    add_AT_flag (die, DW_AT_GNU_tail_call, 1);
+    add_AT_flag (die, dwarf_AT (DW_AT_call_tail_call), 1);
   if (ca_loc->symbol_ref)
     {
       dw_die_ref tdie = lookup_decl_die (SYMBOL_REF_DECL (ca_loc->symbol_ref));
       if (tdie)
-       add_AT_die_ref (die, DW_AT_abstract_origin, tdie);
+       add_AT_die_ref (die, dwarf_AT (DW_AT_call_origin), tdie);
       else
-        add_AT_addr (die, DW_AT_abstract_origin, ca_loc->symbol_ref, false);
+       add_AT_addr (die, dwarf_AT (DW_AT_call_origin), ca_loc->symbol_ref,
+                    false);
     }
   return die;
 }
@@ -20963,7 +21049,7 @@ gen_subprogram_die (tree decl, dw_die_ref context_die)
            add_AT_flag (subr_die, DW_AT_deleted, 1);
 
          /* If this is a C++11 defaulted special function member then
-            generate a DW_AT_GNU_defaulted attribute.  */
+            generate a DW_AT_defaulted attribute.  */
          if (dwarf_version >= 5 || !dwarf_strict)
            {
              int defaulted
@@ -21332,7 +21418,7 @@ gen_subprogram_die (tree decl, dw_die_ref context_die)
         location info.  */
       decls_for_scope (outer_scope, subr_die);
 
-      if (call_arg_locations && !dwarf_strict)
+      if (call_arg_locations && (!dwarf_strict || dwarf_version >= 5))
        {
          struct call_arg_loc_node *ca_loc;
          for (ca_loc = call_arg_locations; ca_loc; ca_loc = ca_loc->next)
@@ -21368,7 +21454,7 @@ gen_subprogram_die (tree decl, dw_die_ref context_die)
                    continue;
                  /* Get dynamic information about call target only if we
                     have no static information: we cannot generate both
-                    DW_AT_abstract_origin and DW_AT_GNU_call_site_target
+                    DW_AT_call_origin and DW_AT_call_target
                     attributes.  */
                  if (ca_loc->symbol_ref == NULL_RTX)
                    {
@@ -21418,13 +21504,14 @@ gen_subprogram_die (tree decl, dw_die_ref context_die)
                    continue;
                  if (die == NULL)
                    die = gen_call_site_die (decl, subr_die, ca_loc);
-                 cdie = new_die (DW_TAG_GNU_call_site_parameter, die,
+                 cdie = new_die (dwarf_TAG (DW_TAG_call_site_parameter), die,
                                  NULL_TREE);
                  if (reg != NULL)
                    add_AT_loc (cdie, DW_AT_location, reg);
                  else if (tdie != NULL)
-                   add_AT_die_ref (cdie, DW_AT_abstract_origin, tdie);
-                 add_AT_loc (cdie, DW_AT_GNU_call_site_value, val);
+                   add_AT_die_ref (cdie, dwarf_AT (DW_AT_call_parameter),
+                                   tdie);
+                 add_AT_loc (cdie, dwarf_AT (DW_AT_call_value), val);
                  if (next_arg != XEXP (arg, 1))
                    {
                      mode = GET_MODE (XEXP (XEXP (XEXP (arg, 1), 0), 1));
@@ -21435,7 +21522,8 @@ gen_subprogram_die (tree decl, dw_die_ref context_die)
                                                mode, VOIDmode,
                                                VAR_INIT_STATUS_INITIALIZED);
                      if (val != NULL)
-                       add_AT_loc (cdie, DW_AT_GNU_call_site_data_value, val);
+                       add_AT_loc (cdie, dwarf_AT (DW_AT_call_data_value),
+                                   val);
                    }
                }
              if (die == NULL
@@ -21452,7 +21540,7 @@ gen_subprogram_die (tree decl, dw_die_ref context_die)
                                               VOIDmode,
                                               VAR_INIT_STATUS_INITIALIZED);
                  if (tval)
-                   add_AT_loc (die, DW_AT_GNU_call_site_target, tval);
+                   add_AT_loc (die, dwarf_AT (DW_AT_call_target), tval);
                  else if (tlocc != NULL_RTX)
                    {
                      tval = mem_loc_descriptor (tlocc,
@@ -21461,7 +21549,8 @@ gen_subprogram_die (tree decl, dw_die_ref context_die)
                                                 VOIDmode,
                                                 VAR_INIT_STATUS_INITIALIZED);
                      if (tval)
-                       add_AT_loc (die, DW_AT_GNU_call_site_target_clobbered,
+                       add_AT_loc (die,
+                                   dwarf_AT (DW_AT_call_target_clobbered),
                                    tval);
                    }
                }
@@ -21477,13 +21566,13 @@ gen_subprogram_die (tree decl, dw_die_ref context_die)
       call_arg_loc_last = NULL;
       if (tail_call_site_count >= 0
          && tail_call_site_count == tail_call_site_note_count
-         && !dwarf_strict)
+         && (!dwarf_strict || dwarf_version >= 5))
        {
          if (call_site_count >= 0
              && call_site_count == call_site_note_count)
-           add_AT_flag (subr_die, DW_AT_GNU_all_call_sites, 1);
+           add_AT_flag (subr_die, dwarf_AT (DW_AT_call_all_calls), 1);
          else
-           add_AT_flag (subr_die, DW_AT_GNU_all_tail_call_sites, 1);
+           add_AT_flag (subr_die, dwarf_AT (DW_AT_call_all_tail_calls), 1);
        }
       call_site_count = -1;
       tail_call_site_count = -1;
@@ -27010,7 +27099,7 @@ optimize_one_addr_into_implicit_ptr (dw_loc_descr_ref loc)
          if (ref && (get_AT (ref, DW_AT_location)
                      || get_AT (ref, DW_AT_const_value)))
            {
-             loc->dw_loc_opc = dwarf_op (DW_OP_implicit_pointer);
+             loc->dw_loc_opc = dwarf_OP (DW_OP_implicit_pointer);
              loc->dw_loc_oprnd1.val_class = dw_val_class_die_ref;
              loc->dw_loc_oprnd1.val_entry = NULL;
              loc->dw_loc_oprnd1.v.val_die_ref.die = ref;
@@ -27233,7 +27322,7 @@ optimize_location_into_implicit_ptr (dw_die_ref die, tree decl)
          || (!get_AT (ref, DW_AT_location)
              && !get_AT (ref, DW_AT_const_value)))
        return;
-      l = new_loc_descr (dwarf_op (DW_OP_implicit_pointer), 0, offset);
+      l = new_loc_descr (dwarf_OP (DW_OP_implicit_pointer), 0, offset);
       l->dw_loc_oprnd1.val_class = dw_val_class_die_ref;
       l->dw_loc_oprnd1.v.val_die_ref.die = ref;
       l->dw_loc_oprnd1.v.val_die_ref.external = 0;
@@ -27561,8 +27650,10 @@ resolve_addr (dw_die_ref die)
            remove_AT (die, a->dw_attr);
            ix--;
          }
-       if (die->die_tag == DW_TAG_GNU_call_site
-           && a->dw_attr == DW_AT_abstract_origin)
+       if ((die->die_tag == DW_TAG_call_site
+            && a->dw_attr == DW_AT_call_origin)
+           || (die->die_tag == DW_TAG_GNU_call_site
+               && a->dw_attr == DW_AT_abstract_origin))
          {
            tree tdecl = SYMBOL_REF_DECL (a->dw_attr_val.v.val_addr);
            dw_die_ref tdie = lookup_decl_die (tdecl);