This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: gdb build problem (gdb/unittests/scoped_mmap-selftests.c)


>>>>> "Simon" == Simon Marchi <simon.marchi@polymtl.ca> writes:

Simon> I think that enabling _FORTIFY_SOURCE can only do some good.

What do you think of the appended?
The check for __OPTIMIZE__ has to be done since otherwise a glibc header
will complain.

Building with this patch applied (after autoheader etc) let me reproduce
Steve's original problem.

Tom

diff --git a/gdb/configure.ac b/gdb/configure.ac
index 13bc5f9a8f2..76a1ba0364f 100644
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -2279,6 +2279,10 @@ dnl  At the moment, we just assume it's UTF-8.
 AC_DEFINE(GDB_DEFAULT_HOST_CHARSET, "UTF-8",
           [Define to be a string naming the default host character set.])
 
+AH_BOTTOM([#if defined __OPTIMIZE__ && __OPTIMIZE__ > 0
+#define _FORTIFY_SOURCE 2
+#endif])
+
 if $development; then
   AC_DEFINE(GDB_SELF_TEST, 1,
             [Define if self-testing features should be enabled])


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]