From: Thomas Schwinge <tschwinge@baylibre.com>
To: Alexandre Oliva <oliva@adacore.com>, gcc-patches@gcc.gnu.org
Cc: Tom de Vries <tdevries@suse.de>
Subject: nvptx: Add '__builtin_stack_address()' test case (was: Causes to nvptx bootstrap fail: [PATCH v5] Introduce strub: machine-independent stack scrubbing)
Date: Fri, 10 Jan 2025 11:35:49 +0100 [thread overview]
Message-ID: <87tta77y7u.fsf@euler.schwinge.ddns.net> (raw)
In-Reply-To: <ory1e7c75i.fsf@lxoliva.fsfla.org>
[-- Attachment #1: Type: text/plain, Size: 1390 bytes --]
Hi!
On 2023-12-06T19:12:25-0300, Alexandre Oliva <oliva@adacore.com> wrote:
> On Dec 6, 2023, Thomas Schwinge <thomas@codesourcery.com> wrote:
>> As I understand things, ["strub"] cannot be implemented (at the call site) for
>> nvptx, given that the callee's stack is not visible there: PTX is unusual
>> in that the concept of a "standard" stack isn't exposed.
>
> Not even when one PTX function calls another? Interesting. I'd hoped
> that with control over entering and leaving strub contexts, one could
> (manually) ensure they'd run in the same execution domain. But if not
> even that is possible, it will render the current strub implementation
> entirely unusable for this target indeed.
>
> Now, it doesn't seem to me that the build errors being experienced have
> to do with that, but rather with lack of or incomplete support for
> __builtin_{frame,stack}_address(). Are those errors expected when using
> these builtins on this target? I'd have expected them to compile, even
> if something went wrong at runtime.
'__builtin_frame_address()' should be fine, but
'__builtin_stack_address()' synthesizes code that fails to assemble.
(Which is "OK".) To document the status quo, I've pushed to trunk branch
commit 91dec10f8b7502bdd333d75ab7a9e23a58c3f32d
"nvptx: Add '__builtin_stack_address()' test case", see attached.
Grüße
Thomas
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-nvptx-Add-__builtin_stack_address-test-case.patch --]
[-- Type: text/x-diff, Size: 1745 bytes --]
From 91dec10f8b7502bdd333d75ab7a9e23a58c3f32d Mon Sep 17 00:00:00 2001
From: Thomas Schwinge <tschwinge@baylibre.com>
Date: Fri, 13 Dec 2024 11:40:01 +0100
Subject: [PATCH] nvptx: Add '__builtin_stack_address()' test case
Documenting the status quo.
gcc/testsuite/
* gcc.target/nvptx/__builtin_stack_address-1.c: New.
---
.../nvptx/__builtin_stack_address-1.c | 36 +++++++++++++++++++
1 file changed, 36 insertions(+)
create mode 100644 gcc/testsuite/gcc.target/nvptx/__builtin_stack_address-1.c
diff --git a/gcc/testsuite/gcc.target/nvptx/__builtin_stack_address-1.c b/gcc/testsuite/gcc.target/nvptx/__builtin_stack_address-1.c
new file mode 100644
index 000000000000..5e976dc384bc
--- /dev/null
+++ b/gcc/testsuite/gcc.target/nvptx/__builtin_stack_address-1.c
@@ -0,0 +1,36 @@
+/* Document what we do for '__builtin_stack_address()'. */
+
+/* { dg-do compile }
+ TODO We can't 'assemble' this -- it's invalid PTX code. */
+/* { dg-options -O3 } */
+/* { dg-additional-options -save-temps } */
+/* { dg-final { check-function-bodies {** } {} } } */
+
+void sink(void *);
+
+void f(void)
+{
+ void *p;
+ p = __builtin_stack_address();
+ sink(p);
+}
+/*
+** f:
+** \.visible \.func f
+** {
+** {
+** \.param\.u64 %out_arg1;
+** st\.param\.u64 \[%out_arg1\], %stack;
+** call sink, \(%out_arg1\);
+** }
+** ret;
+*/
+
+/* The concept of a '%stack' pointer doesn't apply like this for
+ '-mno-soft-stack': PTX "native" stacks (TODO), and for '-msoft-stack' in
+ this form also constitutes invalid PTX code (TODO).
+
+ { dg-final { scan-assembler-not {%stack} { xfail *-*-* } } } */
+
+/* As this is an internal-use built-in function, we don't bother with
+ emitting proper error diagnostics. */
--
2.34.1
next prev parent reply other threads:[~2025-01-10 10:35 UTC|newest]
Thread overview: 61+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <ormtqpsbuc.fsf@lxoliva.fsfla.org>
2021-09-09 7:11 ` [PATCH] strub: machine-independent stack scrubbing Alexandre Oliva
2022-07-29 6:16 ` [PATCH v2 00/10] Introduce " Alexandre Oliva
2022-07-29 6:24 ` [PATCH v2 01/10] Introduce strub: documentation, and new command-line options Alexandre Oliva
2022-07-29 6:25 ` [PATCH v2 02/10] Introduce strub: torture tests for C and C++ Alexandre Oliva
2022-08-09 13:34 ` Alexandre Oliva
2022-07-29 6:25 ` [PATCH v2 03/10] Introduce strub: non-torture " Alexandre Oliva
2022-07-29 6:26 ` [PATCH v2 04/10] Introduce strub: tests for C++ and Ada Alexandre Oliva
2022-07-29 6:26 ` [PATCH v2 05/10] Introduce strub: builtins and runtime Alexandre Oliva
2022-07-29 6:27 ` [PATCH v2 06/10] Introduce strub: attributes Alexandre Oliva
2022-07-29 6:28 ` [PATCH v2 07/10] Introduce strub: infrastructure interfaces and adjustments Alexandre Oliva
2022-07-29 6:28 ` [PATCH v2 08/10] Introduce strub: strub modes Alexandre Oliva
2022-07-29 6:30 ` [PATCH v2 09/10] Introduce strub: strubm (mode assignment) pass Alexandre Oliva
2022-07-29 6:34 ` [PATCH v2 10/10] Introduce strub: strub pass Alexandre Oliva
2022-07-29 6:36 ` [PATCH v2 00/10] Introduce strub: machine-independent stack scrubbing Alexandre Oliva
2022-10-10 8:48 ` Richard Biener
2022-10-11 11:57 ` Alexandre Oliva
2022-10-11 11:59 ` Richard Biener
2022-10-11 13:33 ` Alexandre Oliva
2022-10-13 11:38 ` Richard Biener
2022-10-13 13:15 ` Alexandre Oliva
2023-06-16 6:09 ` [PATCH v3] " Alexandre Oliva
2023-06-27 21:28 ` Qing Zhao
2023-06-28 8:20 ` Alexandre Oliva
2023-10-20 6:03 ` [PATCH v4] " Alexandre Oliva
2023-10-26 6:15 ` Alexandre Oliva
2023-11-20 12:40 ` Alexandre Oliva
2023-11-22 14:14 ` Richard Biener
2023-11-23 10:56 ` Alexandre Oliva
2023-11-23 12:05 ` Richard Biener
2023-11-29 8:53 ` Alexandre Oliva
2023-11-29 12:48 ` Richard Biener
2023-11-30 4:13 ` Alexandre Oliva
2023-11-30 12:00 ` Richard Biener
2023-12-02 17:56 ` [PATCH v5] " Alexandre Oliva
2023-12-05 6:25 ` Alexandre Oliva
2023-12-06 1:04 ` Alexandre Oliva
2023-12-05 9:01 ` Richard Biener
2023-12-06 8:36 ` Causes to nvptx bootstrap fail: " Tobias Burnus
2023-12-06 11:32 ` Thomas Schwinge
2023-12-06 22:12 ` Alexandre Oliva
2023-12-07 3:33 ` [PATCH] strub: enable conditional support Alexandre Oliva
2023-12-07 7:24 ` Richard Biener
2023-12-07 16:44 ` Thomas Schwinge
2023-12-07 17:52 ` [PATCH] Alexandre Oliva
2023-12-08 6:46 ` [PATCH] Richard Biener
2023-12-08 9:33 ` [PATCH] strub: skip emutls after strubm errors Thomas Schwinge
2023-12-10 9:16 ` FX Coudert
2023-12-07 7:21 ` Causes to nvptx bootstrap fail: [PATCH v5] Introduce strub: machine-independent stack scrubbing Richard Biener
2025-01-10 10:35 ` Thomas Schwinge [this message]
2025-01-10 10:53 ` nvptx: Add '__builtin_frame_address(0)' test case (was: nvptx: Add '__builtin_stack_address()' test case (was: Causes to nvptx bootstrap fail: [PATCH v5] Introduce strub: machine-independent stack scrubbing)) Thomas Schwinge
2023-12-06 10:22 ` [PATCH v5] Introduce strub: machine-independent stack scrubbing Jan Hubicka
2023-12-07 21:19 ` Alexandre Oliva
2023-12-07 21:39 ` Alexandre Oliva
2023-12-09 2:08 ` [PATCH] strub: add note on attribute access Alexandre Oliva
2023-12-11 7:26 ` Richard Biener
2023-12-12 14:21 ` Jan Hubicka
2023-12-11 8:40 ` [PATCH] testsuite: Disable -fstack-protector* for some strub tests Jakub Jelinek
2023-12-11 8:59 ` Richard Biener
2023-12-20 8:15 ` [PATCH FYI] www: new AdaCore-contributed hardening features in gcc 13 and 14 Alexandre Oliva
2023-11-30 5:04 ` [PATCH v4] Introduce strub: machine-independent stack scrubbing Alexandre Oliva
2023-11-30 11:56 ` Richard Biener
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87tta77y7u.fsf@euler.schwinge.ddns.net \
--to=tschwinge@baylibre.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=oliva@adacore.com \
--cc=tdevries@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).