Skip to content

Commit

Permalink
Adapt Configure to GCC version 10
Browse files Browse the repository at this point in the history
I got a notice from Jeff Law <law@redhat.com>:

    Your particular package fails its testsuite. This was ultimately
    tracked down to a Configure problem. The perl configure script treated
    gcc-10 as gcc-1 and turned on -fpcc-struct-return. This is an ABI
    changing flag and caused Perl to not be able to interact properly with
    the dbm libraries on the system leading to a segfault.

His proposed patch corrected only this one instance of the version
mismatch. Reading the Configure script revealed more issues. This
patch fixes all of them I found.

Please note I do not have GCC 10 available, I tested it by faking the version
with:

--- a/Configure
+++ b/Configure
@@ -4672,7 +4672,7 @@ $cat >try.c <<EOM
 int main() {
 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
 #ifdef __VERSION__
-       printf("%s\n", __VERSION__);
+       printf("%s\n", "10.0.0");
 #else
        printf("%s\n", "1");
 #endif

(cherry picked from commit 6bd6308, which
was accidentally reverted by commit e849841)
  • Loading branch information
ppisar authored and ilmari committed Jan 21, 2020
1 parent 6c8e115 commit 9f4e630
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions Configure
Expand Up @@ -4703,7 +4703,7 @@ else
fi
$rm -f try try.*
case "$gccversion" in
1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
1.*) cpp=`./loc gcc-cpp $cpp $pth` ;;
esac
case "$gccversion" in
'') gccosandvers='' ;;
Expand Down Expand Up @@ -4743,7 +4743,7 @@ esac
# gcc 3.* complain about adding -Idirectories that they already know about,
# so we will take those off from locincpth.
case "$gccversion" in
3*)
3.*)
echo "main(){}">try.c
for incdir in $locincpth; do
warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
Expand Down Expand Up @@ -5469,13 +5469,13 @@ fi
case "$hint" in
default|recommended)
case "$gccversion" in
1*) dflt="$dflt -fpcc-struct-return" ;;
1.*) dflt="$dflt -fpcc-struct-return" ;;
esac
case "$optimize:$DEBUGGING" in
*-g*:old) dflt="$dflt -DDEBUGGING";;
esac
case "$gccversion" in
2*) if $test -d /etc/conf/kconfig.d &&
2.*) if $test -d /etc/conf/kconfig.d &&
$contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
then
# Interactive Systems (ISC) POSIX mode.
Expand All @@ -5484,7 +5484,7 @@ default|recommended)
;;
esac
case "$gccversion" in
1*) ;;
1.*) ;;
2.[0-8]*) ;;
?*) set strict-aliasing -fno-strict-aliasing
eval $checkccflag
Expand Down Expand Up @@ -5602,7 +5602,7 @@ case "$cppflags" in
;;
esac
case "$gccversion" in
1*) cppflags="$cppflags -D__GNUC__"
1.*) cppflags="$cppflags -D__GNUC__"
esac
case "$mips_type" in
'');;
Expand Down Expand Up @@ -23229,7 +23229,7 @@ fi

: add -D_FORTIFY_SOURCE if feasible and not already there
case "$gccversion" in
[456789].*) case "$optimize$ccflags" in
[456789].*|[1-9][0-9]*) case "$optimize$ccflags" in
*-O*) case "$ccflags$cppsymbols" in
*_FORTIFY_SOURCE=*) # Don't add it again.
echo "You seem to have -D_FORTIFY_SOURCE already, not adding it." >&4
Expand Down

0 comments on commit 9f4e630

Please sign in to comment.