From patchwork Thu Apr 12 11:35:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 897619 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-476262-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="t44kng4V"; 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 40MJkm1g0zz9s2L for ; Thu, 12 Apr 2018 21:36:00 +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=w0i9MI5UFg+Nze6wBVoVTMYzbn6MqS9fDir53vn/YyDyX4N3TU KvQIAwUk+WgUqahyVR6k7WBdXqOcvZaCsJE6sfQyO1Xxcq8QtbTKT/qQtsGnWqOv 4Ji6L9dXB5tYJH32OhKtQsqiv/7fp8PrQjEfBuWwyXmR+Px+a3WWRegHA= 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=NGoh6TGxbBYXd7sMsz5jxgy9BLM=; b=t44kng4VfXb1O6UZYz2O erU9XE3Vj5LnXFkFKHCbPyLG834VZYBTS0FcOzbOWIC2S70ad7TQgPxBYMWPK7eC fKoypx5zUF3IRJ4xz9PhZCthyoAa5UGZZb9z3GskK8Q7O4pKUalnqgLBfWuAyFMc Eof+v5iZUmQ4Dpw6eKyCGiI= Received: (qmail 60586 invoked by alias); 12 Apr 2018 11:35:52 -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 59939 invoked by uid 89); 12 Apr 2018 11:35:51 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-16.1 required=5.0 tests=BAYES_00, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, SPF_PASS autolearn=ham version=3.3.2 spammy=slim, sk:saved_d 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; Thu, 12 Apr 2018 11:35:49 +0000 Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 89BE0AC81; Thu, 12 Apr 2018 11:35:46 +0000 (UTC) Date: Thu, 12 Apr 2018 13:35:46 +0200 (CEST) From: Richard Biener To: gcc-patches@gcc.gnu.org cc: Jakub Jelinek Subject: [PATCH] Disable -gsplit-dwarf for all LTO debug Message-ID: User-Agent: Alpine 2.20 (LSU 67 2015-01-07) MIME-Version: 1.0 The following disables split-dwarf for the LTO part of the early debug (keeping it for the fat part) and makes sure the driver doesn't see -gsplit-dwarf in effect. That works for all but the compile stage and slim objects (the default) which then ends up generating an empty .dwo file. I'm not sure where to prune for this case given that -fno-fat-lto-objects seems to be just ignored if it isn't supported. Note that we need the dwarf2out.c part as otherwise the late references cannot be resolved since the debug is copied from .o to .dwo files early. Opinions? Thanks, Richard. 2018-04-12 Richard Biener * lto-wrapper.c (run_gcc): Add -gno-split-dwarf to cancel any such option from compile or link time in a way visible to the driver. * dwarf2out.c (add_top_level_skeleton_die_attrs): Avoid adding DW_AT_GNU_pubnames twice. (dwarf2out_early_finish): Unconditionally call add_AT_pubnames. Disable dwarf_split_debug_info around the early LTO DWARF emission and remove then dead code. Index: gcc/lto-wrapper.c =================================================================== --- gcc/lto-wrapper.c (revision 259337) +++ gcc/lto-wrapper.c (working copy) @@ -1123,6 +1123,7 @@ run_gcc (unsigned argc, char *argv[]) append_compiler_options (&argv_obstack, fdecoded_options, fdecoded_options_count); append_linker_options (&argv_obstack, decoded_options, decoded_options_count); + obstack_ptr_grow (&argv_obstack, "-gno-split-dwarf"); /* Scan linker driver arguments for things that are of relevance to us. */ for (j = 1; j < decoded_options_count; ++j) Index: gcc/dwarf2out.c =================================================================== --- gcc/dwarf2out.c (revision 259337) +++ gcc/dwarf2out.c (working copy) @@ -11105,7 +11105,8 @@ add_top_level_skeleton_die_attrs (dw_die add_skeleton_AT_string (die, dwarf_AT (DW_AT_dwo_name), dwo_file_name); if (comp_dir != NULL) add_skeleton_AT_string (die, DW_AT_comp_dir, comp_dir); - add_AT_pubnames (die); + if (!get_AT (die, DW_AT_GNU_pubnames)) + add_AT_pubnames (die); add_AT_lineptr (die, DW_AT_GNU_addr_base, debug_addr_section_label); } @@ -31811,11 +31812,8 @@ dwarf2out_early_finish (const char *file note_variable_value (node->die); /* The AT_pubnames attribute needs to go in all skeleton dies, including - both the main_cu and all skeleton TUs. Making this call unconditional - would end up either adding a second copy of the AT_pubnames attribute, or - requiring a special case in add_top_level_skeleton_die_attrs. */ - if (!dwarf_split_debug_info) - add_AT_pubnames (comp_unit_die ()); + both the main_cu and all skeleton TUs. */ + add_AT_pubnames (comp_unit_die ()); /* The early debug phase is now finished. */ early_dwarf_finished = true; @@ -31824,6 +31822,11 @@ dwarf2out_early_finish (const char *file if (!flag_generate_lto && !flag_generate_offload) return; + /* For the early LTO DWARF we do not want split DWARF because it really + doesn't make much sense. */ + int saved_dwarf_split_debug_info = dwarf_split_debug_info; + dwarf_split_debug_info = 0; + /* Now as we are going to output for LTO initialize sections and labels to the LTO variants. We don't need a random-seed postfix as other LTO sections as linking the LTO debug sections into one in a partial @@ -31858,12 +31861,6 @@ dwarf2out_early_finish (const char *file save_macinfo_strings (); - if (dwarf_split_debug_info) - { - unsigned int index = 0; - debug_str_hash->traverse_noresize (&index); - } - /* Output all of the compilation units. We put the main one last so that the offsets are available to output_pubnames. */ for (limbo_die_node *node = limbo_die_list; node; node = node->next) @@ -31884,9 +31881,7 @@ dwarf2out_early_finish (const char *file attributes. */ if (debug_info_level >= DINFO_LEVEL_TERSE) add_AT_lineptr (ctnode->root_die, DW_AT_stmt_list, - (!dwarf_split_debug_info - ? debug_line_section_label - : debug_skeleton_line_section_label)); + debug_line_section_label); output_comdat_type_unit (ctnode); *slot = ctnode; @@ -31939,6 +31934,8 @@ dwarf2out_early_finish (const char *file /* Switch back to the text section. */ switch_to_section (text_section); + + dwarf_split_debug_info = saved_dwarf_split_debug_info; } /* Reset all state within dwarf2out.c so that we can rerun the compiler