* Makefile.in: Move CFLAGS and CXXFLAGS so that they can be manipulated by

Makefile.common.  Add -static-libstdc++ to *LDFLAGS.  Add dependencies for
loadlib.h.
* loadlib.h: Update copyright.
(_load_sys_library): Properly define set_dll_library as WINAPI to avoid stack
corruption.
This commit is contained in:
Christopher Faylor 2012-11-28 03:22:36 +00:00
parent 66444a6b40
commit 29413f0630
3 changed files with 22 additions and 11 deletions

View File

@ -1,3 +1,12 @@
2012-11-27 Christopher Faylor <me.cygwin2012@cgf.cx>
* Makefile.in: Move CFLAGS and CXXFLAGS so that they can be manipulated
by Makefile.common. Add -static-libstdc++ to *LDFLAGS. Add
dependencies for loadlib.h.
* loadlib.h: Update copyright.
(_load_sys_library): Properly define set_dll_library as WINAPI to avoid
stack corruption.
2012-11-27 Christopher Faylor <me.cygwin2012@cgf.cx>
* Makefile.in (ZLIBS): Common define to force static load.

View File

@ -16,6 +16,10 @@ configure_args=@configure_args@
export CC:=@CC@
export CXX:=@CXX@
CFLAGS:=@CFLAGS@
CXXFLAGS:=@CXXFLAGS@
override CXXFLAGS+=-fno-exceptions -fno-rtti
include ${srcdir}/../Makefile.common
cygwin_build:=${target_builddir}/winsup/cygwin
@ -42,14 +46,10 @@ override INSTALL_DATA:=@INSTALL_DATA@
EXEEXT:=@EXEEXT@
EXEEXT_FOR_BUILD:=@EXEEXT_FOR_BUILD@
CFLAGS:=@CFLAGS@
CXXFLAGS:=@CXXFLAGS@
override CXXFLAGS+=-fno-exceptions -fno-rtti -DHAVE_DECL_GETOPT=0
.PHONY: all install clean realclean warn_dumper warn_cygcheck_zlib
LDLIBS := -lnetapi32 -ladvapi32 -lkernel32 -luser32
CYGWIN_LDFLAGS := -static-libgcc -Wl,--enable-auto-import -L${WINDOWS_LIBDIR} $(LDLIBS)
LDLIBS := -lnetapi32 -ladvapi32 -lkernel32 -luser32
CYGWIN_LDFLAGS := -static-libgcc -static-libstdc++ -Wl,--enable-auto-import -L${WINDOWS_LIBDIR} $(LDLIBS)
DEP_LDLIBS := $(cygwin_build)/libcygwin.a
MINGW_CXX := @MINGW_CXX@
@ -67,7 +67,7 @@ MINGW_BINS := ${addsuffix .exe,cygcheck cygwin-console-helper ldh strace}
# list will will be compiled in Cygwin mode implicitly, so there is no
# need for a CYGWIN_OBJS.
MINGW_OBJS := bloda.o cygcheck.o dump_setup.o ldh.o path.o strace.o
MINGW_LDFLAGS:=-L${WINDOWS_LIBDIR} -static-libgcc
MINGW_LDFLAGS:=-L${WINDOWS_LIBDIR} -static-libgcc -static-libstdc++
CYGCHECK_OBJS:=cygcheck.o bloda.o path.o dump_setup.o
ZLIB:=-Wl,-dn,-lz,-dy
@ -152,6 +152,8 @@ $(CYGWIN_BINS): %.exe: %.o
$(MINGW_BINS): $(DEP_LDLIBS)
$(CYGWIN_BINS): $(DEP_LDLIBS)
cygcheck.o cygpath.o module_info.o path.o ps.o regtool.o strace.o: loadlib.h
.PHONY: clean
clean:
rm -f *.o $(CYGWIN_BINS) $(MINGW_BINS) path-testsuite.cc testsuite.exe

View File

@ -1,6 +1,6 @@
/* loadlib.h
Copyright 2010, 2011 Red Hat, Inc.
Copyright 2010, 2011, 2012 Red Hat, Inc.
This file is part of Cygwin.
@ -23,7 +23,7 @@ static HMODULE _load_sys_library (const wchar_t *dll) __attribute__ ((used));
static HMODULE
_load_sys_library (const wchar_t *dll)
{
static BOOL (*set_dll_directory)(LPCWSTR);
static BOOL WINAPI (*set_dll_directory)(LPCWSTR);
static WCHAR sysdir[MAX_PATH];
static UINT sysdir_len;
@ -39,10 +39,10 @@ _load_sys_library (const wchar_t *dll)
{
HMODULE k32 = GetModuleHandleW (L"kernel32.dll");
if (k32)
set_dll_directory = (BOOL (*)(LPCWSTR))
set_dll_directory = (BOOL WINAPI (*)(LPCWSTR))
GetProcAddress (k32, "SetDllDirectoryW");
if (!set_dll_directory)
set_dll_directory = (BOOL (*)(LPCWSTR)) -1;
set_dll_directory = (BOOL WINAPI (*)(LPCWSTR)) -1;
else
set_dll_directory (L"");
}