Subject: Re: Building emacs 20.2 fails while linking
To: None <>
From: Todd Vierling <tv@NetBSD.ORG>
List: current-users
Date: 04/06/1998 08:52:26
On Sun, 5 Apr 1998 wrote:

: > It's just doing its job correctly:
: > 
: >      -nostdlib
: >              Do not search the built-in path (usually ``/usr/lib'') for -l
: >              specified libraries.

Note that this is from ld(1), not gcc(1).

: > There was discussion about this some time ago on one of the lists, and
: > the most recent version of pkgsrc-current (Mar 16'th) includes a patch
: > for emacs that does approximately as you did (adjusts src/ to
: > contain: "#define LD_SWITCH_SYSTEM_TEMACS -L/usr/lib").

It took me a moment to realize what was going on with emacs, because NO
PACKAGE SHOULD BE USING -nostdlib unless it is making standalone programs
(boot PROMS, etc.).  What it seems to me is that emacs doesn't want
-nostdlib:  it should actually be using -nostartfiles (which does not
include crt0.o just like -nostdlib, but does not restrict the library search
path or leave out -lc).  I'll change this in my local pkgsrc, test, and

: gcc.1 states:
:    .B \-nostdlib
:    Don't use the standard system libraries and startup files when linking.
:    Only the files you specify will be passed to the linker.
: To me this is not explicitly indicating that the library search path is changed,
: only that the default libraries are not included. If the intention is to not
: search /usr/lib unless mentioned in a -L/usr/lib parameter, the man page should
: be updated.

I'll update the page to indicate that the option is passed to ld.  (You can
then look at ld(1) to find out what ld does with it.)

: Secondly: It is still my experience that this behaviour has changed, and I'd
: like a confirmation of to this question.

Yes, it changed between 1.2 and 1.3.  The ``standard'' (read: built from GNU
sources) gcc setup passes this option to ld as part of its ``LINK_SPEC''; we
just changed to do the same thing. 

: then noticed the same problem with the latest release
: of Emacs, i.e. 20.2, and I would prefer to be able to tell RMS that on
: post 1.3 versions of NetBSD, -nostdlib requires a -L/usr/lib

-nostdlib does require a -L/usr/lib if you are going to link with system
libraries, but if you're using -nostdlib for the sole purpose of leaving out
crt0.o, you are broken and should be using -nostartfiles instead.

-- Todd Vierling (Personal; Bus.