]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
build: unbreak bootstrap on uclinux targets [PR112762]
authorMarek Polacek <polacek@redhat.com>
Tue, 5 Dec 2023 18:39:49 +0000 (13:39 -0500)
committerMarek Polacek <polacek@redhat.com>
Wed, 6 Dec 2023 13:34:26 +0000 (08:34 -0500)
Currently, cross-compiling with --target=c6x-uclinux (and several other)
fails due to:

../../src/gcc/config/linux.h:221:45: error: 'linux_fortify_source_default_level' was not declared in this scope
 #define TARGET_FORTIFY_SOURCE_DEFAULT_LEVEL linux_fortify_source_default_level

In the PR Andrew mentions that another fix would be in config.gcc,
but really, here I meant to use the target hook for glibc only, not
uclibc.  This trivial patch fixes the build problem.  It means that
-fhardened with uclibc will use -D_FORTIFY_SOURCE=2 and not =3.

PR target/112762

gcc/ChangeLog:

* config/linux.h: Redefine TARGET_FORTIFY_SOURCE_DEFAULT_LEVEL for
glibc only.

gcc/config/linux.h

index 79b6537dcf136b2d0dd8b21a792e84400ca78ee5..73f39d3c6031557e2c956ea2f12beba8e5d9bd00 100644 (file)
@@ -215,7 +215,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 # undef TARGET_LIBM_FUNCTION_MAX_ERROR
 # define TARGET_LIBM_FUNCTION_MAX_ERROR linux_libm_function_max_error
 
-#endif
-
 #undef TARGET_FORTIFY_SOURCE_DEFAULT_LEVEL
 #define TARGET_FORTIFY_SOURCE_DEFAULT_LEVEL linux_fortify_source_default_level
+
+#endif