|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #73062 Test for -fvisibility=hidden support fails with certain $CC
Submitted: 2016-09-10 14:57 UTC Modified: 2016-09-10 22:58 UTC
From: michael at orlitzky dot com Assigned:
Status: Verified Package: *Compile Issues
PHP Version: 7.1Git-2016-09-10 (Git) OS:
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2016-09-10 14:57 UTC] michael at orlitzky dot com
There is a check 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
      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'`
    if test $GCC_MAJOR_VERSION -ge 4; then
      CFLAGS="$CFLAGS -fvisibility=hidden"

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'

But this is what happens when my CC is set:

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


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2016-09-10 22:47 UTC]
-Status: Open +Status: Verified
 [2016-09-10 22:47 UTC]
Um, wouldn't it be better to check for -fvisibility=hidden
support instead of the GCC version, anyway?
 [2016-09-10 22:58 UTC] michael at orlitzky dot com
Good idea =)
 [2018-02-13 20:37 UTC] aixtools at felt dot demon dot nl

The current test in php-7.2.2 gives a false pass (aka yes) when the compile is done with -c. Without -c the flag fails.

System AIX, complier xlc

root@x065:[/data/prj/php/php-7.2.2]xlc_r -c -I/opt/include -I/opt/include/mysql -qmaxmem=-1 -qarch=pwr5  -fvisibility=hidden -I/opt/include x.c
root@x065:[/data/prj/php/php-7.2.2]xlc_r -I/opt/include -I/opt/include/mysql -qmaxmem=-1 -qarch=pwr5  -fvisibility=hidden -I/opt/include x.c
ld: 0706-005 Cannot find or open file: visibility=hidden
        ld:fopen(): A file or directory in the path name does not exist.
 [2018-02-14 14:03 UTC] michael at orlitzky dot com
> The current test in php-7.2.2 gives a false pass (aka yes) when the compile is done with -c. Without -c the flag fails.

Is that causing a problem building PHP? I'm not familiar with xlc, but Google tells me that "-c" means "don't link," so the build should fail anyway with "-c" in your CFLAGS.

In any case, the macro is only supposed to check whether or not "-fvisibility=hidden" works with your current CC/CFLAGS. If you have CFLAGS="-c" and if the test (incorrectly) passes, that should still be ok since everything will be compiled with "-c -fvisibility=hidden". Unless it isn't; like I said I don't know anything about xlc =)
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Wed Jul 28 09:01:23 2021 UTC