[Mesa-dev] [PATCH] gallium/targets: use c++ compiler for linking

Michel Dänzer michel at daenzer.net
Mon Oct 17 08:32:22 PDT 2011


On Son, 2011-10-16 at 18:47 +0200, Marcin Slusarz wrote: 
> On Sun, Oct 16, 2011 at 04:15:14PM +0200, Michel Dänzer wrote:
> > On Son, 2011-10-16 at 14:54 +0200, Marcin Slusarz wrote: 
> > > On Sun, Oct 16, 2011 at 02:03:16PM +0200, Marcin Slusarz wrote:
> > > > On Fri, Oct 14, 2011 at 08:22:35AM +0200, Michel Dänzer wrote:
> > > > > On Don, 2011-10-13 at 15:11 -0500, Patrick Baggett wrote:
> > > > > > Well, trivial answer is that Win32 uses some C/C++ runtime provided by
> > > > > > Microsoft, usually something like MSVCR90.DLL (v9.0) etc. Solaris uses
> > > > > > libC.so, for example. As far as I know, only systems where the GNU C/C
> > > > > > ++ compiler is main system compiler (and generally therefore the GNU C
> > > > > > ++ runtime) uses anything named "libstdc++". So I'd expect
> > > > > > Free/Net/OpenBSD + Linux use that naming and probably not much else.
> > > > > > On other commercial UNIXes, if it does exist, it is just
> > > > > > for compatibility with C++ programs compiled using g++.
> > > > > 
> > > > > gcc -lsdtdc++ doesn't even work on all Linux architectures, as libdstdc
> > > > > ++ may require other stuff which is only pulled in implicitly by g++. 
> > > > 
> > > > Thanks.
> > > > 
> > > > > BTW, why does st/xorg need libstdc++ at all without LLVM?
> > > > 
> > > > Good question. I assumed it's needed by some mesa/gallium core, but
> > > > I checked it now and it's only needed by (new) nv50/nvc0 driver code.
> > > > 
> > > 
> > > I found another cases where -lstdc++ was used with gcc.
> > > Updated patch below.
> > 
> > Thanks for tracking these down.
> > 
> > However, I wonder if we shouldn't try to only use the C++ compiler for
> > linking when it's really necessary, e.g. for the nv50/nvc0 drivers.
> > Otherwise, even assuming the resulting binaries don't depend on things
> > like libstdc++ unless they're really needed, this creates an artificial
> > requirement for a C++ compiler. (I realize a C++ compiler is really
> > required for things like the GLSL compiler, but it should still be
> > possible to build at least some of these targets without one).
> 
> With the attached patch, and with LLVM disabled:
> 
> uses c++ symbols | links against libstdc++ | name

[...]

These look all good.


> With LLVM enabled:
> 
> uses c++ symbols | links against libstdc++ | name

[...]

> 0 1 gallium/libvdpau_r600.so

[...]

> 0 1 gallium/libXvMCr600.so

[...]

> 0 1 gallium/r600g_drv.so

[...]

> 0 1 gbm/pipe_i965.so
> [...]
> 0 1 gbm/pipe_r600.so

These could avoid linking against libstdc++ if they didn't link with g
++, right? Anyway, this looks good for now, thanks again.


-- 
Earthling Michel Dänzer           |                   http://www.amd.com
Libre software enthusiast         |          Debian, X and DRI developer


More information about the mesa-dev mailing list