From patchwork Mon Aug 19 18:28:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Edlinger X-Patchwork-Id: 1973926 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=HOTMAIL.DE header.i=@HOTMAIL.DE header.a=rsa-sha256 header.s=selector1 header.b=enHBxx/k; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Wnh1p3Hgfz1yXf for ; Tue, 20 Aug 2024 04:28:44 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 71DE2384A4B0 for ; Mon, 19 Aug 2024 18:28:40 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03olkn20800.outbound.protection.outlook.com [IPv6:2a01:111:f403:2e0e::800]) by sourceware.org (Postfix) with ESMTPS id CDFEC384A86E for ; Mon, 19 Aug 2024 18:28:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CDFEC384A86E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=hotmail.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=hotmail.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org CDFEC384A86E Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=2a01:111:f403:2e0e::800 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1724092098; cv=pass; b=KR266iFodf4gjXGC3XpG0AEHw5jyE7YKX/4xfxQAj2qmkE5YFOwXcvEuHj8x30pql635kgjk1NZKh19S8PzD5qjTUdMkrwps51fFhGeMXv2SarRA898ooBnhgh2Wd0rS21YGrUIWd/KhGAGhZfBqtI3YvThVupvKZbvg5hLLH4U= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1724092098; c=relaxed/simple; bh=fSU4vCx+VebVfGJKxnAX7GNTbDv6nmT3Sdy43PjRmME=; h=DKIM-Signature:Message-ID:Date:To:From:Subject:MIME-Version; b=wSNQOfIaRdvtYvGcGzjhJfEocoMmYVzbabJRksYmH37zed1qlbgvGCp7VY4DX8bRxu/S3fR+xmRztalYQ8Nt+9ZE+bX4DJ37SWELSA5O0qKbVH3pT9JmYmc5y+RtNIdMW9HwF/W/HwIweKHHyDoE2r1PhGxDbQaCZl0ow7/dqaU= ARC-Authentication-Results: i=2; server2.sourceware.org ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=IensyTxmSccr+Iph9kLRG25binE7xtVEHl5X4tT9vh1xV3OYi4KdoKpluwdSPKZj59FwF1BB/IYDwLNB9VChA9YvzLKVrfOcXApMGhXkyypRUXfjXF+U1cuaw3vMXl66kr+V9VgL+yB5I2NUxK9riW1s8wwgwadpQvbe/xukFBpFnOttmkFayzLh/vx88XnNi1AQXNUKUVdx6t40zr2LUIFJRPJ8KuJJQ7ffsDM995yPp+TQ0uKUwDA1K61Pim1v02LJ/Y35nsmcrCEM1k0dW24n7OBqy4jrx2JvWtt6bAfyUDuu3t2oiGEWrGvU/CKznsGW1vJkWbpUH28Z4sOojw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=TXhdnkj7bVr43biZ7LKKscOYgAJ9XEOZ8eIA4JYTVP4=; b=ZXsGrpOcJ6hBcZNFzQVbBx9i7mkci68VcPjLsOZttMvoMQl3MasPp8UwTp6nYqz22pODwOJIA1UHE5IW8ceLWwFWcPf8hV2GbOny7xDy7jbpdzZGBPntihDPVsb+D8/tKcqXU8F6gjRlbuQrcr2LJvXiZtot4lbgpF3Vla7Ca8yh/999L84wXpegD1A8n2AndY2pd5etlRMt+KR/n1mrEZDY9Ksl6lyhnDO0oBJT2kR0VnGmBuovPgBnQg1JGeszS5FXrobYYI+NGj4CmBSBQIhkRbFUlZwc9jPjAjzbQuDUDlC6a4v3+6n63auwFc7zPldXgE1+GXTuXVWNVY4Wfw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=HOTMAIL.DE; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=TXhdnkj7bVr43biZ7LKKscOYgAJ9XEOZ8eIA4JYTVP4=; b=enHBxx/kVc5OeMTvm8M5J9XeURQtBN+EMqD0wvo/SHrrTPEps2qkKosEfMvYD5PM38CJkedA+w4q8msSLABOdGyaLDupX5mkUzdl5VxaIWjhckFcrCfc/9ABNJXcSggkk2KidB9/IiVn9WtDXx9ZpPvA5+2+LWG2caJrDTD6Dm47yQ14Go7tMFmSl4mO2Za+iMnDUR+eL0ECL/3uEdws+cwYfOJ6sNyhQ8mPJYH6KqRgHxymh+2xWKvhZ0MDk1f1XzOS0B48K56yXU39URs0Zbqdu8d2COe3ZsmCOeHpZO/2y/gMl+kIEeTQ0g5cp679Yci0j15MBR5oXfSFIezOOQ== Received: from PAXPR01MB9459.eurprd01.prod.exchangelabs.com (2603:10a6:102:2c2::7) by AM8PR01MB7714.eurprd01.prod.exchangelabs.com (2603:10a6:20b:237::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7875.21; Mon, 19 Aug 2024 18:28:10 +0000 Received: from PAXPR01MB9459.eurprd01.prod.exchangelabs.com ([fe80::10ec:d5e4:557:95ca]) by PAXPR01MB9459.eurprd01.prod.exchangelabs.com ([fe80::10ec:d5e4:557:95ca%3]) with mapi id 15.20.7875.019; Mon, 19 Aug 2024 18:28:10 +0000 Message-ID: Date: Mon, 19 Aug 2024 20:28:10 +0200 User-Agent: Mozilla Thunderbird Content-Language: en-US To: gcc-patches From: Bernd Edlinger Subject: [PATCH v2] RISC-V: Enable -gvariable-location-views by default X-TMN: [Xt7p0c+4frNLlcygtgwPZ9tUGWt2kJaSDW0qm9h3aFGB198pOqDL3XZ3udxvsu/5] X-ClientProxiedBy: BE1P281CA0267.DEUP281.PROD.OUTLOOK.COM (2603:10a6:b10:86::11) To PAXPR01MB9459.eurprd01.prod.exchangelabs.com (2603:10a6:102:2c2::7) X-Microsoft-Original-Message-ID: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR01MB9459:EE_|AM8PR01MB7714:EE_ X-MS-Office365-Filtering-Correlation-Id: 820308ad-123c-4e67-e3b1-08dcc07cad94 X-Microsoft-Antispam: BCL:0; ARA:14566002|19110799003|15080799003|5072599009|8060799006|461199028|440099028|3412199025; X-Microsoft-Antispam-Message-Info: N++onJXIqpUss0aipZcNk1FArrIBiZ9VRdQh5d9w0s2GvcYUq+ZvAkUSr4VKOJlZHQhdX/IJNCpIC7t7e5rXAc7Z81kI7Nur9zHjOKxJ7c/FRfgA5T8HyPHcyrFoz6EEykjeZzh8X3HqxpUo8XBXb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JIxWpfI1uqIDk/fn7bl0mBgXMhAO/Y2dhRIzJGPHXq51dT?= =?utf-8?q?OuRbUztetpLaCax/?= X-OriginatorOrg: sct-15-20-7719-20-msonline-outlook-ba98d.templateTenant X-MS-Exchange-CrossTenant-Network-Message-Id: 820308ad-123c-4e67-e3b1-08dcc07cad94 X-MS-Exchange-CrossTenant-AuthSource: PAXPR01MB9459.eurprd01.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Aug 2024 18:28:10.2800 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR01MB7714 X-Spam-Status: No, score=-12.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org This affects only the RISC-V targets, where the compiler options -gvariable-location-views and consequently also -ginline-points are disabled by default, which is unexpected and disables some useful features of the generated debug info. Due to a bug in the gas assembler the .loc statement is not usable to generate location view debug info. That is detected by configure: configure:31500: checking assembler for dwarf2 debug_view support configure:31509: .../riscv-unknown-elf/bin/as -o conftest.o conftest.s >&5 conftest.s: Assembler messages: conftest.s:5: Error: .uleb128 only supports constant or subtract expressions conftest.s:6: Error: .uleb128 only supports constant or subtract expressions configure:31512: $? = 1 configure: failed program was .file 1 "conftest.s" .loc 1 3 0 view .LVU1 nop .data .uleb128 .LVU1 .uleb128 .LVU1 configure:31523: result: no This results in dwarf2out_as_locview_support being set to false, and that creates a sequence of events, with the end result that most inlined functions either have no DW_AT_entry_pc, or one with a wrong entry pc value. But the location views can also be generated without using any .loc statements, therefore we should enable the option -gvariable-location-views by default, regardless of the status of -gas-locview-support. Note however, that the combination of the following compiler options -g -O2 -gvariable-location-views -gno-as-loc-support turned out to create invalid assembler intermediate files, with lots of assembler errors like: Error: leb128 operand is an undefined symbol: .LVU3 This affects all targets, except RISC-V of course ;-) and is fixed by the changes in dwarf2out.c Finally the .debug_loclists created without assembler locview support did contain location view pairs like v0000000ffffffff v000000000000000 which is the value from FORCE_RESET_NEXT_VIEW, but that is most likely not as expected either, so change that as well. --- gcc/dwarf2out.cc | 16 ++++++++++------ gcc/toplev.cc | 4 +--- 2 files changed, 11 insertions(+), 9 deletions(-) v2: fixed the boot-strap error triggered by v1 on any target, except RISC-V, the issue was triggered by libstdc++-v3/src/c++11/cxx11-ios_failure-lt.s which is generated using -gno-as-loc-support, which triggered a latent issue. diff --git a/gcc/dwarf2out.cc b/gcc/dwarf2out.cc index 346feeb53c8..79f97b5a55e 100644 --- a/gcc/dwarf2out.cc +++ b/gcc/dwarf2out.cc @@ -10374,7 +10374,7 @@ dwarf2out_maybe_output_loclist_view_pair (dw_loc_list_ref curr) #ifdef DW_LLE_view_pair dw2_asm_output_data (1, DW_LLE_view_pair, "DW_LLE_view_pair"); - if (dwarf2out_as_locview_support) + if (dwarf2out_as_locview_support && dwarf2out_as_loc_support) { if (ZERO_VIEW_P (curr->vbegin)) dw2_asm_output_data_uleb128 (0, "Location view begin"); @@ -10396,8 +10396,10 @@ dwarf2out_maybe_output_loclist_view_pair (dw_loc_list_ref curr) } else { - dw2_asm_output_data_uleb128 (curr->vbegin, "Location view begin"); - dw2_asm_output_data_uleb128 (curr->vend, "Location view end"); + dw2_asm_output_data_uleb128 (ZERO_VIEW_P (curr->vbegin) + ? 0 : curr->vbegin, "Location view begin"); + dw2_asm_output_data_uleb128 (ZERO_VIEW_P (curr->vend) + ? 0 : curr->vend, "Location view end"); } #endif /* DW_LLE_view_pair */ @@ -10430,7 +10432,7 @@ output_loc_list (dw_loc_list_ref list_head) vcount++; /* ?? dwarf_split_debug_info? */ - if (dwarf2out_as_locview_support) + if (dwarf2out_as_locview_support && dwarf2out_as_loc_support) { char label[MAX_ARTIFICIAL_LABEL_BYTES]; @@ -10460,10 +10462,12 @@ output_loc_list (dw_loc_list_ref list_head) } else { - dw2_asm_output_data_uleb128 (curr->vbegin, + dw2_asm_output_data_uleb128 (ZERO_VIEW_P (curr->vbegin) + ? 0 : curr->vbegin, "View list begin (%s)", list_head->vl_symbol); - dw2_asm_output_data_uleb128 (curr->vend, + dw2_asm_output_data_uleb128 (ZERO_VIEW_P (curr->vend) + ? 0 : curr->vend, "View list end (%s)", list_head->vl_symbol); } diff --git a/gcc/toplev.cc b/gcc/toplev.cc index eee4805b504..292948122de 100644 --- a/gcc/toplev.cc +++ b/gcc/toplev.cc @@ -1475,9 +1475,7 @@ process_options () = (flag_var_tracking && debug_info_level >= DINFO_LEVEL_NORMAL && dwarf_debuginfo_p () - && !dwarf_strict - && dwarf2out_as_loc_support - && dwarf2out_as_locview_support); + && !dwarf_strict); } else if (debug_variable_location_views == -1 && dwarf_version != 5) {