bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] stdc.h: don't define __STRING for _FORTIFY_SOURCE


From: Christopher Larson
Subject: [PATCH] stdc.h: don't define __STRING for _FORTIFY_SOURCE
Date: Wed, 14 Nov 2012 10:45:36 -0700

From: Christopher Larson <address@hidden>

When cross-compiling from a host which defines _FORTIFY_SOURCE by default, the
build fails when linking mkbuiltins, due to an inability to find the xread and
xopen symbols. This occurs because the __STRING macro in stdc.h overwrites the
macro from unistd.h, and when HAVE_STRINGIZE isn't set (as is the case when
compiling mkbuiltins.c with -DCROSS_COMPILING), the overwritten macro returns
'x', resulting in a concatenation of the function names, rather than an
assembly level rename of the function being called as was intended.

Either we can add HAVE_STRINGIZE to mkbuiltins.c, assuming that all hosts we
build on support stringize (but in that case, we might as well remove __STRING
from stdc.h entirely, giving up on supporting non-stringize-capable
compilers), or do this: don't define __STRING at all when _FORTIFY_SOURCE is
defined.

Signed-off-by: Christopher Larson <address@hidden>
---
 include/stdc.h | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/include/stdc.h b/include/stdc.h
index df01d81..4375918 100644
--- a/include/stdc.h
+++ b/include/stdc.h
@@ -36,10 +36,12 @@
 #  endif
 #endif
 
-#if defined (HAVE_STRINGIZE)
-#  define __STRING(x) #x
-#else
-#  define __STRING(x) "x"
+#if !defined (_FORTIFY_SOURCE)
+#  if defined (HAVE_STRINGIZE)
+#    define __STRING(x) #x
+#  else
+#    define __STRING(x) "x"
+#  endif
 #endif
 
 #if !defined (__STDC__)
-- 
1.7.12.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]