Subject: usage of ssp include files
To: None <tech-userlevel@NetBSD.org>
From: Krister Walfridsson <cato@df.lth.se>
List: tech-userlevel
Date: 08/01/2007 21:33:30
gcc fails to build on NetBSD 4 and current because of how the NetBSD SSP
include files are handled (the gcc build process plays tricks with
include paths, and files from GCC's SSP directory get included when the
NetBSD string.h includes ssp/string.h). [*]
This is obviously a gcc issue, and I usually do not advocate changing the
OS to make other software's broken build processes to work, but I think
it may make sense to fix this in our includes since this is after all a
gcc feature we have added (besides, fixing this in NetBSD will make my
life easier... ;)
So, does it make sense to change our headers (current and netbsd-4) as
the patch below?
/Krister
* It is possible to build by giving --disable-libssp to configure, but
i think it is nice to be able to build a full gcc distribution, so
that NetBSD users can use improvements that future gcc may introduce,
and to benchmark against the NetBSD native version.
Index: stdio.h
===================================================================
RCS file: /cvsroot/src/include/stdio.h,v
retrieving revision 1.69
diff -u -r1.69 stdio.h
--- stdio.h 30 May 2007 21:14:37 -0000 1.69
+++ stdio.h 1 Aug 2007 19:07:58 -0000
@@ -476,6 +476,8 @@
#define putchar_unlocked(x) putc_unlocked(x, stdout)
#endif /* _POSIX_C_SOURCE >= 199506 || _XOPEN_SOURCE >= 500 || _REENTRANT... */
+#if _FORTIFY_SOURCE > 0
#include <ssp/stdio.h>
+#endif
#endif /* _STDIO_H_ */
Index: string.h
===================================================================
RCS file: /cvsroot/src/include/string.h,v
retrieving revision 1.32
diff -u -r1.32 string.h
--- string.h 30 May 2007 21:14:37 -0000 1.32
+++ string.h 1 Aug 2007 19:07:58 -0000
@@ -91,5 +91,7 @@
#endif
__END_DECLS
+#if _FORTIFY_SOURCE > 0
#include <ssp/string.h>
+#endif
#endif /* !defined(_STRING_H_) */
Index: strings.h
===================================================================
RCS file: /cvsroot/src/include/strings.h,v
retrieving revision 1.11
diff -u -r1.11 strings.h
--- strings.h 30 May 2007 21:14:37 -0000 1.11
+++ strings.h 1 Aug 2007 19:07:58 -0000
@@ -68,5 +68,7 @@
#include <string.h>
#endif
+#if _FORTIFY_SOURCE > 0
#include <ssp/strings.h>
+#endif
#endif /* !defined(_STRINGS_H_) */
Index: unistd.h
===================================================================
RCS file: /cvsroot/src/include/unistd.h,v
retrieving revision 1.111
diff -u -r1.111 unistd.h
--- unistd.h 30 May 2007 21:14:37 -0000 1.111
+++ unistd.h 1 Aug 2007 19:07:58 -0000
@@ -364,5 +364,7 @@
__END_DECLS
+#if _FORTIFY_SOURCE > 0
#include <ssp/unistd.h>
+#endif
#endif /* !_UNISTD_H_ */