From: Ivan Maidanski Date: Fri, 26 Jul 2019 18:35:30 +0000 (+0300) Subject: Fix test_cpp failure caused by arbitrary link order (Win32) X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f5e4d83800cc43b0874a6ceccd686a597b64d443;p=gc Fix test_cpp failure caused by arbitrary link order (Win32) (fix of commit 4a08ae983) * Makefile.direct (test_cpp): Pass -D GC_NOT_DLL to $(CC) (except for HP UX case). * configure.ac [($enable_shared=no || $enable_static=yes) && $host=*-*-cygwin*|*-*-mingw*|*-*-msys*] (CXXFLAGS): Add -D GC_NOT_DLL; add comment. --- diff --git a/Makefile.direct b/Makefile.direct index 8e6d9f41..9c3c078a 100644 --- a/Makefile.direct +++ b/Makefile.direct @@ -229,7 +229,7 @@ test_cpp$(EXEEXT): $(srcdir)/tests/test_cpp.cc $(srcdir)/include/gc_cpp.h \ $(srcdir)/include/gc.h c++ base_lib $(UTILS) rm -f test_cpp$(EXEEXT) ./if_mach HP_PA HPUX $(CXX) $(CXXFLAGS) -o test_cpp $(srcdir)/tests/test_cpp.cc gc.a gccpp.a -ldld `./threadlibs` - ./if_not_there test_cpp$(EXEEXT) || $(CXX) $(CXXFLAGS) -o test_cpp$(EXEEXT) $(srcdir)/tests/test_cpp.cc gc.a gccpp.a `./threadlibs` + ./if_not_there test_cpp$(EXEEXT) || $(CXX) $(CXXFLAGS) -DGC_NOT_DLL -o test_cpp$(EXEEXT) $(srcdir)/tests/test_cpp.cc gc.a gccpp.a `./threadlibs` check-cpp: test_cpp$(EXEEXT) ./test_cpp diff --git a/configure.ac b/configure.ac index 5720f220..1625cbd3 100644 --- a/configure.ac +++ b/configure.ac @@ -554,6 +554,10 @@ else # Do not require the clients to link with "user32" system library. AC_DEFINE([DONT_USE_USER32_DLL], 1, [Do not use user32.dll import library (Win32).]) + # Use inline version of GC new and delete operators in test_cpp + # otherwise the system ones might be used instead because of arbitrary + # ordering of object files when linking. + CXXFLAGS="$CXXFLAGS -DGC_NOT_DLL" ;; esac fi