Bug #73062 [Opn->Ver]: Test for -fvisibility=hidden support fails with certain $CC

From: Date: Sat, 10 Sep 2016 22:47:57 +0000
Subject: Bug #73062 [Opn->Ver]: Test for -fvisibility=hidden support fails with certain $CC
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-203953@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=73062&edit=1

 ID:                 73062
 Updated by:         cmb@php.net
 Reported by:        michael at orlitzky dot com
 Summary:            Test for -fvisibility=hidden support fails with
                     certain $CC
-Status:             Open
+Status:             Verified
 Type:               Bug
 Package:            *Compile Issues
 PHP Version:        7.1Git-2016-09-10 (Git)
 Block user comment: N
 Private report:     N

 New Comment:

Um, wouldn't it be better to check for -fvisibility=hidden
support instead of the GCC version, anyway?


Previous Comments:
------------------------------------------------------------------------
[2016-09-10 14:57:38] michael at orlitzky dot com

Description:
------------
There is a check in configure.in that looks for -fvisibility=hidden support when the user is
building with GCC:

  dnl activate some gcc specific optimizations for gcc >= 4
  if test "$GCC" = "yes"; then
    case $host_alias in
    *darwin*)
      GCC_MAJOR_VERSION=`$CC -dumpversion | /usr/bin/sed -nE '1s/([[0-9]]+)\.[[0-$
      ;;
    *)
      GCC_MAJOR_VERSION=$CC --version | $SED -n '1s/[[^0-9]]*//;1s/\..*//;1p'
      ;;
    esac
    if test $GCC_MAJOR_VERSION -ge 4; then
      CFLAGS="$CFLAGS -fvisibility=hidden"
    fi
  fi

The idea is to parse off the major version number from the end of the "gcc --version"
output, and see if it's 4 or more. However, the regular expression in question doesn't
work when $CC is a little weird. This is the expected result, with a vanilla GCC:

  $CC --version | sed -n '1s/[[^0-9]]*//;1s/\..*//;1p'
  4

But this is what happens when my CC is set:

  CC=x86_64-pc-linux-gnu-gcc
  $ $CC --version | sed -n '1s/[[^0-9]]*//;1s/\..*//;1p'
  x6_64-pc-linux-gnu-gcc (Gentoo Hardened 4




------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=73062&edit=1


Thread (8 messages)

« previous php.bugs (#203953) next »