]> granicus.if.org Git - postgresql/commitdiff
MinGW: Include .dll extension in .def file LIBRARY commands.
authorNoah Misch <noah@leadboat.com>
Mon, 27 Oct 2014 23:59:39 +0000 (19:59 -0400)
committerNoah Misch <noah@leadboat.com>
Mon, 27 Oct 2014 23:59:52 +0000 (19:59 -0400)
Newer toolchains append the extension implicitly if missing, but
buildfarm member narwhal (gcc 3.4.2, ld 2.15.91 20040904) does not.
This affects most core libraries having an exports.txt file, namely
libpq and the ECPG support libraries.  On Windows Server 2003, Windows
API functions that load and unload DLLs internally will mistakenly
unload a libpq whose DLL header reports "LIBPQ" instead of "LIBPQ.dll".
When, subsequently, control would return to libpq, the backend crashes.
Back-patch to 9.4, like commit 846e91e0223cf9f2821c3ad4dfffffbb929cb027.
Before that commit, we used a different linking technique that yielded
"libpq.dll" in the DLL header.

Commit 53566fc0940cf557416b13252df57350a4511ce4 worked around this by
eliminating a call to a function that loads and unloads DLLs internally.
That commit is no longer necessary for correctness, but its improving
consistency with the MSVC build remains valid.

src/Makefile.shlib

index 8a571ba48960822e6f17ac7d930123d6f19b76a8..0ebb767e82557eae512c83976cf6f8c5749767bf 100644 (file)
@@ -427,13 +427,13 @@ UC_NAME = $(shell echo $(NAME) | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMN
 
 lib$(NAME)dll.def: $(SHLIB_EXPORTS)
        echo '; DEF file for MS VC++' >$@
-       echo 'LIBRARY LIB$(UC_NAME)' >>$@
+       echo 'LIBRARY LIB$(UC_NAME).dll' >>$@
        echo 'EXPORTS' >>$@
        sed -e '/^#/d' -e 's/^\(.*[     ]\)\([0-9][0-9]*\)/    \1@ \2/' $< >>$@
 
 lib$(NAME)ddll.def: $(SHLIB_EXPORTS)
        echo '; DEF file for MS VC++' >$@
-       echo 'LIBRARY LIB$(UC_NAME)D' >>$@
+       echo 'LIBRARY LIB$(UC_NAME)D.dll' >>$@
        echo 'EXPORTS' >>$@
        sed -e '/^#/d' -e 's/^\(.*[     ]\)\([0-9][0-9]*\)/    \1@ \2/' $< >>$@