Subject: Re: different behaviour of system cc and TOOLDIR/cc
To: Matthias Drochner <>
From: Frederick Bruckman <>
List: tech-toolchain
Date: 06/06/2003 20:59:49
On Fri, 6 Jun 2003, Matthias Drochner wrote:

> said:
> > Since the toolchain compiler is (potentially) a cross compiler, you
> > really don't want it searching in the base system.
> Hmm - isn't this what the -nostdlib flag is for?

A cross compiler should link targets with the host objects
approximately never, so unless you hardcode ${DESTDIR} into the
compiler, it might as well break without the correct options for
native builds, too, to help catch mistakes (or so I hear).

> It shouldn't use anything of the base system unless directed
> by -L or so, agreed. However these crt* files have a strange
> status somehow - they don't belong to the target system, otherwise
> they should be found by -L${DESTDIR}, but they also are not
> part of the toolchain, otherwise they should reside in ${TOOLDOR}/...

They're not even libraries. I guess that's why "-L" doesn't work.
"-B${DESTDIR}/usr/lib/" seems to do it, though.

> said:
> > Whenever you use the TOOLDIR gcc, you basically need to do the
> > -nostdlib dance and specifiy the libraries/crt files manually, just as
> >  <bsd.*.mk> do.
> OK, but this is somehow unsatisfying because information
> is duplicated: The *.mk files have to know which crt* files
> are to be linked in, in addition to the compiler's specs.

Yes, they do. I asked once, why the toolchain compiler isn't a fully
functional cross compiler, and I'm not sure I ever got a satisfactory

Hmm... It looks like those paths are set in
"gnu/dist/toolchain/gcc/config/netbsd.h" conditionally on
NETBSD_NATIVE being defined. It's looks to be pretty straightforward
to prefix them with DESTDIR, and pass it in to the build.

> What I'm trying to get solved is that shared libraries are
> not linked against libgcc_pic.a if <> is used.
> Just using ${CC} instead of ${LD} to build the lib works,
> but only as long as USETOOLS==no.
> Would be easily solved by wiring -lgcc_pic into,
> but I'd consider this ugly for the readons mentioned.
> And there might be issues wrt a gcc-3 migration...

Observe what "hppa" is doing in <>. They're not using
${DESTDIR}, though, so I don't see how that can cross-compile.