From patchwork Mon May 14 13:35:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Wielaard X-Patchwork-Id: 912929 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-477639-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=klomp.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="eWL5Zwuu"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40l1tC6XGcz9s0q for ; Mon, 14 May 2018 23:35:46 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id; q=dns; s=default; b=jeAiF7xmgNlQ MICw6vPPS2OQ9f7ltk1UUjYGCCEx9snh2hGxrILZ/HgdJDbvHf/Nz50mU7fE1N6L NFXtln32U+BcJ4MMIU72qtxdwj+0hkNvSKPax3E9UFt5T4Ift1ttXTVwq6osNkE9 2G+BeWSRcG6E3DgukJVyZ82IaqwsX3o= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id; s=default; bh=0Qn3dlnuzl10a0TJnu TciqrsQtk=; b=eWL5ZwuugglWqFqNep+b0D/qduy7aadQErroy1cen1UwjyDJBs ZmPseGUHBqetLuExBZl9lQiuoRJdaMkrVknaHR1OOzSepQMZMZuo7Nf0hSO+p4oK 4+8SIH30ilfJEa69dGKvgI++7fFLIJh9xYNvmlATttDm0OG5NIi1XZKTg= Received: (qmail 110490 invoked by alias); 14 May 2018 13:35:37 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 110474 invoked by uid 89); 14 May 2018 13:35:37 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=H*F:U*mark, U*mark, H*Ad:U*mark X-HELO: gnu.wildebeest.org Received: from wildebeest.demon.nl (HELO gnu.wildebeest.org) (212.238.236.112) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 14 May 2018 13:35:35 +0000 Received: from tarox.wildebeest.org (tarox.wildebeest.org [172.31.17.39]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by gnu.wildebeest.org (Postfix) with ESMTPSA id BEDD2302BB04; Mon, 14 May 2018 15:35:32 +0200 (CEST) Received: by tarox.wildebeest.org (Postfix, from userid 1000) id 7A3C3413CD4B; Mon, 14 May 2018 15:35:32 +0200 (CEST) From: Mark Wielaard To: gcc-patches@gcc.gnu.org Cc: Mark Wielaard Subject: [PATCH] DWARF: Use DW_OP_addrx and DW_OP_constx for DWARF5. Date: Mon, 14 May 2018 15:35:23 +0200 Message-Id: <1526304923-16673-1-git-send-email-mark@klomp.org> For older DWARF and -gsplit-dwarf we want to emit DW_OP_GNU_addr_index and DW_OP_GNU_const_index, but for DWARF5 we should use DW_OP_addrx and DW_OP_constx. gcc/ChangeLog: * dwarf2out.c (dwarf_OP): Handle DW_OP_addrx and DW_OP_constx. (size_of_loc_descr): Likewise. (output_loc_operands): Likewise. (output_loc_operands_raw): Likewise. (dw_addr_op): Use dwarf_OP () for DW_OP_constx and DW_OP_addrx. (resolve_addr_in_expr): Handle DW_OP_addrx and DW_OP_constx. (hash_loc_operands): Likewise. (compare_loc_operands): Likewise. --- gcc/ChangeLog | 11 +++++++++++ gcc/dwarf2out.c | 33 +++++++++++++++++++++++++++++---- 2 files changed, 40 insertions(+), 4 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8589065..6bc342d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,14 @@ +2018-05-13 Mark Wielaard + + * dwarf2out.c (dwarf_OP): Handle DW_OP_addrx and DW_OP_constx. + (size_of_loc_descr): Likewise. + (output_loc_operands): Likewise. + (output_loc_operands_raw): Likewise. + (dw_addr_op): Use dwarf_OP () for DW_OP_constx and DW_OP_addrx. + (resolve_addr_in_expr): Handle DW_OP_addrx and DW_OP_constx. + (hash_loc_operands): Likewise. + (compare_loc_operands): Likewise. + 2018-04-30 Mark Wielaard * dwarf2out.c (dwarf_FORM): New function. diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 0d2af85..9c1d7c4 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -1657,6 +1657,16 @@ dwarf_OP (enum dwarf_location_atom op) return DW_OP_GNU_reinterpret; break; + case DW_OP_addrx: + if (dwarf_version < 5) + return DW_OP_GNU_addr_index; + break; + + case DW_OP_constx: + if (dwarf_version < 5) + return DW_OP_GNU_const_index; + break; + default: break; } @@ -1794,7 +1804,9 @@ size_of_loc_descr (dw_loc_descr_ref loc) size += DWARF2_ADDR_SIZE; break; case DW_OP_GNU_addr_index: + case DW_OP_addrx: case DW_OP_GNU_const_index: + case DW_OP_constx: gcc_assert (loc->dw_loc_oprnd1.val_entry->index != NO_INDEX_ASSIGNED); size += size_of_uleb128 (loc->dw_loc_oprnd1.val_entry->index); break; @@ -2294,7 +2306,9 @@ output_loc_operands (dw_loc_descr_ref loc, int for_eh_or_skip) break; case DW_OP_GNU_addr_index: + case DW_OP_addrx: case DW_OP_GNU_const_index: + case DW_OP_constx: gcc_assert (loc->dw_loc_oprnd1.val_entry->index != NO_INDEX_ASSIGNED); dw2_asm_output_data_uleb128 (loc->dw_loc_oprnd1.val_entry->index, "(index into .debug_addr)"); @@ -2525,7 +2539,9 @@ output_loc_operands_raw (dw_loc_descr_ref loc) { case DW_OP_addr: case DW_OP_GNU_addr_index: + case DW_OP_addrx: case DW_OP_GNU_const_index: + case DW_OP_constx: case DW_OP_implicit_value: /* We cannot output addresses in .cfi_escape, only bytes. */ gcc_unreachable (); @@ -3925,10 +3941,10 @@ static inline enum dwarf_location_atom dw_addr_op (enum dtprel_bool dtprel) { if (dtprel == dtprel_true) - return (dwarf_split_debug_info ? DW_OP_GNU_const_index + return (dwarf_split_debug_info ? dwarf_OP (DW_OP_constx) : (DWARF2_ADDR_SIZE == 4 ? DW_OP_const4u : DW_OP_const8u)); else - return dwarf_split_debug_info ? DW_OP_GNU_addr_index : DW_OP_addr; + return dwarf_split_debug_info ? dwarf_OP (DW_OP_addrx) : DW_OP_addr; } /* Return a pointer to a newly allocated address location description. If @@ -29746,9 +29762,14 @@ resolve_addr_in_expr (dw_attr_node *a, dw_loc_descr_ref loc) } break; case DW_OP_GNU_addr_index: + case DW_OP_addrx: case DW_OP_GNU_const_index: - if (loc->dw_loc_opc == DW_OP_GNU_addr_index - || (loc->dw_loc_opc == DW_OP_GNU_const_index && loc->dtprel)) + case DW_OP_constx: + if ((loc->dw_loc_opc == DW_OP_GNU_addr_index + || loc->dw_loc_opc == DW_OP_addrx) + || ((loc->dw_loc_opc == DW_OP_GNU_const_index + || loc->dw_loc_opc == DW_OP_constx) + && loc->dtprel)) { rtx rtl = loc->dw_loc_oprnd1.val_entry->addr.rtl; if (!resolve_one_addr (&rtl)) @@ -30534,7 +30555,9 @@ hash_loc_operands (dw_loc_descr_ref loc, inchash::hash &hstate) inchash::add_rtx (val1->v.val_addr, hstate); break; case DW_OP_GNU_addr_index: + case DW_OP_addrx: case DW_OP_GNU_const_index: + case DW_OP_constx: { if (loc->dtprel) { @@ -30775,7 +30798,9 @@ compare_loc_operands (dw_loc_descr_ref x, dw_loc_descr_ref y) hash_addr: return rtx_equal_p (valx1->v.val_addr, valy1->v.val_addr); case DW_OP_GNU_addr_index: + case DW_OP_addrx: case DW_OP_GNU_const_index: + case DW_OP_constx: { rtx ax1 = valx1->val_entry->addr.rtl; rtx ay1 = valy1->val_entry->addr.rtl;