re PR debug/77315 (emit DW_OP_form_tls_address)
authorTom Tromey <tom@tromey.com>
Mon, 31 Oct 2016 20:08:44 +0000 (20:08 +0000)
committerTom Tromey <tromey@gcc.gnu.org>
Mon, 31 Oct 2016 20:08:44 +0000 (20:08 +0000)
PR debug/77315:
* dwarf2out.c (mem_loc_descriptor): Use DW_OP_form_tls_address.
(resolve_args_picking_1): Move DW_OP_form_tls_address case next to
DW_OP_GNU_push_tls_address case.
(loc_list_from_tree_1): Use DW_OP_form_tls_address.

From-SVN: r241721

gcc/ChangeLog
gcc/dwarf2out.c

index d8725d0807b5988edfb68da2952134693488358c..4e354d018477b42626a39460cb4ef6be5ef38a2a 100644 (file)
@@ -1,3 +1,11 @@
+2016-10-31  Tom Tromey  <tom@tromey.com>
+
+       PR debug/77315:
+       * dwarf2out.c (mem_loc_descriptor): Use DW_OP_form_tls_address.
+       (resolve_args_picking_1): Move DW_OP_form_tls_address case next to
+       DW_OP_GNU_push_tls_address case.
+       (loc_list_from_tree_1): Use DW_OP_form_tls_address.
+
 2016-10-31  Jakub Jelinek  <jakub@redhat.com>
 
        * dwarf2out.h (struct dw_loc_descr_node): Adjust comment
index bd16d0e71b45f81efcc984eaf4cd27ec64648486..a690b90a205d7fc6689b9d765ac7e717bbec8eee 100644 (file)
@@ -14251,7 +14251,12 @@ mem_loc_descriptor (rtx rtl, machine_mode mode,
 
           temp = new_addr_loc_descr (rtl, dtprel_true);
 
-         mem_loc_result = new_loc_descr (DW_OP_GNU_push_tls_address, 0, 0);
+         /* We check for DWARF 5 here because gdb did not implement
+            DW_OP_form_tls_address until after 7.12.  */
+         mem_loc_result = new_loc_descr ((dwarf_version >= 5
+                                          ? DW_OP_form_tls_address
+                                          : DW_OP_GNU_push_tls_address),
+                                         0, 0);
          add_loc_descr (&mem_loc_result, temp);
 
          break;
@@ -16137,7 +16142,6 @@ resolve_args_picking_1 (dw_loc_descr_ref loc, unsigned initial_frame_offset,
        case DW_OP_piece:
        case DW_OP_deref_size:
        case DW_OP_nop:
-       case DW_OP_form_tls_address:
        case DW_OP_bit_piece:
        case DW_OP_implicit_value:
        case DW_OP_stack_value:
@@ -16272,6 +16276,7 @@ resolve_args_picking_1 (dw_loc_descr_ref loc, unsigned initial_frame_offset,
        case DW_OP_deref_type:
        case DW_OP_convert:
        case DW_OP_reinterpret:
+       case DW_OP_form_tls_address:
        case DW_OP_GNU_push_tls_address:
        case DW_OP_GNU_uninit:
        case DW_OP_GNU_encoded_addr:
@@ -16615,8 +16620,11 @@ loc_list_from_tree_1 (tree loc, int want_address,
                  operand shouldn't be.  */
              if (DECL_EXTERNAL (loc) && !targetm.binds_local_p (loc))
                return 0;
-             dtprel = dtprel_true;
-             tls_op = DW_OP_GNU_push_tls_address;
+             dtprel = dtprel_true;
+             /* We check for DWARF 5 here because gdb did not implement
+                DW_OP_form_tls_address until after 7.12.  */
+             tls_op = (dwarf_version >= 5 ? DW_OP_form_tls_address
+                       : DW_OP_GNU_push_tls_address);
            }
          else
            {