about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2013-08-27 17:33:47 -0400
committerRich Felker <dalias@aerifal.cx>2013-08-27 17:33:47 -0400
commit06ceee8ca34999c5c35e5dfb85133d4b35c9689b (patch)
treea6733e8adecd49359bb4e2f1d05cbc589ce8cf33
parent242a4bb4406dad53a1983ea1134d5326a0c4afa3 (diff)
downloadmusl-06ceee8ca34999c5c35e5dfb85133d4b35c9689b.tar.gz
musl-06ceee8ca34999c5c35e5dfb85133d4b35c9689b.tar.xz
musl-06ceee8ca34999c5c35e5dfb85133d4b35c9689b.zip
add attribute((may_alias)) checking in configure
this will be needed for upcoming commits to the string/mem functions
to correct their unannounced use of aliasing violations for
word-at-a-time search, fill, and copy operations.
-rwxr-xr-xconfigure21
1 files changed, 21 insertions, 0 deletions
diff --git a/configure b/configure
index 469b7d29..40712c53 100755
--- a/configure
+++ b/configure
@@ -244,6 +244,27 @@ tryflag CFLAGS_C99FSE -fexcess-precision=standard \
 tryflag CFLAGS_C99FSE -frounding-math
 
 #
+# We may use the may_alias attribute if __GNUC__ is defined, so
+# if the compiler defines __GNUC__ but does not provide it,
+# it must be defined away as part of the CFLAGS.
+#
+printf "checking whether compiler needs attribute((may_alias)) suppression... "
+cat > "$tmpc" <<EOF
+typedef int
+#ifdef __GNUC__
+__attribute__((__may_alias__))
+#endif
+x;
+EOF
+if $CC $CFLAGS_C99FSE -I./arch/$ARCH -I./include $CPPFLAGS $CFLAGS \
+  -c -o /dev/null "$tmpc" >/dev/null 2>&1 ; then
+printf "no\n"
+else
+printf "yes\n"
+CFLAGS_C99FSE="$CFLAGS_C99FSE -D__may_alias__="
+fi
+
+#
 # Check for options that may be needed to prevent the compiler from
 # generating self-referential versions of memcpy,, memmove, memcmp,
 # and memset. Really, we should add a check to determine if this