public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
From: Thomas Schwinge <thomas@codesourcery.com>
To: <newlib@sourceware.org>
Cc: <tdevries@suse.de>, <ams@codesourcery.com>,
	Thomas Schwinge <thomas@codesourcery.com>
Subject: [PATCH 1/2] nvptx: Don't use global constructor for SSP setup
Date: Thu, 19 Jan 2023 22:53:16 +0100	[thread overview]
Message-ID: <20230119215317.2001873-1-thomas@codesourcery.com> (raw)
In-Reply-To: <ae825c453f484ffd99c9be34af726089@mentor.com>

Given that nvptx newlib currently restricts itself to ELIX level 1, this
is not already a problem.  However, in the following we'd like to lift
that restriction, and then run into:

    [...]/newlib/libc/ssp/stack_protector.c: In function ‘__stack_chk_init’:
    [...]/newlib/libc/ssp/stack_protector.c:31:1: sorry, unimplemented: global constructors not supported on this target
       31 | }
          | ^

GCC patch "nvptx: Support global constructors/destructors via 'collect2'"
has been posted, but not yet accepted.  Until that is resolved, use the
same manual SSP setup as for GCN.
---
 newlib/libc/ssp/stack_protector.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/newlib/libc/ssp/stack_protector.c b/newlib/libc/ssp/stack_protector.c
index cd51543f0..5e9d75f0f 100644
--- a/newlib/libc/ssp/stack_protector.c
+++ b/newlib/libc/ssp/stack_protector.c
@@ -5,8 +5,8 @@
 #include <string.h>
 #include <unistd.h>

-#if defined(__AMDGCN__)
-/* GCN does not support constructors, yet.  */
+#if defined(__AMDGCN__) || defined(__nvptx__)
+/* Global constructors not supported on this target, yet.  */
 uintptr_t __stack_chk_guard = 0x00000aff; /* 0, 0, '\n', 255  */

 #else
--
2.25.1

-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955

       reply	other threads:[~2023-01-19 21:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <ae825c453f484ffd99c9be34af726089@mentor.com>
2023-01-19 21:53 ` Thomas Schwinge [this message]
2023-01-19 21:53   ` [PATCH 2/2] nvptx: Remove newlib ELIX level 1 restriction Thomas Schwinge
2023-01-19 21:53 ` [PATCH] nvptx: Provide stub 'getpid', 'kill', 'stat' Thomas Schwinge

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=20230119215317.2001873-1-thomas@codesourcery.com \
    --to=thomas@codesourcery.com \
    --cc=ams@codesourcery.com \
    --cc=newlib@sourceware.org \
    --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).