From patchwork Sat Apr 28 15:23:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Wielaard X-Patchwork-Id: 906139 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-476947-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="ocg3vFcq"; 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 40YF2047Sdz9s0W for ; Sun, 29 Apr 2018 01:23:30 +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=tfZOHHHRlEDp Q9YR/W+fbnE605xxVUeKH51/lE0fyKfrjlTK3R1LAAQyaQr2473Xtz+snlmOCKUy ua3VFwmYVwU1jpBfyMtBrdBVLbmxdjIBBZS3FLkgUxVABTg66Fcql7iH3tWp9I+r VOYCEPurqhyPt03Z1Oloiw9lG117/1c= 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=IEflrKkVwFUjWqtWav ApRkT1n+s=; b=ocg3vFcqSyK7tdh0k741l0HeGvvmX1FTuKsRtizAI/tdPiF8yg ZQIgPjIWg8ChHYQo6zQY2naRnBxywq1z5KszgVvWZfpIaBxeUZxiAq1VUCv4bUvd SQHXN9jn3gQWPiLshkRJWjzeRLmog7G60KQ20HmlEWiGUnd2J4ZUxk8rE= Received: (qmail 78148 invoked by alias); 28 Apr 2018 15:23:22 -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 78138 invoked by uid 89); 28 Apr 2018 15:23:21 -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=consumer, elements, 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; Sat, 28 Apr 2018 15:23:20 +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 CF63631F8B49; Sat, 28 Apr 2018 17:23:17 +0200 (CEST) Received: by tarox.wildebeest.org (Postfix, from userid 1000) id BA4E7413CB3E; Sat, 28 Apr 2018 17:23:17 +0200 (CEST) From: Mark Wielaard To: gcc-patches@gcc.gnu.org Cc: Mark Wielaard Subject: [PATCH] DWARF: Add .debug_addr table header for dwarf_version >= 5. Date: Sat, 28 Apr 2018 17:23:12 +0200 Message-Id: <1524928992-18156-1-git-send-email-mark@klomp.org> GNU DebugFission didn't add table headers for the .debug_addr tables, but DWARF5 does. The table header make it possible for a DWARF consumer to parse the address tables without having to index all .debug_info CUs first. We can keep using the .debug_addr section label as is, because the DW_AT_addr_base attribute points at the actual address index, which starts right after the table header. So the label is generated at the correct location whether the header is added first or not. gcc/ChangeLog * dwarf2out.c (dwarf2out_finish): Add .debug_addr table header for dwarf_version >= 5. diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index d3d925d..51d0ca4 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -31293,6 +31293,21 @@ dwarf2out_finish (const char *) } switch_to_section (debug_addr_section); + /* GNU DebugFission didn't have a header for .debug_addr. */ + if (dwarf_version >= 5) + { + unsigned long addrs_length = + addr_index_table->elements () * DWARF2_ADDR_SIZE + 4; + + if (DWARF_INITIAL_LENGTH_SIZE - DWARF_OFFSET_SIZE == 4) + dw2_asm_output_data (4, 0xffffffff, + "Escape value for 64-bit DWARF extension"); + dw2_asm_output_data (DWARF_OFFSET_SIZE, addrs_length, + "Length of Address Unit"); + dw2_asm_output_data (2, 5, "DWARF addr version"); + dw2_asm_output_data (1, DWARF2_ADDR_SIZE, "Size of Address"); + dw2_asm_output_data (1, 0, "Size of Segment Descriptor"); + } ASM_OUTPUT_LABEL (asm_out_file, debug_addr_section_label); output_addr_table (); }