From owner-freebsd-current Thu Oct 17 09:14:24 1996 Return-Path: owner-current Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id JAA09275 for current-outgoing; Thu, 17 Oct 1996 09:14:24 -0700 (PDT) Received: from rocky.mt.sri.com (rocky.mt.sri.com [206.127.76.100]) by freefall.freebsd.org (8.7.5/8.7.3) with ESMTP id JAA09269 for ; Thu, 17 Oct 1996 09:14:17 -0700 (PDT) Received: (from nate@localhost) by rocky.mt.sri.com (8.7.5/8.7.3) id KAA18147; Thu, 17 Oct 1996 10:13:59 -0600 (MDT) Date: Thu, 17 Oct 1996 10:13:59 -0600 (MDT) Message-Id: <199610171613.KAA18147@rocky.mt.sri.com> From: Nate Williams To: Keith Mitchell Cc: nate@mt.sri.com (Nate Williams), current@freebsd.org Subject: Re: Weirdness in current In-Reply-To: <199610171431.KAA10456@unix.guru.org> References: <199610171359.HAA17511@rocky.mt.sri.com> <199610171431.KAA10456@unix.guru.org> Sender: owner-current@freebsd.org X-Loop: FreeBSD.org Precedence: bulk > > Are you saying the math library is brought in even if you don't > > explicitly ask for it? > > Yes. It did that in 2.10R, 2.15R, -stable, and now again in -current. I don't see that on my -stable box, but it definitely happens in -current. It's done automatically in -current by the c++ driver on line 551 of /usr/src/contrib/cc/cp/g++.c. *RANT MODE ON* Did I mention that I *HATE* the new contrib scheme? It makes trying to debug programs a nightmare since the code is scattered everywhere across contrib, so a simply grep doesn't work very well. *RANT MODE OFF* In any case, the math library is linked into into *ALL* binaries, so 'static' vs 'shared' shouldn't make any difference. > I have no idea why though. The program doesn't use any of the > functions in the math library directly. And, without the math library > the program core dumps (but ONLY on output redirection ;-<>). With > the math library compiled in it works fine. It's linked into the static version, so why adding it again makes any difference is a mystery to me. An easy way to see what's happening is to use the '-v' flag to the compiler. EX: % setenv CC "cc -v" > Well, what I think is happening is that the static linking is not bringing > in the math library like the dynamic one now does (see above). Nope. At least, not on my system. > NOTE: -current as of 10/9 did not bring in the math library by > default. The file hasn't changed, so I don't see how it would not. > -current as of 09/01 behaved the same way (gcc 2.6.3). Right. Older versions of gcc didn't explicitly link in the math library. I don't know why it's being done, but the GCC folks hopefully have some reason (or it's a bug). > Also, If I make > a "hello world" program and compile it with cc I get just the c library. If > I compile it with c++, I get the c, math, and the stdc++ libraries. (This is > as of 10/16 anyways). Right. This is on purpose, since apparently the stdc++ libraries are necessary for almost *any* C++ program you write. Even the hello world program (using streams) won't link w/out stdc++. The math library thing is a mystery though.... Nate