This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Linking with -lkernel32 [was: Re: beta18: building gdb gives incomplete import table [and other problems]???]


At 12:34 31-12-1997 +1100, Fergus Henderson wrote:
>...
>One bug with the linker that has been mentioned on this list previously
>is that if the same library name is mentioned twice on the link line,
>then the linker generates executables that crash.  `-lkernel32' is
>linked in by default, so if you mention it explicitly then it will
>get linked in twice, causing the symptoms you observed.
>
>-- 
>Fergus Henderson <fjh@cs.mu.oz.au>   |  "I have always known that the pursuit
>WWW: <http://www.cs.mu.oz.au/~fjh>   |  of excellence is a lethal habit"
>PGP: finger fjh@128.250.37.3         |     -- the last words of T. S. Garp.

I can't successfully link DLLs (relocatable or non-relocatable) if I don't
include:
   -lc -lcygwin -lkernel32 -lc

Also, this is somewhat consistent with your Makefile.DLLs, an excerpt of
which I pasted next:
(...)
# The `sed' commands below are to convert DOS-style `C:\foo\bar'
# pathnames into Unix-style `//c/foo/bar' pathnames.
CYGWIN32_LIBS = $(shell echo                                    \
        -L`dirname \`gcc -print-file-name=libgcc.a |            \
        sed -e 's@^\\\\([A-Za-z]\\\\):@//\\\\1@g' -e 's@\\\\\\\\@/@g' \` ` \
        -L`dirname \`gcc -print-file-name=libcygwin.a | \
        sed -e 's@^\\\\([A-Za-z]\\\\):@//\\\\1@g' -e 's@\\\\\\\\@/@g' \` ` \
        -L`dirname \`gcc -print-file-name=libkernel32.a | \
        sed -e 's@^\\\\([A-Za-z]\\\\):@//\\\\1@g' -e 's@\\\\\\\\@/@g' \` ` \
        -lgcc -lcygwin -lkernel32 -lgcc)

# Making relocatable DLLs doesn't seem to work.
# Note quite sure why.  The --image-base values below
# where chosen at random, they seem to work on my machine.
RELOCATABLE=no
LDFLAGS-libgc +=        --image-base=0x2345000
LDFLAGS-libmer +=       --image-base=0x1234000
LDFLAGS-libmercury +=   --image-base=0x3456000

ifeq "$(strip $(RELOCATABLE))" "yes"

# to create relocatable DLLs, we need to do two passes
# (warning: this is untested)
%.dll: %.exp %.a %_dll.o dll_init.o dll_fixup.o
        $(LD) $(LDFLAGS) $(LDFLAGS-$*) --dll -o $*.base                 \
                -e _dll_entry@12                                        \
                $*.exp $*.a $*_dll.o                                    \
                dll_init.o dll_fixup.o                                  \
                $(LDLIBS) $(LDLIBS-$*)                                  \
                $(CYGWIN32_LIBS)
(...)

If I understand correctly, you use "-lgcc -lcygwin -lkernel32 -lgcc" among
other obvious things.
So, should we, or should we not repeat libs?
By the way, is there a description of the available libs and their contents?

--
JPSousa
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]