public inbox for newlib-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin] nvptx: Don't use global constructor for SSP setup
@ 2023-01-20 19:36 Thomas Schwinge
  0 siblings, 0 replies; only message in thread
From: Thomas Schwinge @ 2023-01-20 19:36 UTC (permalink / raw)
  To: newlib-cvs

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=3b58032de14f7a08b1c60ee9fc4857c5fbfc8e57

commit 3b58032de14f7a08b1c60ee9fc4857c5fbfc8e57
Author: Thomas Schwinge <thomas@codesourcery.com>
Date:   Tue Oct 11 23:34:19 2022 +0200

    nvptx: Don't use global constructor for SSP setup
    
    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.

Diff:
---
 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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-01-20 19:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-20 19:36 [newlib-cygwin] nvptx: Don't use global constructor for SSP setup Thomas Schwinge

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).