From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id qxtJJbT9zGnoHgIAWB0awg (envelope-from ) for ; Wed, 01 Apr 2026 07:12:52 -0400 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=PYiM6L40; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=mJJFDX3o; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=PYiM6L40; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=mJJFDX3o; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 84D9A1E04F; Wed, 01 Apr 2026 07:12:52 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED, RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [38.145.34.32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id E8A081E04F for ; Wed, 01 Apr 2026 07:12:50 -0400 (EDT) Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id 412C54BA23DF for ; Wed, 1 Apr 2026 11:12:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 412C54BA23DF Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=PYiM6L40; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=mJJFDX3o; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=PYiM6L40; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=mJJFDX3o Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2a07:de40:b251:101:10:150:64:1]) by sourceware.org (Postfix) with ESMTPS id 76EB84BA23CA for ; Wed, 1 Apr 2026 11:12:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 76EB84BA23CA Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 76EB84BA23CA Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a07:de40:b251:101:10:150:64:1 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1775041942; cv=none; b=KnFxatG8ibrCeqz9iUfhB5a68Lpua0f1Ebetl5BY4To8TO5zjIUW2yB5ODQlmSif0MnxgMLdm289Sz1C8zwzz+p+nScNOEgHtHxjGISzXJEG/+4Lnf2q/8sTXKt6/I0y6m1f0Dc2afekLKB0zQCS1/J+1KY12j5Orag6EuoArMs= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1775041942; c=relaxed/simple; bh=sVCD/xFlZxsq8Oh0xMYo+9hwQ49OV1h1IEJcnGPy9/c=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature: Message-ID:Date:MIME-Version:Subject:To:From; b=ckkL+q5K3M1EsMnehtwLDb29wF2Jhcfvc1Oj5pQDMh680G1xz8kTzfOGq3/5E2XDssd21aT2wX/CWp0jUvYLUZKeLZnyWIbqAjoTVVkUsFxCA/oaLPOfEAtpCBitJpcbJRNGvYXunFmjD4MNzp2/HoCFW45V15h8vTUB5d76jLY= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 76EB84BA23CA Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 55C034D2DE; Wed, 1 Apr 2026 11:12:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1775041940; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4TRbb3VAV4jGm6xtXx5fikCGBI7IOZyTsuohvzvdU7M=; b=PYiM6L40Sq4QrQtcmsHo4KPYc9k/9VgRRzqznLadeBCCBfaMJ+nfTJwc9DAQVcTlfT4QaG b9K9r98kftk6WbV22FP4FKqHZJtv7n7RJikcw03BkH9jkMPi6zjrQG+meb8IouHwzpDCW7 selQbg6EhGIIiyJ308HEROAkUgsZk8k= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1775041940; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4TRbb3VAV4jGm6xtXx5fikCGBI7IOZyTsuohvzvdU7M=; b=mJJFDX3oSQ84rylInOPMw4z18uiX4wasDg2Pb1gkV4S4PgPv8ngIFpP/RrwJXN/63wevbo TuwrI5RE3iGqPBAw== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=PYiM6L40; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=mJJFDX3o DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1775041940; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4TRbb3VAV4jGm6xtXx5fikCGBI7IOZyTsuohvzvdU7M=; b=PYiM6L40Sq4QrQtcmsHo4KPYc9k/9VgRRzqznLadeBCCBfaMJ+nfTJwc9DAQVcTlfT4QaG b9K9r98kftk6WbV22FP4FKqHZJtv7n7RJikcw03BkH9jkMPi6zjrQG+meb8IouHwzpDCW7 selQbg6EhGIIiyJ308HEROAkUgsZk8k= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1775041940; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4TRbb3VAV4jGm6xtXx5fikCGBI7IOZyTsuohvzvdU7M=; b=mJJFDX3oSQ84rylInOPMw4z18uiX4wasDg2Pb1gkV4S4PgPv8ngIFpP/RrwJXN/63wevbo TuwrI5RE3iGqPBAw== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 3A3DF4A0B0; Wed, 1 Apr 2026 11:12:20 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id PLDaDJT9zGnzMwAAD6G6ig (envelope-from ); Wed, 01 Apr 2026 11:12:20 +0000 Message-ID: <82b0b090-0f2e-4abc-9e74-6d4ce3d242f4@suse.de> Date: Wed, 1 Apr 2026 13:12:19 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] testsuite: ada-valprint-error relocation issue To: Bratislav Filipovic , gdb-patches@sourceware.org Cc: simon.marchi@efficios.com References: <662d00dd-c026-4af1-a293-b0247f22fae5@suse.de> <20260401103340.4011522-1-bfilipov@amd.com> Content-Language: en-US From: Tom de Vries In-Reply-To: <20260401103340.4011522-1-bfilipov@amd.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spamd-Result: default: False [-4.51 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_HAS_DN(0.00)[]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; ARC_NA(0.00)[]; FUZZY_RATELIMITED(0.00)[rspamd.com]; TO_DN_SOME(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_TLS_ALL(0.00)[]; DKIM_TRACE(0.00)[suse.de:+]; RCVD_COUNT_TWO(0.00)[2]; FROM_EQ_ENVFROM(0.00)[]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; MID_RHS_MATCH_FROM(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; RCPT_COUNT_THREE(0.00)[3]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:dkim, suse.de:mid, imap1.dmz-prg2.suse.org:helo, imap1.dmz-prg2.suse.org:rdns] X-Rspamd-Action: no action X-Rspamd-Server: rspamd1.dmz-prg2.suse.org X-Rspamd-Queue-Id: 55C034D2DE X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org 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 ^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" \