Mail Archives: djgpp/2001/08/29/15:45:13
> 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 -