提交 9ca4dae5 编写于 作者: R Rich Felker

add configure check for broken gcc 4.9.0 and possibly other versions

this is gcc bug #61144. the broken compiler is detected, but the user
must manually work around it. this is partly to avoid complex logic
for adding workaround CFLAGS and attempting to recheck with them, and
partly for the sake of letting the user know the compiler is broken
(since the workaround will result in less-efficient code production).

some refactoring was also needed to move the check for gcc outside of
the check for whether to build the compiler wrapper.
上级 8a2d8719
...@@ -125,6 +125,7 @@ debug=no ...@@ -125,6 +125,7 @@ debug=no
warnings=no warnings=no
shared=yes shared=yes
static=yes static=yes
wrapper=auto
for arg ; do for arg ; do
case "$arg" in case "$arg" in
...@@ -199,23 +200,33 @@ exit 1 ...@@ -199,23 +200,33 @@ exit 1
fi fi
# #
# Only build musl-gcc wrapper if toolchain does not already target musl # Need to know if the compiler is gcc to decide whether to build the
# musl-gcc wrapper, and for critical bug detection in some gcc versions.
# #
if test -z "$wrapper" ; then
printf "checking whether compiler is gcc... " printf "checking whether compiler is gcc... "
if fnmatch '*gcc\ version*' "$($CC -v 2>&1)" ; then if fnmatch '*gcc\ version*' "$($CC -v 2>&1)" ; then
echo yes cc_is_gcc=yes
else
cc_is_gcc=no
fi
echo "$cc_is_gcc"
#
# Only build musl-gcc wrapper if toolchain does not already target musl
#
if test "$wrapper" = auto ; then
printf "checking whether to build musl-gcc wrapper... " printf "checking whether to build musl-gcc wrapper... "
if test "$cc_is_gcc" = yes ; then
wrapper=yes wrapper=yes
while read line ; do while read line ; do
case "$line" in */ld-musl-*) wrapper=no ;; esac case "$line" in */ld-musl-*) wrapper=no ;; esac
done <<EOF done <<EOF
$($CC -dumpspecs) $($CC -dumpspecs)
EOF EOF
echo $wrapper
else else
echo no wrapper=no
fi fi
echo "$wrapper"
fi fi
...@@ -484,6 +495,27 @@ printf "no\n" ...@@ -484,6 +495,27 @@ printf "no\n"
fail "$0: error: unsupported long double type" fail "$0: error: unsupported long double type"
fi fi
#
# Check for known bug in GCC 4.9.0 that results in a broken libc.
#
if test "$cc_is_gcc" = yes ; then
printf "checking for gcc constant folding bug with weak aliases... "
echo 'static int x = 0;' > "$tmpc"
echo 'extern int y __attribute__((__weak__, __alias__("x")));' >> "$tmpc"
echo 'extern int should_appear;' >> "$tmpc"
echo 'int foo() { return y ? should_appear : 0; }' >> "$tmpc"
case "$($CC $CFLAGS_C99FSE -I./arch/$ARCH -I./include \
$CPPFLAGS $CFLAGS_AUTO $CFLAGS -S -o - "$tmpc" 2>/dev/null)" in
*should_appear*)
printf "no\n"
;;
*)
printf "yes\n"
fail "$0: error: broken compiler; try CFLAGS=-fno-toplevel-reorder"
;;
esac
fi
printf "creating config.mak... " printf "creating config.mak... "
cmdline=$(quote "$0") cmdline=$(quote "$0")
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册