public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/omp/gcc-13] Make 'libgcc/config/nvptx/crt0.c' build '--without-headers'
@ 2023-05-19 16:51 Kwok Yeung
  0 siblings, 0 replies; only message in thread
From: Kwok Yeung @ 2023-05-19 16:51 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:489adab23e75ad78564976f62fb621987b08921d

commit 489adab23e75ad78564976f62fb621987b08921d
Author: Thomas Schwinge <thomas@codesourcery.com>
Date:   Tue Jan 24 09:49:34 2023 +0100

    Make 'libgcc/config/nvptx/crt0.c' build '--without-headers'
    
    ..., where it currently fails:
    
        [...]/libgcc/config/nvptx/crt0.c:22:10: fatal error: stdlib.h: No such file or directory
           22 | #include <stdlib.h>
              |          ^~~~~~~~~~
    
    Fix-up for "nvptx: Support global constructors/destructors via 'collect2'".
    
            libgcc/
            * config/nvptx/crt0.c [!HAVE_STDLIB_H]: Don't '#include <stdlib.h>'.
            (atexit): Prototype.

Diff:
---
 libgcc/ChangeLog.omp       | 5 +++++
 libgcc/config/nvptx/crt0.c | 7 ++++++-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/libgcc/ChangeLog.omp b/libgcc/ChangeLog.omp
index 7d6595d60e9..fb563e03a32 100644
--- a/libgcc/ChangeLog.omp
+++ b/libgcc/ChangeLog.omp
@@ -1,3 +1,8 @@
+2023-01-24  Thomas Schwinge  <thomas@codesourcery.com>
+
+	* config/nvptx/crt0.c [!HAVE_STDLIB_H]: Don't '#include <stdlib.h>'.
+	(atexit): Prototype.
+
 2023-01-20  Thomas Schwinge  <thomas@codesourcery.com>
 	    Andrew Stubbs  <ams@codesourcery.com>
 
diff --git a/libgcc/config/nvptx/crt0.c b/libgcc/config/nvptx/crt0.c
index a1654872fd2..6022994f255 100644
--- a/libgcc/config/nvptx/crt0.c
+++ b/libgcc/config/nvptx/crt0.c
@@ -19,11 +19,16 @@
    see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
    <http://www.gnu.org/licenses/>.  */
 
-#include <stdlib.h>
+#include "auto-target.h"
+
+#ifdef HAVE_STDLIB_H
+# include <stdlib.h>
+#endif
 #include "gbl-ctors.h"
 
 int *__exitval_ptr;
 
+extern int atexit (void (*function) (void));
 extern void __attribute__((noreturn)) exit (int status);
 extern int main (int, void **);

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

only message in thread, other threads:[~2023-05-19 16:51 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-19 16:51 [gcc/devel/omp/gcc-13] Make 'libgcc/config/nvptx/crt0.c' build '--without-headers' Kwok Yeung

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