[bootstrap 1.1.1 on Solaris 2.6] incorrect PIC options fed to cc

Manfred Hollstein manfred@s-direktnet.de
Thu Dec 10 07:13:00 GMT 1998


On Wed, 9 December 1998, 10:41:51, pedwards@ball.com wrote:

 > 
 > Bootstrapping egcs 1.1.1 on a sparc-sun-solaris2.6 using the native
 > v4.0 cc, configured with --enable-shared.
 > 
 > The PICFLAG case statement emits -fpic/-fPIC to cc, which is incorrect.
 > The SPARCompiler cc takes -Kpic/-KPIC for those two options.
 > 
 > I'm not certain where mt-frag's PICFLAG_FOR_TARGET comes into play; I
 > assume it would be when building a cross-compiler...  The ChangeLog
 > has recent entries saying "don't pass PICFLAG_FOR_TARGET".  In any
 > case, I changed both config/m[th]-sparcpic before running configure:
 > 
 > [I feel silly doing a context diff on one-line files, but what the
 > heck...]
 > 

Hmm, looks like nobody tried to build this combination using cc before...

How about this:

PICFLAG=`case "${LIBCFLAGS} ${LIBCXXFLAGS}" in *-fpic* ) if test ${CC} = cc; then echo -Kpic; else echo -fpic; fi ;; * ) if test ${CC} = cc; then echo -KPIC; else echo -fPIC; fi ;; esac`

Pooh, it's getting uglier every day ... :-(

manfred

 > ==============================================================
 > diff -rc egcs-1.1.1/config/mh-sparcpic correct_sparc/config/mh-sparcpic
 > *** egcs-1.1.1/config/mh-sparcpic	Thu Feb  5 19:33:03 1998
 > --- correct_sparc/config/mh-sparcpic	Tue Dec  8 16:36:31 1998
 > ***************
 > *** 1 ****
 > ! PICFLAG=`case "${LIBCFLAGS} ${LIBCXXFLAGS}" in *-fpic* ) echo -fpic ;; * ) echo -fPIC ;; esac`
 > --- 1 ----
 > ! PICFLAG=`case "${LIBCFLAGS} ${LIBCXXFLAGS}" in *-fpic* ) echo -Kpic ;; * ) echo -KPIC ;; esac`
 > diff -rc egcs-1.1.1/config/mt-sparcpic correct_sparc/config/mt-sparcpic
 > *** egcs-1.1.1/config/mt-sparcpic	Thu Feb  5 19:33:04 1998
 > --- correct_sparc/config/mt-sparcpic	Tue Dec  8 16:36:41 1998
 > ***************
 > *** 1 ****
 > ! PICFLAG_FOR_TARGET=`case "${LIBCFLAGS} ${LIBCXXFLAGS}" in *-fpic* ) echo -fpic ;; * ) echo -fPIC ;; esac`
 > --- 1 ----
 > ! PICFLAG_FOR_TARGET=`case "${LIBCFLAGS} ${LIBCXXFLAGS}" in *-fpic* ) echo -Kpic ;; * ) echo -KPIC ;; esac`
 > ==============================================================
 > 
 > 
 > This change is required for --enable-shared to work properly on
 > Solaris using CC=cc.  However, if using CC=gcc, this will break.
 > I know I've seen configures that ask "Checking if C compiler is
 > gcc..." but I don't know how to work that into egcs' setup, else
 > I'd send a patch for that, too.
 > 
 > As a result, this is correct when building libiberty during the
 > stage1 construction.  But, when the compiler is finished and the
 > libraries are configured and built, the same fragment files are
 > used with "CC=/tmp/building/gcc/xgcc -B/tmp/building/gcc/".  And
 > so it breaks.
 > 
 > 
 > I don't know how to use one set of frags when cc is being used,
 > and another set when [x]gcc is being used.  I ended up starting
 > from scratch (overkill, I know, but oh well), with this routine:
 > 
 > 1)  using the original unchanged 1.1.1 source, configure with
 >     --enable-shared
 > 2)  in the objdir's Makefile(s), change the -fpic/-fPIC to the
 >     correct -Kpic/-KPIC
 > 3)  make bootstrap
 > 4)  the library's directory in objdir hasn't been created nor
 >     configured yet, so the automagic configure will pick up the
 >     unchanged frag files and correctly pass -fPIC to xgcc
 > 
 > The following diff is the one I'll be keeping around, to apply
 > to future objdir's:
 > 
 > ==============================================================
 > diff -rc base_configure/Makefile building/Makefile
 > *** base_configure/Makefile	Tue Dec  8 18:02:58 1998
 > --- building/Makefile	Tue Dec  8 18:07:04 1998
 > ***************
 > *** 339,352 ****
 >     fi`
 >   
 >   #### host and target specific makefile fragments come in here.
 > ! PICFLAG_FOR_TARGET=`case "${LIBCFLAGS} ${LIBCXXFLAGS}" in *-fpic* ) echo -fpic ;; * ) echo -fPIC ;; esac`
 >   # Makefile changes for Suns running Solaris 2
 >   
 >   SYSV = -DSYSV
 >   RANLIB = true
 >   
 >   X11_EXTRA_LIBS = -lnsl -lsocket
 > ! PICFLAG=`case "${LIBCFLAGS} ${LIBCXXFLAGS}" in *-fpic* ) echo -fpic ;; * ) echo -fPIC ;; esac`
 >   ###
 >   
 >   # Flags to pass down to all sub-makes.
 > --- 339,352 ----
 >     fi`
 >   
 >   #### host and target specific makefile fragments come in here.
 > ! PICFLAG_FOR_TARGET=`case "${LIBCFLAGS} ${LIBCXXFLAGS}" in *-fpic* ) echo -Kpic ;; * ) echo -KPIC ;; esac`
 >   # Makefile changes for Suns running Solaris 2
 >   
 >   SYSV = -DSYSV
 >   RANLIB = true
 >   
 >   X11_EXTRA_LIBS = -lnsl -lsocket
 > ! PICFLAG=`case "${LIBCFLAGS} ${LIBCXXFLAGS}" in *-fpic* ) echo -Kpic ;; * ) echo -KPIC ;; esac`
 >   ###
 >   
 >   # Flags to pass down to all sub-makes.
 > diff -rc base_configure/libiberty/Makefile building/libiberty/Makefile
 > *** base_configure/libiberty/Makefile	Tue Dec  8 18:03:18 1998
 > --- building/libiberty/Makefile	Tue Dec  8 18:07:25 1998
 > ***************
 > *** 96,102 ****
 >   
 >   # Warning: this fragment is automatically generated
 >   # Following fragment copied from ../../egcs-1.1.1/libiberty/config/../../config/mh-sparcpic
 > ! PICFLAG=`case "${LIBCFLAGS} ${LIBCXXFLAGS}" in *-fpic* ) echo -fpic ;; * ) echo -fPIC ;; esac`
 >   enable_shared = yes
 >   
 >   INCDIR=$(srcdir)/$(MULTISRCTOP)../include
 > --- 96,102 ----
 >   
 >   # Warning: this fragment is automatically generated
 >   # Following fragment copied from ../../egcs-1.1.1/libiberty/config/../../config/mh-sparcpic
 > ! PICFLAG=`case "${LIBCFLAGS} ${LIBCXXFLAGS}" in *-fpic* ) echo -Kpic ;; * ) echo -KPIC ;; esac`
 >   enable_shared = yes
 >   
 >   INCDIR=$(srcdir)/$(MULTISRCTOP)../include
 > ==============================================================
 > 
 > 
 > 
 > (Next up, sparc-sun-solaris2.4 and mips-sgi-irix6.3 (again).)
 > 
 > 
 > 
 > -- 
 > pedwards@ball.com    Ball Aerospace & Technologies Corp.
 > (937-320-4048)       Advanced Systems & Technology Operations
 > 
 > 
 > 



More information about the Gcc-bugs mailing list