From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id G60NDe7fTGpD5yoAWB0awg (envelope-from ) for ; Tue, 07 Jul 2026 07:15:58 -0400 Received: by simark.ca (Postfix, from userid 112) id 0E7331E070; Tue, 07 Jul 2026 07:15:58 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-5.3 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [IPv6:2620:52:6:3111::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 5EE9D1E070 for ; Tue, 07 Jul 2026 07:15:57 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B32484BA2E14 for ; Tue, 7 Jul 2026 11:15:55 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B32484BA2E14 Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) by sourceware.org (Postfix) with ESMTPS id 8AF644BA2E19 for ; Tue, 7 Jul 2026 11:15:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8AF644BA2E19 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=palves.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 8AF644BA2E19 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=209.85.128.52 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1783422932; cv=none; b=OJhKMyI/Wy5nXRmH6EuCvNsfUtTjrcmXxdZnF9cOxg5bz2krr4IllT5ygqlF5hSCYuNP2xKbAPAoOnHG8ARzZrIPBTWbpgQQ6sP+Olj6Ws6CCkhizaZO73URVaG88u5x/tVeQwgfGdY30k5fcxd4M4HwYjtFRAINq5PYyc2pxZY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1783422932; c=relaxed/simple; bh=wt5AFGW4o70A5eNdzsStUU/LMNXwRF4QPffE+bhkh5w=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=V19GlkitNNj0VyHFHi3p7k3qW7c7bF8xaKkUi5uBCVZ+8Oq14WXDmWjq26w+676T8R8VrFfYRbJUPVlhggl1kQr3Xal/hw9Du8TNhzh1YzkEIstn4dq/PUWoQMIav8QtyF3SvD8vtPgE9cvg3DUhioFEapmfQ38FC3bQJxxrOhQ= ARC-Authentication-Results: i=1; sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8AF644BA2E19 Received: by mail-wm1-f52.google.com with SMTP id 5b1f17b1804b1-493c733f15aso39355285e9.0 for ; Tue, 07 Jul 2026 04:15:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783422931; x=1784027731; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=bERVP1Ihl3fYsiGnF8a9ST3Z+OQ6FjCejqNfVlFCUOo=; b=F+IWe37DRPqeSPxvjWOQ0FivpTS1CnSJgNFK5xFMUY3lnCzedLujD61S70qPrT0h+y Plf2NhZdz0NM9K+XccoYBuviNhJEJcqA/CQyXNBA+6t4S6iCeRhc4MjihSsXxY96jJym uLveViMOb0rVcPb92DC7ZCe68MJIeRBzckZjjRJ+rLNLEs8JoTkr1CG3JOKFfljnw1Lw AJnULhj3Hs44RUvOo9ekBpfTDfimcuYZnghnX2KA8uBbrHsu6ph7ziQsmPw9PsgLncEL 41DY33W7Th6/X8U9B7G/ZQeIxAwu/F0LYlG64jcDOY+SHdHP066OWoSO5e6LLXjWjhl5 XraQ== X-Gm-Message-State: AOJu0YzfLEWTVDBI+9JCt77Rx2phCsFy/XHGD4hNYtqmgYJVWQUh22CI omhYblSPqthmSWzucNrbU9hETBodINeo46PyOFO08KgPlqOw15ClC/21nF53EA== X-Gm-Gg: AfdE7cn/Yj0nja2Oqb23y3i1T4guuCFG0DWxrFwNqBwH3adreqafPqQ9vlfYe5Qab+6 TDec0Y9M56WkRwKA8jTJjks2HuArzZvwcoHP1lSaTP/8xPB8kyaAQ2atImtl4FE22sZ7DZssAXd avw4t+4m1M2TgYyrdD7tbvew8FkVzYVryI/ssSEuiwGf5KMqXNiecdhkKNRS6uN+UILOd9eunSC Ol7h60d5jvBmkvHXn/AWrFGFYry6JL7/mNB5X6yyS76AgXOAij+qx9ph6MOMn1lmiVYHpPOpPou cf0Czs2KmNQXSTiOoQMeMo+ySP1Xaz1djUGSSkcwd4Q7o/9rVVhTsddSlzoVkKk1ua6sAn8x8Is FxQtaasE085sRxRYXicms/zU/UE/uWO4Hoz6yxoGUpES0P2QLG+xp1EqvbHedSpqaHyzbMVUhuX oEKRktm7wndbU= X-Received: by 2002:a05:600c:6096:b0:493:c1a1:68f0 with SMTP id 5b1f17b1804b1-493e0c326f8mr30115105e9.20.1783422931129; Tue, 07 Jul 2026 04:15:31 -0700 (PDT) Received: from localhost ([2001:8a0:fac2:7700:2807:89f6:bf15:ec37]) by smtp.gmail.com with UTF8SMTPSA id 5b1f17b1804b1-493e0f4fc0bsm44576085e9.10.2026.07.07.04.15.30 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 07 Jul 2026 04:15:30 -0700 (PDT) From: Pedro Alves To: gdb-patches@sourceware.org Cc: Lancelot SIX Subject: [PATCH] gdb/hip: Prepare for DWARF-assembler-based HIP testcases Date: Tue, 7 Jul 2026 12:15:27 +0100 Message-ID: <20260707111527.1211730-1-pedro@palves.net> X-Mailer: git-send-email 2.54.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Compiling a testcase with debug info (by passing passing "debug" as gdb_compile option) has the effect of passing -g to the compiler. -g in turn enables an LLVM option that is essential for debugging: '-mllvm -amdgpu-spill-cfi-saved-regs'. That option affects code generation, and some features of the DWARF assembler machinery rely on code generated by the compiler without -g to be the exact same as the code generated with -g. This patch addresses that by always compiling with the LLVM option that -g would enable. Change-Id: I64a938edf97c85d0ea9fc34b37071daa560de7e7 --- gdb/testsuite/lib/gdb.exp | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index a19e8ba6729..a40c87c6727 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -6745,11 +6745,35 @@ proc gdb_compile {source dest type options} { lappend new_options "early_flags=-fno-stack-protector" } - # hipcc defaults to -O2, so add -O0 to early flags for the hip language. - # If "optimize" is also requested, another -O flag (e.g. -O2) will be added - # to the flags, overriding this -O0. if {[lsearch -exact $options hip] != -1} { - lappend new_options "early_flags=-O0" + # The -g option enables an LLVM option that is essential for + # debugging (-mllvm -amdgpu-spill-cfi-saved-regs), but that + # unfortunately also affects code generation. We don't want + # to hardcode -g here though, because some tests want to test + # debugging without debug info, and yet others want to compile + # their binary without debug info or with -gline-info-only, + # and then use the DWARF assembler to generate their own debug + # info. Some features of the DWARF assembler rely on nodebug + # and debug binaries having the exact same generated code, so, + # explicitly compile with the LLVM option that -g would + # enable, and leave adding -g to the testcase, via the "debug" + # option, as normal. + # + # Disable -Wunused-command-line-argument to avoid warnings + # like: + # + # clang: warning: argument unused during compilation: \ + # '-mllvm=-amdgpu-spill-cfi-saved-regs' [-Wunused-command-line-argument] + # + # These happen when we're compiling an executable _and_ all + # the input files are .o files, like: hipcc foo.o -o foo ... + # + # HIPCC defaults to -O2, so add -O0 to early flags for the HIP + # language. If "optimize" is also requested, another -O flag + # (e.g. -O2) will be added to the flags, overriding this -O0. + lappend new_options "early_flags=-O0\ + -mllvm=-amdgpu-spill-cfi-saved-regs\ + -Wno-unused-command-line-argument" } # Because we link with libraries using their basename, we may need base-commit: 57d9dfcf39cd3c2897bb76c2dbd7074f065685df -- 2.54.0