http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53299

             Bug #: 53299
           Summary: libiberty usage of GCC_PICFLAG causes -fPIC to be
                    passed to non-GNU compiler
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: other
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: sk...@iskunk.org
              Host: sparc64-sun-solaris2.8
            Target: sparc64-sun-solaris2.8
             Build: sparc64-sun-solaris2.8


In the course of bootstrapping 4.7.0 on Solaris using the vendor compiler, I
saw this:

[...]
config.status: creating testsuite/Makefile
config.status: creating config.h
config.status: executing default commands
gmake[3]: Entering directory `/tmp/gcc-build/libiberty'
if [ x"-fPIC" != x ] && [ ! -d pic ]; then \
          mkdir pic; \
        else true; fi
touch stamp-picdir
if [ x"-fPIC" != x ]; then \
          cc -xarch=v9 -xildoff -errwarn=%all -c -DHAVE_CONFIG_H -g  -I.
-I/home/src/gcc-4.7.0/libiberty/../include   -fPIC
/home/src/gcc-4.7.0/libiberty/regex.c -o pic/regex.o; \
        else true; fi
cc: Warning: illegal option -fPIC
cc -xarch=v9 -xildoff -errwarn=%all -c -DHAVE_CONFIG_H -g  -I.
-I/home/src/gcc-4.7.0/libiberty/../include  
/home/src/gcc-4.7.0/libiberty/regex.c -o regex.o
if [ x"-fPIC" != x ]; then \
          cc -xarch=v9 -xildoff -errwarn=%all -c -DHAVE_CONFIG_H -g  -I.
-I/home/src/gcc-4.7.0/libiberty/../include   -fPIC
/home/src/gcc-4.7.0/libiberty/cplus-dem.c -o pic/cplus-dem.o; \
        else true; fi
cc: Warning: illegal option -fPIC
[...]


I traced the -fPIC flag to the GCC_PICFLAG macro in the libiberty configure
script. There needs to be a check for whether $CC is GNU or not, because
passing in a bogus flag won't necessarily raise an error (even with -errwarn).

Reply via email to