www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/08/29/15:45:13

Date: Wed, 29 Aug 2001 21:56:20 +0300
From: "Eli Zaretskii" <eliz AT is DOT elta DOT co DOT il>
Sender: halo1 AT zahav DOT net DOT il
To: wsr23 AT Stanford DOT EDU
Message-Id: <2427-Wed29Aug2001215619+0300-eliz@is.elta.co.il>
X-Mailer: Emacs 20.6 (via feedmail 8.3.emacs20_6 I) and Blat ver 1.8.9
CC: djgpp AT delorie DOT com
In-reply-to: <Pine.GSO.4.31.0108291102410.117-100000@elaine10.Stanford.EDU>
(message from Will Robinson on Wed, 29 Aug 2001 11:24:27 -0700 (PDT))
Subject: Re: linux->dos cross-compiler
References: <Pine DOT GSO DOT 4 DOT 31 DOT 0108291102410 DOT 117-100000 AT elaine10 DOT Stanford DOT EDU>
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

> Date: Wed, 29 Aug 2001 11:24:27 -0700 (PDT)
> From: Will Robinson <wsr23 AT Stanford DOT EDU>
> 
> [wsr23 AT dhcp-197-222 wsr23]$ gcc-dos -v
> Reading specs from /opt/djgpp/lib/gcc-lib/i586-pc-msdosdjgpp/3.0.1/specs

This looks okay, but what's the contents of this specs file?

Also, what does the compiler print under -v when it links a program?
I'm specifically looking for the -lfoo switches which it passes to the
linker.

> Also, if it makes any difference, know that I'm linking with an explicit
> "ld-dos" command line, not with gcc-dos itself.

Why don't you use gcc-dos?  That might be part of your problem.  In
any case, if you invoke the linker directly, you should mention there
crt0.o and the DJGPP linker script.  Otherwise the programs might not
link correctly.

> > Also, note that "-lc -lstdc++ -lgcc" is not what you need to put at
> > the end of the link command if GCC doesn't get that by itself.  The
> > correct list of libraries is "-lc -lgcc -lc" (yes, -lc should appear
> > twice, and in the order shown), and for C++ programs it should be
> > "-lstdc++ -lm -lc -lgcc -lc".
> 
> Wow!  I don't understand why that helped, but it did.

It helped because GNU ld is a one-pass linker: if libgcc.a needs
tolower, it won't find that because libc.a is before libgcc.a on the
command line you used.

This is why you generally should use gcc-dos to link: it will
automatically pass the libraries in correct order to the linker.

> /opt/djgpp/i586-pc-msdosdjgpp/lib/libgcc.a(unwind-dw2-fde.o): In function
> `read_encoded_value_with_base':
> unwind-dw2-fde.c:211: multiple definition of `__register_frame_info'
> /opt/djgpp/i586-pc-msdosdjgpp/lib/libc.a(rfinfo.o)(.text+0x0):rfinfo.c:
> first defined here

Sorry, my bad: you should say "-lstdc++ -lm -lgcc -lc -lgcc".

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019