| Message ID | 20260401103340.4011522-1-bfilipov@amd.com |
|---|---|
| State | New |
| Headers |
Return-Path: <gdb-patches-bounces~patchwork=sourceware.org@sourceware.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id 8A5F04BA2E24 for <patchwork@sourceware.org>; Wed, 1 Apr 2026 10:34:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8A5F04BA2E24 Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=pEmD0w4F X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from CY3PR05CU001.outbound.protection.outlook.com (mail-westcentralusazlp170130007.outbound.protection.outlook.com [IPv6:2a01:111:f403:c112::7]) by sourceware.org (Postfix) with ESMTPS id 4AD344BA23F7 for <gdb-patches@sourceware.org>; Wed, 1 Apr 2026 10:34:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4AD344BA23F7 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=amd.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 4AD344BA23F7 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=2a01:111:f403:c112::7 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1775039645; cv=pass; b=eLidxqSZcDANHlersoLFDeeTrTxk7UKB80B1f7X9UK1KM42gLkZJVgDPGRuY6leAWmkF9ustT0R3tRay+pzbPpVWa1qx7YYx4JpG6nHbGdCbu3r6NVYBIolTE1rAgD+ax5R45ogLGkS6oRewQPmTSWsPpSNs51YtQT+W67tBDeY= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1775039645; c=relaxed/simple; bh=L2znF+EzXPM4XfwOJ/WoMmdZRFWilPJOgmzTeINqxCY=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=GQkSiK4dMd3+J7phDom/T9A51kuwMZnHyEn+Y2C+R9tlpx6HGyvuNU8Qn47ut6hUZbd+eeWtji7oDhsaM7LPMjdnjFuwhelab2iiIpfHfGXYH+ePC6qJvUu0LJsH+5CaGM/v4jZEAKmpm5ugcCEzrB6UaMUYiuDc/gF1H7uWHgI= ARC-Authentication-Results: i=2; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4AD344BA23F7 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=fgqVu9buRjEmct9dkcvlmLSqrtKYa2fvN9JZaRQu7m2K/f5oqvzcAt0+rCkAzGn0OOklUCGL0J1wuEJyjjyQp2XOvnc9DHiz6gE7aqEbo5vaXOK/mmsGxWm80J1NFSD0Jzthb7Cr5+bEKSi1y9JigB1ywhEl3gxPey70X7mtDiaMZG9GlWuS80C3wjaWB7LvUJnj2Hbj4jc0BZGpIkEPHbXT/11OwW5ZlB8F2oFX0+hbyjhR69rdOZofjwXkVRhM1xgWU5l5tNFJy7GO1x3IrLk/B7eq1lbicG5+/oTIW+/ZFw/KLs4E03VRdLh+qja6U+fSaFfILWPjtDgPtTlbIg== 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=BXjzvH928JVmF+IXm+EptiHp0BUlGIcP3ybwfxFlXsg=; b=wOUFeGWJZUBjgCdfQuW/ozrzoyT2F13fcTGRpjs48e4PRFid1L80XYUbUmpCMZwTGkCGcBlgIAD0IkEw6/5Y09VsN5KfmFEMAxxf4AnWkJWTHovPrH54x3Ug6EOdceLSd7AfJTMTlD0y5qcYxRCF2gmWmhGwb5FvFNi8t4F1q5cKM4OUmQw0X9hhmyEra4WU0QGvLSvuQRfxBgDr4hO/5JgVz8BNT3kVAaOVA26lEBanfy6GGLOVmj3qZ2M8v7W8hu2ba2v4IkoXospjYFNYelIGjXckD79dlReLpCM/6V7YldwIGK2+u36jQQhY/EOhsaJ/xPoaAI2fL3X8eEgO1w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=sourceware.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=BXjzvH928JVmF+IXm+EptiHp0BUlGIcP3ybwfxFlXsg=; b=pEmD0w4F6M0xpix5nImX2Ql01GiGd0WwLd03FCGX//KF0S0fRFohcJlgBOzjkkiR3levCtwBGaGPGuEcOKaHBQLjOd/rxxmtbqyXeyIlCKOoBu7hWSpvXLxibf2rciQYVjQnmIWULqvopJga1Gk8LgoO+ToXyKerRkFkf6GD5E4= Received: from MN2PR03CA0014.namprd03.prod.outlook.com (2603:10b6:208:23a::19) by MN6PR12MB8489.namprd12.prod.outlook.com (2603:10b6:208:474::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9769.17; Wed, 1 Apr 2026 10:33:56 +0000 Received: from MN1PEPF0000ECDA.namprd02.prod.outlook.com (2603:10b6:208:23a:cafe::6) by MN2PR03CA0014.outlook.office365.com (2603:10b6:208:23a::19) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9745.30 via Frontend Transport; Wed, 1 Apr 2026 10:33:56 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=satlexmb07.amd.com; pr=C Received: from satlexmb07.amd.com (165.204.84.17) by MN1PEPF0000ECDA.mail.protection.outlook.com (10.167.242.134) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9769.17 via Frontend Transport; Wed, 1 Apr 2026 10:33:56 +0000 Received: from rocm-BirmanPlus-KRK2e.amd.com (10.180.168.240) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.17; Wed, 1 Apr 2026 05:33:54 -0500 From: Bratislav Filipovic <bfilipov@amd.com> To: <gdb-patches@sourceware.org>, <tdevries@suse.de> CC: <simon.marchi@efficios.com>, Bratislav Filipovic <bfilipov@amd.com> Subject: [PATCH] testsuite: ada-valprint-error relocation issue Date: Wed, 1 Apr 2026 16:03:10 +0530 Message-ID: <20260401103340.4011522-1-bfilipov@amd.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <662d00dd-c026-4af1-a293-b0247f22fae5@suse.de> References: <662d00dd-c026-4af1-a293-b0247f22fae5@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: satlexmb07.amd.com (10.181.42.216) To satlexmb07.amd.com (10.181.42.216) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN1PEPF0000ECDA:EE_|MN6PR12MB8489:EE_ X-MS-Office365-Filtering-Correlation-Id: ca13a03a-a0fa-4437-55f4-08de8fda2dc7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|376014|36860700016|82310400026|22082099003|18002099003|56012099003; X-Microsoft-Antispam-Message-Info: 8afFoy3fj90xvSKkDV5t3zd93+115oyky++5JeZE2qc0+WP/UIDFp/xT9QI0vr0klmvKV6CMquqYfMlb2kbFleNa6Fk5zLRfN4A2vcvfVYDHvkXqNEe24bESNUVQdwul9GMH3CQmX+nlVcVdKFRUZm1wJDqrEwVDYOXNNSIb+owsJxwDPZSpnJ8KnrhdUZowsgDGoS4Q1R8GKrh+anu8+W2vdW2OHszmLy+9WTf67XUBiab4gdsQj8o0P560s9AZR0VFmtLjj/4wRXeGoUBU2rbOxzgESLwQy9o/c69X/rnP7kMe7N1w4Cx58QvXjHm2ytdNYEpH4DuxMfKpuBVjfAF6CjZSdzIa87BbdUn9Xo6KC1jxHBaZnV3L64JwcnyfHsX2qf4FbMUG3UtL2pqgnTxJ55rBmgZBuaSpF98cIrvjiU5RCLpdGhOg2IXwPuRlfRKhxc5CYXfATGQA6ihxwgsOQIvBKYIF0D2Lt4Meyo/Kj90hrcdP8rTFfqXRvj9TA3EsLZTKbmErOuE2EziPWJXuKAFQA5MB92cxrmzbghkU7h7EpcOB+DsomlF3LrjlruSzk5WmkrmqYa/MJsDgmwt0AO+XLBrj+L80zt+V0kLGpLnrQhl/L1e+Lgc+oW12vQukSNHsYBNIASQfT8bfbsGZZP1l9TFHUGRcix2EmpfGD7YSM+QoKVHvZiIH18Tmshvv8mg+Nklt3tjYuZsedq6Mzjm6Euu/j0DvD3Moh7joD11hCmB0C1ZUCUOql280CHAZ5wT/bR8xZyCkmUTVnA== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:satlexmb07.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(1800799024)(376014)(36860700016)(82310400026)(22082099003)(18002099003)(56012099003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Zu+cMP9dCJ/K9VhWbpCUrD1Ws6VptS3S1yIJYgaX0dpJuX9ebKD4fAVsFmhvQ7eHjUW2f86Ym9uxIp835cAdgX4vJvJvssqZ8WxtKjfbeXIcnzMn9PArYXb31zfF3bTK9LrwnakXZFhMkV/Mf/QaJWi30fNFpUd/aMNujFxZZKCRqoXJG6qNxWGZToBK4HbTeDGoEj4z/Hjx0modAL5av9Jt/qhMD/7pEGbLHsLxGeDWzIiM94CXYdYhq4bHvwHd2tM/cstxt0n5NXeLh9h12p5i6jFHQ+qukmXKYnnedBugnl6jWZDJAvUIBGBo1lVfRhGCjD/SOu+7lpKuFg/zawzGIajevC0u1UNJBmn/+XN/5u0/Z8Dr3RacesPvQxttpTFfSdWBjca+XaKLbleL9scInqMLA8phH5V3QQNmAmjNY3+XYOZVHxIeo0CyC/RH X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Apr 2026 10:33:56.6427 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ca13a03a-a0fa-4437-55f4-08de8fda2dc7 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[satlexmb07.amd.com] X-MS-Exchange-CrossTenant-AuthSource: MN1PEPF0000ECDA.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN6PR12MB8489 X-Spam-Status: No, score=-9.4 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FORGED_SPF_HELO, GIT_PATCH_0, LOCAL_AUTHENTICATION_FAIL_SPF, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list <gdb-patches.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/gdb-patches>, <mailto:gdb-patches-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/gdb-patches/> List-Post: <mailto:gdb-patches@sourceware.org> List-Help: <mailto:gdb-patches-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/gdb-patches>, <mailto:gdb-patches-request@sourceware.org?subject=subscribe> Errors-To: gdb-patches-bounces~patchwork=sourceware.org@sourceware.org |
| Series |
testsuite: ada-valprint-error relocation issue
|
|
Checks
| Context | Check | Description |
|---|---|---|
| linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 | success | Build passed |
| linaro-tcwg-bot/tcwg_gdb_build--master-arm | success | Build passed |
| linaro-tcwg-bot/tcwg_gdb_check--master-arm | fail | Test failed |
| linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 | fail | Test failed |
Commit Message
Bratislav Filipovic
April 1, 2026, 10:33 a.m. UTC
The ada-valprint-error.exp test links a nodebug .o file with a separate DWARF .o file generated by lib/dwarf.exp. This requires the linker to apply relocations for initialized pointers in the .data section. Some clang + linker combinations fail to apply these relocations, leaving fd__global as NULL instead of pointing to buffer. This causes the test to print null instead of the expected error message. Binary evidence from .comment section confirms which compiler and linker were used. Testing shows: - GCC 13 + GNU ld 2.42: PASS - clang 20 + GNU ld 2.42: FAIL - clang 22 + ld.lld 22: FAIL - clang 17/19 + GNU ld 2.45.0: PASS The failure is a linker limitation when handling this specific relocation pattern, not a GDB bug. Document this in the test file to help users understand why the test may fail with certain toolchains. --- Thanks for review Tom. I changed it per your suggestions. It seems to fail only for some combinations of clang + linker. gdb/testsuite/gdb.dwarf2/ada-valprint-error.exp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
Comments
On 4/1/26 12:33 PM, Bratislav Filipovic wrote: > The ada-valprint-error.exp test links a nodebug .o file with a separate > DWARF .o file generated by lib/dwarf.exp. This requires the linker to > apply relocations for initialized pointers in the .data section. > > Some clang + linker combinations fail to apply these relocations, > leaving fd__global as NULL instead of pointing to buffer. This causes > the test to print null instead of the expected error message. > > Binary evidence from .comment section confirms which compiler and > linker were used. Testing shows: > - GCC 13 + GNU ld 2.42: PASS > - clang 20 + GNU ld 2.42: FAIL > - clang 22 + ld.lld 22: FAIL > - clang 17/19 + GNU ld 2.45.0: PASS > > The failure is a linker limitation when handling this specific > relocation pattern, not a GDB bug. Document this in the test file > to help users understand why the test may fail with certain toolchains. > --- > Thanks for review Tom. I changed it per your suggestions. It seems to > fail only for some combinations of clang + linker. > Hi, thanks for the update, I have a few comments. First of all, the commit needs whitespace fixes, as mentioned by the pre-commit check: ... $ pre-commit run --all-files check-whitespace check-whitespace.........................................................Failed - hook id: check-whitespace - exit code: 2 gdb/testsuite/gdb.dwarf2/ada-valprint-error.exp:119: indent with spaces. + unsupported "linker failed to apply relocation for fd__global" gdb/testsuite/gdb.dwarf2/ada-valprint-error.exp:120: indent with spaces. + return gdb/testsuite/gdb.dwarf2/ada-valprint-error.exp:123: indent with spaces. + pass $gdb_test_name $ ... [ Consider installing pre-commit on your system (to be able to run it manually), and also installing pre-commit hooks in your git repo (to let git run it automatically). ] > gdb/testsuite/gdb.dwarf2/ada-valprint-error.exp | 17 +++++++++++++++++ > 1 file changed, 17 insertions(+) > > diff --git a/gdb/testsuite/gdb.dwarf2/ada-valprint-error.exp b/gdb/testsuite/gdb.dwarf2/ada-valprint-error.exp > index f3d61e91..b72682f7 100644 > --- a/gdb/testsuite/gdb.dwarf2/ada-valprint-error.exp > +++ b/gdb/testsuite/gdb.dwarf2/ada-valprint-error.exp > @@ -107,6 +107,23 @@ if { [prepare_for_testing ${testfile}.exp ${testfile} \ > return -1 > } > > +# Note: This test may fail with certain clang + linker combinations > +# Specifically, clang + ld.lld can fail to apply relocations when linking > +# nodebug .o with separate DWARF .o, leaving fd__global as NULL instead > +# of pointing to buffer. The failure is a linker limitation, not a GDB bug. > +# > +# Known to fail: clang 20/22 + GNU ld 2.42, clang 22 + ld.lld 22 > +# Known to pass: GCC + GNU ld, clang 17/19 + GNU ld 2.45.0 > +gdb_test_multiple "print /x fd__global" "check fd__global value" { > + -re -wrap "@0x0: 0x0" { > + unsupported "linker failed to apply relocation for fd__global" > + return > + } FWIW, I usually try to keep non-local Tcl control flow (like return or break/continue not contained in a local loop) out of the regexp clauses. I think this may have been necessary at some point, so I got in the habit of doing so. I'm not sure if that's still necessary, but I still think it's a somewhat cleaner style. The pattern I use instead is: ... set unsupported 0 gdb_test_multiple ... { -re -wrap ... { set unsupported 1 } ... } if {$unsupported} { unsupported "linker failed to apply relocation for fd__global" return } ... Anyway, it's not necessary to change this. > + -re -wrap "= $hex" { > + pass $gdb_test_name > + } > +} > + I applied the patch, ran the test-case, and ran into: ... (gdb) print /x fd__global^M $1 = (fd__ints_doubled &) @0x404020: 0x404020 <buffer>^M (gdb) FAIL: gdb.dwarf2/ada-valprint-error.exp: check fd__global value ... The regexp doesn't match. This can easily be fixed by simply using: ... -re -wrap "" { pass $gdb_test_name } ... Thanks, - Tom > gdb_test_no_output "set language ada" > > gdb_test "print fd.global" \
diff --git a/gdb/testsuite/gdb.dwarf2/ada-valprint-error.exp b/gdb/testsuite/gdb.dwarf2/ada-valprint-error.exp index f3d61e91..b72682f7 100644 --- a/gdb/testsuite/gdb.dwarf2/ada-valprint-error.exp +++ b/gdb/testsuite/gdb.dwarf2/ada-valprint-error.exp @@ -107,6 +107,23 @@ if { [prepare_for_testing ${testfile}.exp ${testfile} \ return -1 } +# Note: This test may fail with certain clang + linker combinations +# Specifically, clang + ld.lld can fail to apply relocations when linking +# nodebug .o with separate DWARF .o, leaving fd__global as NULL instead +# of pointing to buffer. The failure is a linker limitation, not a GDB bug. +# +# Known to fail: clang 20/22 + GNU ld 2.42, clang 22 + ld.lld 22 +# Known to pass: GCC + GNU ld, clang 17/19 + GNU ld 2.45.0 +gdb_test_multiple "print /x fd__global" "check fd__global value" { + -re -wrap "@0x0: 0x0" { + unsupported "linker failed to apply relocation for fd__global" + return + } + -re -wrap "= $hex" { + pass $gdb_test_name + } +} + gdb_test_no_output "set language ada" gdb_test "print fd.global" \