dlopen regression in 1.7? (or is it just me?)

Peter Rosin peda@lysator.liu.se
Tue Aug 11 16:58:00 GMT 2009


Hi!

I trouble with dlopen in cygwin-1.7

STC:

$ cat simple.c
int
simple(void)
{
         return 0;
}
$ libtool --tag=CC --mode=compile gcc -c -o simple.lo simple.c
libtool: compile:  gcc -c simple.c  -DDLL_EXPORT -DPIC -o .libs/simple.o
libtool: compile:  gcc -c simple.c -o simple.o >/dev/null 2>&1
$ libtool --tag=CC --mode=link gcc -export-symbols-regex simple -shared -module -avoid-version -no-undefined -rpath /nowhere -o simple1.la simple.lo
libtool: link: rm -fr  .libs/simple1.dll .libs/simple1.dll.a .libs/simple1.dll.def .libs/simple1.exp .libs/simple1.la .libs/simple1.lai
libtool: link: /usr/bin/nm -B  .libs/simple.o   | sed -n -e 's/^.*[      ]\([ABCDGIRSTW][ABCDGIRSTW]*\)[         ][      ]*_\([_A-Za-z][_A-Za-z0-9]*\)$/\1 _\2 \2/p' | /usr/bin/sed -e '/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //' | 
sort | uniq > .libs/simple1.exp
libtool: link: /usr/bin/grep -E -e "simple" ".libs/simple1.exp" > ".libs/simple1.expT"
libtool: link: mv -f ".libs/simple1.expT" ".libs/simple1.exp"
libtool: link: if test "x`/usr/bin/sed 1q .libs/simple1.exp`" = xEXPORTS; then cp .libs/simple1.exp .libs/simple1.dll.def; else echo EXPORTS > .libs/simple1.dll.def; cat .libs/simple1.exp >> .libs/simple1.dll.def; fi
libtool: link:  gcc -shared .libs/simple1.dll.def  .libs/simple.o      -o .libs/simple1.dll -Wl,--enable-auto-image-base -Xlinker --out-implib -Xlinker .libs/simple1.dll.a
Creating library file: .libs/simple1.dll.a
libtool: link: ( cd ".libs" && rm -f "simple1.la" && ln -s "../simple1.la" "simple1.la" )
$ libtool --tag=CC --mode=link gcc -export-symbols-regex simple -shared -module -avoid-version -no-undefined -rpath /nowhere -o simple2.la simple.lo
libtool: link: rm -fr  .libs/simple2.dll .libs/simple2.dll.a .libs/simple2.dll.def .libs/simple2.exp .libs/simple2.la .libs/simple2.lai
libtool: link: /usr/bin/nm -B  .libs/simple.o   | sed -n -e 's/^.*[      ]\([ABCDGIRSTW][ABCDGIRSTW]*\)[         ][      ]*_\([_A-Za-z][_A-Za-z0-9]*\)$/\1 _\2 \2/p' | /usr/bin/sed -e '/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //' | 
sort | uniq > .libs/simple2.exp
libtool: link: /usr/bin/grep -E -e "simple" ".libs/simple2.exp" > ".libs/simple2.expT"
libtool: link: mv -f ".libs/simple2.expT" ".libs/simple2.exp"
libtool: link: if test "x`/usr/bin/sed 1q .libs/simple2.exp`" = xEXPORTS; then cp .libs/simple2.exp .libs/simple2.dll.def; else echo EXPORTS > .libs/simple2.dll.def; cat .libs/simple2.exp >> .libs/simple2.dll.def; fi
libtool: link:  gcc -shared .libs/simple2.dll.def  .libs/simple.o      -o .libs/simple2.dll -Wl,--enable-auto-image-base -Xlinker --out-implib -Xlinker .libs/simple2.dll.a
Creating library file: .libs/simple2.dll.a
libtool: link: ( cd ".libs" && rm -f "simple2.la" && ln -s "../simple2.la" "simple2.la" )
$ cat reload.c
#include <stdio.h>
#include <dlfcn.h>

int
main(void)
{
         void *one;
         void *two;

         one = dlopen(".libs/simple1.dll", RTLD_NOW);
         two = dlopen(".libs/simple2.dll", RTLD_NOW);
         printf("one %p, two %p\n", one, two);
         if (one)
                 dlclose(one);
         if (two)
                 dlclose(two);

         one = dlopen(".libs/simple1.dll", RTLD_NOW);
         two = dlopen(".libs/simple2.dll", RTLD_NOW);
         printf("one %p, two %p\n", one, two);
         if (one)
                 dlclose(one);
         if (two)
                 dlclose(two);

         return 0;
}
$ gcc -o reload reload.c
$ ./reload
one 0x63d80000, two 0x6ffc0000
one 0x0, two 0x6ffc0000

I get the same with
/usr/sbin/alternatives --set gcc /usr/bin/gcc-3.exe
as with
/usr/sbin/alternatives --set gcc /usr/bin/gcc-4.exe

Cheers,
Peter
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: cygcheck.txt
URL: <http://cygwin.com/pipermail/cygwin/attachments/20090811/59a04961/attachment.txt>
-------------- next part --------------
--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


More information about the Cygwin mailing list