bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SEGV in ld on Cygwin


From: Eric Hanchrow
Subject: SEGV in ld on Cygwin
Date: Tue, 29 Apr 2003 12:33:40 -0700

GNU ld version 2.13.90 20030308

I'm trying to create a Perl module from a DLL, but the linker is
crashing.  Here's a command line that provokes the crash:

        ./ld \
        --shared \
        -Bdynamic \
        -e \
        address@hidden \
        --dll-search-prefix=cyg \
        -o \
        VHTI.dll \
        -s \
        /bin/../lib/gcc-lib/i686-pc-cygwin/3.2/crtbegin.o \
        -L/usr/local/lib \
        -L/bin/../lib/gcc-lib/i686-pc-cygwin/3.2 \
        -L/bin/../lib/gcc-lib \
        -L/usr/lib/gcc-lib/i686-pc-cygwin/3.2 \
        -L/bin/../lib/gcc-lib/i686-pc-cygwin/3.2/../../.. \
        -L/usr/lib/gcc-lib/i686-pc-cygwin/3.2/../../.. \
        --out-implib=libVHTI.dll.a \
        --export-all-symbols \
        --enable-auto-import \
        --stack \
        8388608 \
        VHTI.o \
        ../vhti_internal/src/vhti_dll/Debug/vhti_dll.dll \
        /usr/lib/perl5/5.8.0/cygwin-multi-64int/CORE/libperl.dll.a \
        -lgcc \
        -lcygwin \
        -luser32 \
        -lkernel32 \
        -ladvapi32 \
        -lshell32 \
        -lgcc \
        /bin/../lib/gcc-lib/i686-pc-cygwin/3.2/crtend.o

(Unfortunately I have not been able to find a simpler command line, or
simpler input files, that also reproduce the problem.)

(If it matters, I found this command line by noting the way that Perl
invoked gcc, and then re-invoking gcc the same way, but with the
`--verbose' switch added.)

The file VHTI.o was created by Cygwin gcc, whereas vhti_dll.dll was
created by Microsoft Visual Studio 6.

I was able to get a stack trace:

    (gdb) bt
    #0  0x610ba1fd in strncmp () from /usr/bin/cygwin1.dll
    #1  0x004374e5 in pe_implied_import_dll (filename=0x22f8e0
"/g/brunch/development/vhti_internal/src/vhti_dll/Debug/vhti_dll.dll") at
pe-dll.c:2634
    #2  0x0042aeae in gld_i386pe_recognized_file (entry=0xa0424c0) at
ei386pe.c:1388
    #3  0x00423e34 in ldemul_recognized_file (entry=0xa0424c0) at
ldemul.c:189
    #4  0x00415b82 in load_symbols (entry=0xa0424c0, place=0x22fa68) at
ldlang.c:1591
    #5  0x00416807 in open_input_bfds (s=0xa0424c0, force=0) at
ldlang.c:2050
    #6  0x0041a6ef in lang_process () at ldlang.c:4291
    #7  0x0041e2de in main (argc=32, argv=0xa042230) at ldmain.c:455
    (gdb) 

Unfortunately I don't understand how the linker works, so debugging it
is very slow going.  All I've found so far is that
pe_implied_import_dll assigns the value 0 to the variable export_size,
which seems suspicious, since it later mallocs that many (i.e., 0)
bytes.

Oddly, this crash doesn't always happen; once in a while the link
completes, and the linked binary appears to function properly.

I will continue to try to debug it, but would be glad of any help.  I
am willing to provide the binaries that are triggering the problem, if
that would be useful.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]