Message ID | 20241016030243.31320-1-tdevries@suse.de |
---|---|
State | Committed |
Headers |
Return-Path: <gdb-patches-bounces~patchwork=sourceware.org@sourceware.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A9E2C3858D28 for <patchwork@sourceware.org>; Wed, 16 Oct 2024 03:03:04 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2a07:de40:b251:101:10:150:64:2]) by sourceware.org (Postfix) with ESMTPS id 34A7A3858D20 for <gdb-patches@sourceware.org>; Wed, 16 Oct 2024 03:02:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 34A7A3858D20 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 34A7A3858D20 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a07:de40:b251:101:10:150:64:2 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1729047753; cv=none; b=Qgc6ad+NdfHmD0ejzpSNNtjTwLdvf14RoRK2/IpyRxC/BrhH/kkUEuJfph3tl+ipMVSFQMUUzRK0aKxBhZDPvpE3IgChQ020qaBjKlC1tj7hSbrUo+Rm6qHRiK2Bx4DIjy5zJf2S7T316codOwSLpp002ZRb/OgAZwful7eQncY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1729047753; c=relaxed/simple; bh=gxdxNpTDVaZt6kuZGgZXSBjfSSX4bTIM3jqKkfOD2fQ=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature:From: To:Subject:Date:Message-Id:MIME-Version; b=Gztsl1saFRnMEQsKu69g21Kn6KMvdWOptUOjU28METgLAMvgTR/EqBHAr+4chM32H/q/AMM62edKDeYptgZ7dTiF9PzshA54ktSSfq1JhCEfhR+1eQj/71eBvBrMA2pcWrTV6id12sSIIYazg+8RgCltt9d6/VgzovGPVhgx0DI= ARC-Authentication-Results: i=1; server2.sourceware.org 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-out2.suse.de (Postfix) with ESMTPS id 72F281FE82 for <gdb-patches@sourceware.org>; Wed, 16 Oct 2024 03:02:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1729047748; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=azwMfKjKT10w0cirwY+cir8ow6RMOHiRCHoZm/EeWS4=; b=Z+lhXvKBClhdE3b+R1minG+xl0nDqxUISgjC2p1L5K0OxBwBXtWEV2H8ik6uCqd8PIz8mu AKsAnWPDCG+WhDSUzSA0SrJEc+S+H+1gP5ECBzl/RXmV4ohWZir0hi/XQal3P4fNQwOJQ/ X7iLRChu4H4GepDXo5tq/MhIsmHh4To= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1729047748; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=azwMfKjKT10w0cirwY+cir8ow6RMOHiRCHoZm/EeWS4=; b=ttXy8WCwDbfDT03Li8r/D5FsB5MeBd1jGQPgnepjDI7djSpgYqrxOUYc5ljlaZV5UDxwhU fxpolNnkrNPkpPBw== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=Z+lhXvKB; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=ttXy8WCw DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1729047748; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=azwMfKjKT10w0cirwY+cir8ow6RMOHiRCHoZm/EeWS4=; b=Z+lhXvKBClhdE3b+R1minG+xl0nDqxUISgjC2p1L5K0OxBwBXtWEV2H8ik6uCqd8PIz8mu AKsAnWPDCG+WhDSUzSA0SrJEc+S+H+1gP5ECBzl/RXmV4ohWZir0hi/XQal3P4fNQwOJQ/ X7iLRChu4H4GepDXo5tq/MhIsmHh4To= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1729047748; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=azwMfKjKT10w0cirwY+cir8ow6RMOHiRCHoZm/EeWS4=; b=ttXy8WCwDbfDT03Li8r/D5FsB5MeBd1jGQPgnepjDI7djSpgYqrxOUYc5ljlaZV5UDxwhU fxpolNnkrNPkpPBw== 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 5D39B1388C for <gdb-patches@sourceware.org>; Wed, 16 Oct 2024 03:02:28 +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 CV9YFcQsD2fKTgAAD6G6ig (envelope-from <tdevries@suse.de>) for <gdb-patches@sourceware.org>; Wed, 16 Oct 2024 03:02:28 +0000 From: Tom de Vries <tdevries@suse.de> To: gdb-patches@sourceware.org Subject: [PATCH] [gdb/build] Use -fno-hoist-adjacent-loads for gcc <= 13 Date: Wed, 16 Oct 2024 05:02:43 +0200 Message-Id: <20241016030243.31320-1-tdevries@suse.de> X-Mailer: git-send-email 2.35.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 72F281FE82 X-Spam-Score: -3.01 X-Rspamd-Action: no action X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[99.99%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; 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)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; ASN(0.00)[asn:25478, ipnet:::/0, country:RU]; MIME_TRACE(0.00)[0:+]; FROM_HAS_DN(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[gdb-patches@sourceware.org]; RCVD_TLS_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:mid,suse.de:dkim]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FUZZY_BLOCKED(0.00)[rspamd.com]; TO_DN_NONE(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; RCPT_COUNT_ONE(0.00)[1]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Server: rspamd1.dmz-prg2.suse.org X-Spam-Level: X-Spam-Status: No, score=-12.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_NUMSUBJECT, KAM_SHORT, SPF_HELO_NONE, SPF_PASS, TXREP 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: 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 |
[gdb/build] Use -fno-hoist-adjacent-loads for gcc <= 13
|
|
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-aarch64 | success | Test passed |
linaro-tcwg-bot/tcwg_gdb_check--master-arm | success | Test passed |
Commit Message
Tom de Vries
Oct. 16, 2024, 3:02 a.m. UTC
When building gdb with gcc 12 and -fsanitize=threads while renabling
background dwarf reading by setting dwarf_synchronous to false, I run into:
...
(gdb) file amd64-watchpoint-downgrade
Reading symbols from amd64-watchpoint-downgrade...
(gdb) watch global_var
==================
WARNING: ThreadSanitizer: data race (pid=20124)
Read of size 8 at 0x7b80000500d8 by main thread:
#0 cooked_index_entry::full_name(obstack*, bool) const cooked-index.c:220
#1 cooked_index::get_main_name(obstack*, language*) const cooked-index.c:735
#2 cooked_index_worker::wait(cooked_state, bool) cooked-index.c:559
#3 cooked_index::wait(cooked_state, bool) cooked-index.c:631
#4 cooked_index_functions::wait(objfile*, bool) cooked-index.h:729
#5 cooked_index_functions::compute_main_name(objfile*) cooked-index.h:806
#6 objfile::compute_main_name() symfile-debug.c:461
#7 find_main_name symtab.c:6503
#8 main_language() symtab.c:6608
#9 set_initial_language_callback symfile.c:1634
#10 get_current_language() language.c:96
...
Previous write of size 8 at 0x7b80000500d8 by thread T1:
#0 cooked_index_shard::finalize(parent_map_map const*) \
dwarf2/cooked-index.c:409
#1 operator() cooked-index.c:663
...
...
SUMMARY: ThreadSanitizer: data race cooked-index.c:220 in \
cooked_index_entry::full_name(obstack*, bool) const
==================
Hardware watchpoint 1: global_var
(gdb) PASS: gdb.arch/amd64-watchpoint-downgrade.exp: watch global_var
...
This was also reported in PR31715.
This is due do gcc PR110799 [1], generating wrong code with
-fhoist-adjacent-loads, and causing a false positive for
-fsanitize=threads.
Work around the gcc PR by forcing -fno-hoist-adjacent-loads for gcc <= 13
and -fsanitize=threads.
Tested in that same configuration on x86_64-linux. Remaining ThreadSanitizer
problems are the ones reported in PR31626 (gdb.rust/dwindex.exp) and
PR32247 (gdb.trace/basic-libipa.exp).
PR gdb/31715
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31715
Tested-By: Bernd Edlinger <bernd.edlinger@hotmail.de>
[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110799
---
gdbsupport/common-defs.h | 7 +++++++
1 file changed, 7 insertions(+)
base-commit: a104f0a3e62031d2a5aabfe9e82f55158647f444
Comments
>>>>> "Tom" == Tom de Vries <tdevries@suse.de> writes:
Tom> Work around the gcc PR by forcing -fno-hoist-adjacent-loads for gcc <= 13
Tom> and -fsanitize=threads.
Tom> Tested in that same configuration on x86_64-linux. Remaining ThreadSanitizer
Tom> problems are the ones reported in PR31626 (gdb.rust/dwindex.exp) and
Tom> PR32247 (gdb.trace/basic-libipa.exp).
Thank you.
I didn't mention it in the bug, but I do have mild misgivings about
this, since having compiler flags set in the source is obscure and can
cause some real head scratching. However, it seems nice to have tsan
work automatically and it's limited to certain GCC versions as well.
Approved-By: Tom Tromey <tom@tromey.com>
Tom
On 10/17/24 21:36, Tom Tromey wrote: >>>>>> "Tom" == Tom de Vries <tdevries@suse.de> writes: > > Tom> Work around the gcc PR by forcing -fno-hoist-adjacent-loads for gcc <= 13 > Tom> and -fsanitize=threads. > > Tom> Tested in that same configuration on x86_64-linux. Remaining ThreadSanitizer > Tom> problems are the ones reported in PR31626 (gdb.rust/dwindex.exp) and > Tom> PR32247 (gdb.trace/basic-libipa.exp). > > Thank you. > > I didn't mention it in the bug, but I do have mild misgivings about > this, since having compiler flags set in the source is obscure and can > cause some real head scratching. However, it seems nice to have tsan > work automatically and it's limited to certain GCC versions as well. > Yeah, it's not pretty, but it's meant to prevent gdb developers from running into the same problem again, reporting it and spending time analyzing it. Thanks for the review, pushed. - Tom > Approved-By: Tom Tromey <tom@tromey.com>
diff --git a/gdbsupport/common-defs.h b/gdbsupport/common-defs.h index 6120719480b..d246a84bf75 100644 --- a/gdbsupport/common-defs.h +++ b/gdbsupport/common-defs.h @@ -20,6 +20,13 @@ #ifndef COMMON_COMMON_DEFS_H #define COMMON_COMMON_DEFS_H +#if defined (__SANITIZE_THREAD__) && defined (__GNUC__) \ + && !defined (__clang__) && __GNUC__ <= 13 + +/* Work around PR gcc/110799. */ +#pragma GCC optimize("-fno-hoist-adjacent-loads") +#endif + #include <gdbsupport/config.h> #undef PACKAGE_NAME