[PATCH] adds powerpc-*-freebsd? to mainline

Geoff Keating geoffk@geoffk.org
Sun Nov 4 08:55:00 GMT 2001


> Date: Tue, 13 Nov 2001 17:30:32 -0800
> From: "David O'Brien" <obrien@FreeBSD.org>

> On Tue, Nov 13, 2001 at 05:06:31PM -0800, Geoff Keating wrote:
> > > +/* PowerPC simulator based on FreeBSD system calls support.  */
> > > +#define LIB_SIM_SPEC "--start-group -lsim -lc --end-group"
> > > +
> > >  /* PowerPC simulator based on netbsd system calls support.  */
> > >  #define LIB_SIM_SPEC "--start-group -lsim -lc --end-group"
> > 
> > No.
> 
> Why?

Because you're defining two macros with the same name and contents for
no apparent reason?

> > > +/* Faked out FreeBSD support.
> > > +   The real information comes from config/freebsd.h  */
> > > +#ifndef USING_CONFIG_FREEBSD
> > > +#define CPP_OS_FREEBSD_SPEC	""
> > > +#define	STARTFILE_FREEBSD_SPEC	""
> > > +#define ENDFILE_FREEBSD_SPEC	""
> > > +#define LIB_FREEBSD_SPEC	""
> > > +#endif /* USING_CONFIG_FREEBSD */
> > 
> > This won't work.  If you really can't get these values without
> > including config/freebsd.h, it would be better to not have freebsd be
> > part of the combined toolchain.
> 
> It wont -- please see gcc/config/freebsd*.h.
> What is really so bad with what I have done?  Do you really want me to
> duplicate 90% of sysv4.h?

Well, for one thing, it won't work.  If I build a powerpc-elf
toolchain and do -mcall-freebsd, I won't get crt0 or libc linked in.

> > However, I'd rather you try to
> > include the correct values here, as I doubt that there's anything
> > particularly special about freebsd and it allows the same compiler
> > binary to be shared.
> 
> Again, please go look at the work Loren Rittle and I have done there --
> especially for LIB_SPEC and CPP_PREDEFINES.
> If you will block my patch, please provide details on how you would
> handle the situation.  While I think your reorgination of sysv4.h is very
> slick, it did not allow having an OS global config header that set things
> so they were consitant across all of an OS's hardware platforms.

I would write this, based on config/freebsd.h:

#define CPP_OS_FREEBSD_SPEC      "%(cpp_cpu) \
  %{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__} \
  %{posix:-D_POSIX_SOURCE}"
#define STARTFILE_FREEBSD_SPEC \
  "%{!shared: \
     %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} \
		       %{!p:%{profile:gcrt1.o%s} \
			 %{!profile:crt1.o%s}}}} \
   crti.o%s %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}"

and so on.  While this does involve some duplication---and I'd be
happy to see a patch that avoids the duplication---it also means that
one can target freebsd and linux and non-OS systems from one
toolchain, which seems useful.  You might look at how linux---which
also has a global OS config header---is treated.

BTW, I didn't design the rs6000/svr4.h header, that happened long ago
and I just inherited it.

-- 
- Geoffrey Keating <geoffk@geoffk.org> <geoffk@redhat.com>



More information about the Gcc-patches mailing list