all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Emacs 21.2 uses ld instead of gcc for linking
@ 2002-04-11 18:31 Paul Jarc
  2002-04-12  6:51 ` Eli Zaretskii
  0 siblings, 1 reply; 4+ messages in thread
From: Paul Jarc @ 2002-04-11 18:31 UTC (permalink / raw)


I'm using gcc 3.0.4, binutils 2.12, and RedHat's glibc 2.2.4-19.3.

Emacs 21.2's build process uses ld for linking in some cases and gcc
for others.  This limits the usefulness of user-specified LDFLAGS: ld
does not understand -Wl, options, and gcc does not understand most ld
options.

There are also some things that ld does wrong when invoked directly
instead of via gcc: my gcc is installed with its own unusual prefix,
so ld cannot find libgcc unless I specify the path with -L in LDFLAGS.

ld also seems to use the wrong path for the dynamic linker; the
symptom was:
LC_ALL=C ./temacs -batch -l loadup dump
/bin/sh: ./temacs: No such file or directory
temacs did exist, but the dynamic linker path compiled into it was
/usr/lib/libc.so.1, which does not exist on my system.  I had to
create it as a symlink to /lib/ld-linux.so.2.

It seems to me gcc should be used for linking in all cases.


paul

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Emacs 21.2 uses ld instead of gcc for linking
  2002-04-11 18:31 Emacs 21.2 uses ld instead of gcc for linking Paul Jarc
@ 2002-04-12  6:51 ` Eli Zaretskii
  2002-04-12 15:52   ` Paul Jarc
  0 siblings, 1 reply; 4+ messages in thread
From: Eli Zaretskii @ 2002-04-12  6:51 UTC (permalink / raw)
  Cc: bug-gnu-emacs

> From: prj@po.cwru.edu (Paul Jarc)
> Newsgroups: gnu.emacs.bug
> Date: Thu, 11 Apr 2002 14:31:58 -0400
> 
> I'm using gcc 3.0.4, binutils 2.12, and RedHat's glibc 2.2.4-19.3.
> 
> Emacs 21.2's build process uses ld for linking in some cases and gcc
> for others.

This shouldn't happen: in a normal link, src/Makefile.in defines
either LD=$(CC) or LD="$(CC) -nostdlib", AFAICS.  This works either
automatically or because your src/s/OS.h file defines ORDINARY_LINK.

So please try to find out why in your case LD was defined to `ld'
instead.

> It seems to me gcc should be used for linking in all cases.

Sure; and it does for me (but I don't have Red Hat).

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Emacs 21.2 uses ld instead of gcc for linking
  2002-04-12  6:51 ` Eli Zaretskii
@ 2002-04-12 15:52   ` Paul Jarc
  2002-04-12 18:49     ` Eli Zaretskii
  0 siblings, 1 reply; 4+ messages in thread
From: Paul Jarc @ 2002-04-12 15:52 UTC (permalink / raw)


"Eli Zaretskii" <eliz@is.elta.co.il> wrote:
> From prj@po.cwru.edu (Paul Jarc)
>> Emacs 21.2's build process uses ld for linking in some cases and gcc
>> for others.
>
> This shouldn't happen: in a normal link, src/Makefile.in defines
> either LD=$(CC) or LD="$(CC) -nostdlib", AFAICS.  This works either
> automatically or because your src/s/OS.h file defines ORDINARY_LINK.

src/s/gnu-linux.h does not mention any of ORDINARY_LINK,
COFF_ENCAPSULATE, or LINKER.  Should it?  "cpp Makefile.in" produces
"LD=ld", though I don't know any way to make it show *how* it produced
that.  Where should I look next?


paul

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Emacs 21.2 uses ld instead of gcc for linking
  2002-04-12 15:52   ` Paul Jarc
@ 2002-04-12 18:49     ` Eli Zaretskii
  0 siblings, 0 replies; 4+ messages in thread
From: Eli Zaretskii @ 2002-04-12 18:49 UTC (permalink / raw)
  Cc: bug-gnu-emacs

> From: prj@po.cwru.edu (Paul Jarc)
> Newsgroups: gnu.emacs.bug
> Date: Fri, 12 Apr 2002 11:52:29 -0400
> 
> > This shouldn't happen: in a normal link, src/Makefile.in defines
> > either LD=$(CC) or LD="$(CC) -nostdlib", AFAICS.  This works either
> > automatically or because your src/s/OS.h file defines ORDINARY_LINK.
> 
> src/s/gnu-linux.h does not mention any of ORDINARY_LINK,
> COFF_ENCAPSULATE, or LINKER.  Should it?

No, I don't think so, because of this part:

    /* Fix linking if compiled with GCC.  */
    #ifdef __GNUC__

    #if __GNUC__ > 1

    #ifdef LINKER
    #define LINKER_WAS_SPECIFIED
    #endif

    /* Versions of GCC >= 2.0 put their library, libgcc.a, in obscure
       places that are difficult to figure out at make time.  Fortunately,
       these same versions allow you to pass arbitrary flags on to the
       linker, so there's no reason not to use it as a linker.

       Well, it's not quite perfect.  The `-nostdlib' keeps GCC from
       searching for libraries in its internal directories, so we have to
       ask GCC explicitly where to find libgcc.a.  */

    #ifndef LINKER
    #define LINKER $(CC) -nostdlib
    #endif

> "cpp Makefile.in" produces "LD=ld", though I don't know any way to
> make it show *how* it produced that.  Where should I look next?

I guess you should try to figure out why doesn't the above snippet
work for you.

FWIW, on a Debian GNU/Linux system, I get "LD= ${CC} -nostdlib".

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2002-04-12 18:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-04-11 18:31 Emacs 21.2 uses ld instead of gcc for linking Paul Jarc
2002-04-12  6:51 ` Eli Zaretskii
2002-04-12 15:52   ` Paul Jarc
2002-04-12 18:49     ` Eli Zaretskii

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.