From patchwork Wed Apr 11 11:09:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 897143 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-476202-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="LGWYgDUl"; 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 40LhC35BqWz9s35 for ; Wed, 11 Apr 2018 21:09:51 +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:date :from:to:cc:subject:message-id:mime-version:content-type; q=dns; s=default; b=e8h6BJrQ637W95BnuL7eDYITTV8tqLuZihL4geDqrI7YErNoIA 5XSEDT4GJhTlMTOq/aEJ4hkagg1VeJk97tPTTqRzs6jtLEic2GrrxlR3wz3zbun6 bIXVd/R7/Ci+jtlMfC6lKPrKLjZ08BN7o308pyflXjp4GuQEypl4UT9M4= 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:date :from:to:cc:subject:message-id:mime-version:content-type; s= default; bh=ghYRB/gopq/uYaeHw8JGYcccCyw=; b=LGWYgDUlNf3+1kCetc4F 0UlH5udyEcwzppeSqeDDj3cSD1d+CW4AWx29B50gZL+DSScebvwtd7Ok9pM1vELT dGZr6ljd/ZW0jG3f/z4CokhAM+0tTwGd0ez6bOsnpNcJ5QTrvY4fJXI55gFE6qbw Mq0/bOn07dN44JVOpI7VceQ= Received: (qmail 85555 invoked by alias); 11 Apr 2018 11:09:44 -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 85535 invoked by uid 89); 11 Apr 2018 11:09:43 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.9 required=5.0 tests=BAYES_00, GIT_PATCH_2, GIT_PATCH_3, SPF_PASS autolearn=ham version=3.3.2 spammy=sk:DW_OP_G, regtesting, sk:dw_op_g X-HELO: mx2.suse.de Received: from mx2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 11 Apr 2018 11:09:41 +0000 Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id BEEC3AF26; Wed, 11 Apr 2018 11:09:39 +0000 (UTC) Date: Wed, 11 Apr 2018 13:09:39 +0200 (CEST) From: Richard Biener To: gcc-patches@gcc.gnu.org cc: Jakub Jelinek Subject: [PATCH] Fix PR85339, bogus early debug Message-ID: User-Agent: Alpine 2.20 (LSU 67 2015-01-07) MIME-Version: 1.0 The following fixes the missing .debug_line in the early LTO debug DWARF which makes all DW_AT_decl_file invalid. LTO bootstrapped on x86_64-unknown-linux-gnu, LTO bootstrap with -g3 still running, so is regtesting. I verified it works with thin and fat LTO and that the early DWARF has a proper .debug_line including the reference from the CU. This then also makes dwz happy with simple objects that do not contain DW_OP_GNU_variable_value. Ok for trunk if the rest of testing succeeds? Thanks, Richard. 2018-04-11 Richard Biener PR lto/85339 * dwarf2out.c (dwarf2out_finish): Remove DW_AT_stmt_list attribute from early DWARF output. (dwarf2out_early_finish): Output line info unconditionally into early DWARF and add reference to it. Index: gcc/dwarf2out.c =================================================================== --- gcc/dwarf2out.c (revision 259308) +++ gcc/dwarf2out.c (working copy) @@ -31045,7 +31046,8 @@ dwarf2out_finish (const char *) /* Reset die CU symbol so we don't output it twice. */ comp_unit_die ()->die_id.die_symbol = NULL; - /* Remove DW_AT_macro from the early output. */ + /* Remove DW_AT_macro and DW_AT_stmt_list from the early output. */ + remove_AT (comp_unit_die (), DW_AT_stmt_list); if (have_macinfo) remove_AT (comp_unit_die (), DEBUG_MACRO_ATTRIBUTE); @@ -31681,6 +31683,7 @@ static void dwarf2out_early_finish (const char *filename) { set_early_dwarf s; + char dl_section_ref[MAX_ARTIFICIAL_LABEL_BYTES]; /* PCH might result in DW_AT_producer string being restored from the header compilation, so always fill it with empty string initially @@ -31829,6 +31836,16 @@ dwarf2out_early_finish (const char *file ctnode != NULL; ctnode = ctnode->next) add_sibling_attributes (ctnode->root_die); + /* AIX Assembler inserts the length, so adjust the reference to match the + offset expected by debuggers. */ + strcpy (dl_section_ref, debug_skeleton_line_section_label); + if (XCOFF_DEBUGGING_INFO) + strcat (dl_section_ref, DWARF_INITIAL_LENGTH_SIZE_STR); + + if (debug_info_level >= DINFO_LEVEL_TERSE) + add_AT_lineptr (comp_unit_die (), DW_AT_stmt_list, + dl_section_ref); + if (have_macinfo) add_AT_macptr (comp_unit_die (), DEBUG_MACRO_ATTRIBUTE, macinfo_section_label); @@ -31898,11 +31915,6 @@ dwarf2out_early_finish (const char *file output_macinfo (debug_skeleton_line_section_label, true); dw2_asm_output_data (1, 0, "End compilation unit"); - /* Emit a skeleton debug_line section. */ - switch_to_section (debug_skeleton_line_section); - ASM_OUTPUT_LABEL (asm_out_file, debug_skeleton_line_section_label); - output_line_info (true); - if (flag_fat_lto_objects) { vec_free (macinfo_table); @@ -31910,6 +31922,10 @@ dwarf2out_early_finish (const char *file } } + /* Emit a skeleton debug_line section. */ + switch_to_section (debug_skeleton_line_section); + ASM_OUTPUT_LABEL (asm_out_file, debug_skeleton_line_section_label); + output_line_info (true); /* If we emitted any indirect strings, output the string table too. */ if (debug_str_hash || skeleton_debug_str_hash)