diff options
-rw-r--r-- | lldb/test/lang/c/shared_lib/foo.h | 6 | ||||
-rw-r--r-- | lldb/test/lldbtest.py | 2 | ||||
-rw-r--r-- | lldb/test/make/Makefile.rules | 36 | ||||
-rw-r--r-- | lldb/test/make/test_common.h | 19 | ||||
-rw-r--r-- | lldb/test/make/uncaught_exception.h | 5 | ||||
-rw-r--r-- | lldb/test/plugins/builder_base.py | 6 |
6 files changed, 51 insertions, 23 deletions
diff --git a/lldb/test/lang/c/shared_lib/foo.h b/lldb/test/lang/c/shared_lib/foo.h index 78b3c124538..78b9e3f9c0d 100644 --- a/lldb/test/lang/c/shared_lib/foo.h +++ b/lldb/test/lang/c/shared_lib/foo.h @@ -6,7 +6,5 @@ struct sub_foo char *sub_2; }; -struct foo *GetMeAFoo(); -struct sub_foo *GetMeASubFoo (struct foo *in_foo); - - +LLDB_TEST_API struct foo *GetMeAFoo(); +LLDB_TEST_API struct sub_foo *GetMeASubFoo(struct foo *in_foo); diff --git a/lldb/test/lldbtest.py b/lldb/test/lldbtest.py index 714df941423..71fb031f493 100644 --- a/lldb/test/lldbtest.py +++ b/lldb/test/lldbtest.py @@ -1509,7 +1509,7 @@ class Base(unittest2.TestCase): 'FRAMEWORK_INCLUDES' : "-F%s" % self.lib_dir, 'LD_EXTRAS' : "%s -Wl,-rpath,%s -dynamiclib" % (dsym, self.lib_dir), } - elif sys.platform.startswith('freebsd') or sys.platform.startswith("linux") or os.environ.get('LLDB_BUILD_TYPE') == 'Makefile': + elif sys.platform.startswith('freebsd') or sys.platform.startswith("linux") or sys.platform.startswith("win") or os.environ.get('LLDB_BUILD_TYPE') == 'Makefile': d = {'DYLIB_CXX_SOURCES' : sources, 'DYLIB_NAME' : lib_name, 'CFLAGS_EXTRAS' : "%s -I%s -fPIC" % (stdflag, os.path.join(os.environ["LLDB_SRC"], "include")), diff --git a/lldb/test/make/Makefile.rules b/lldb/test/make/Makefile.rules index c0356c94a7e..886698a9c2d 100644 --- a/lldb/test/make/Makefile.rules +++ b/lldb/test/make/Makefile.rules @@ -118,6 +118,7 @@ endif CFLAGS ?= -g -O0 CFLAGS += $(ARCHFLAG)$(ARCH) $(FRAMEWORK_INCLUDES) $(CFLAGS_EXTRAS) -I$(LLDB_BASE_DIR)include +CFLAGS += -include $(THIS_FILE_DIR)test_common.h # Use this one if you want to build one part of the result without debug information: CFLAGS_NO_DEBUG = -O0 $(ARCHFLAG)$(ARCH) $(FRAMEWORK_INCLUDES) $(CFLAGS_EXTRAS) @@ -152,6 +153,8 @@ EXE ?= a.out ifneq "$(DYLIB_NAME)" "" ifeq "$(OS)" "Darwin" DYLIB_FILENAME = lib$(DYLIB_NAME).dylib + else ifeq "$(OS)" "Windows_NT" + DYLIB_FILENAME = $(DYLIB_NAME).dll else DYLIB_FILENAME = lib$(DYLIB_NAME).so endif @@ -188,7 +191,6 @@ ifeq "$(OS)" "Windows_NT" ifneq (,$(findstring clang,$(CC))) # Clang for Windows doesn't support C++ Exceptions CXXFLAGS += -fno-exceptions - CXXFLAGS += -include $(THIS_FILE_DIR)uncaught_exception.h CXXFLAGS += -D_HAS_EXCEPTIONS=0 # The MSVC linker doesn't understand long section names # generated by the clang compiler. @@ -377,6 +379,8 @@ endif #---------------------------------------------------------------------- # Make the dylib #---------------------------------------------------------------------- +$(DYLIB_OBJECTS) : CFLAGS += -DCOMPILING_LLDB_TEST_DLL + $(DYLIB_FILENAME) : $(DYLIB_OBJECTS) ifeq "$(OS)" "Darwin" $(LD) $(LDFLAGS) $(DYLIB_OBJECTS) -install_name "@executable_path/$(DYLIB_FILENAME)" -dynamiclib -o "$(DYLIB_FILENAME)" @@ -395,7 +399,7 @@ endif #---------------------------------------------------------------------- # Automatic variables based on items already entered. Below we create -# an objects lists from the list of sources by replacing all entries +# an object's lists from the list of sources by replacing all entries # that end with .c with .o, and we also create a list of prerequisite # files by replacing all .c files with .d. #---------------------------------------------------------------------- @@ -409,28 +413,36 @@ endif # the compiler -MM option. The -M option will list all system headers, # and the -MM option will list all non-system dependencies. #---------------------------------------------------------------------- +ifeq "$(OS)" "Windows_NT" + JOIN_CMD = & + QUOTE = " +else + JOIN_CMD = ; + QUOTE = ' +endif + %.d: %.c - @rm -f $@; \ + @rm -f $@ $(JOIN_CMD) \ $(CC) -M $(CFLAGS) $< > $@.tmp && \ - sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.tmp > $@; \ + sed $(QUOTE)s,\($*\)\.o[ :]*,\1.o $@ : ,g$(QUOTE) < $@.tmp > $@ $(JOIN_CMD) \ rm -f $@.tmp %.d: %.cpp - @rm -f $@; \ + @rm -f $@ $(JOIN_CMD) \ $(CXX) -M $(CXXFLAGS) $< > $@.tmp && \ - sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.tmp > $@; \ + sed $(QUOTE)s,\($*\)\.o[ :]*,\1.o $@ : ,g$(QUOTE) < $@.tmp > $@ $(JOIN_CMD) \ rm -f $@.tmp %.d: %.m - @rm -f $@; \ + @rm -f $@ $(JOIN_CMD) \ $(CC) -M $(CFLAGS) $< > $@.tmp && \ - sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.tmp > $@; \ + sed $(QUOTE)s,\($*\)\.o[ :]*,\1.o $@ : ,g$(QUOTE) < $@.tmp > $@ $(JOIN_CMD) \ rm -f $@.tmp %.d: %.mm - @rm -f $@; \ + @rm -f $@ $(JOIN_CMD) \ $(CXX) -M $(CXXFLAGS) $< > $@.tmp && \ - sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.tmp > $@; \ + sed $(QUOTE)s,\($*\)\.o[ :]*,\1.o $@ : ,g$(QUOTE) < $@.tmp > $@ $(JOIN_CMD) \ rm -f $@.tmp #---------------------------------------------------------------------- @@ -461,6 +473,10 @@ ifneq "$(DSYM)" "" endif ifeq "$(OS)" "Windows_NT" $(RM) "$(EXE).manifest" $(wildcard *.pdb *.ilk) + ifneq "$(DYLIB_NAME)" "" + $(RM) $(DYLIB_FILENAME).manifest + $(RM) $(DYLIB_NAME).lib $(DYLIB_NAME).exp + endif endif #---------------------------------------------------------------------- diff --git a/lldb/test/make/test_common.h b/lldb/test/make/test_common.h new file mode 100644 index 00000000000..6f819706366 --- /dev/null +++ b/lldb/test/make/test_common.h @@ -0,0 +1,19 @@ +// This header is included in all the test programs (C and C++) and provides a
+// hook for dealing with platform-specifics.
+#if defined(_WIN32) || defined(_WIN64)
+#ifdef COMPILING_LLDB_TEST_DLL
+#define LLDB_TEST_API __declspec(dllexport)
+#else
+#define LLDB_TEST_API __declspec(dllimport)
+#endif
+#else
+#define LLDB_TEST_API
+#endif
+
+#if defined(__cplusplus) && defined(_MSC_VER) && (_HAS_EXCEPTIONS == 0)
+// Compiling MSVC libraries with _HAS_EXCEPTIONS=0, eliminates most but not all
+// calls to __uncaught_exception. Unfortunately, it does seem to eliminate
+// the delcaration of __uncaught_excpeiton. Including <eh.h> ensures that it is
+// declared. This may not be necessary after MSVC 12.
+#include <eh.h>
+#endif
diff --git a/lldb/test/make/uncaught_exception.h b/lldb/test/make/uncaught_exception.h deleted file mode 100644 index 2d5d964e992..00000000000 --- a/lldb/test/make/uncaught_exception.h +++ /dev/null @@ -1,5 +0,0 @@ -// MSVC header files have compilation issues when compiling with exceptions disabled. Notably, -// this function is compiled out when _HAS_EXCEPTIONS=0, but this function is called from another -// place even when _HAS_EXCEPTIONS=0. So we define a dummy implementation as a workaround and -// force include this header file. -static void *__uncaught_exception() { return nullptr; } diff --git a/lldb/test/plugins/builder_base.py b/lldb/test/plugins/builder_base.py index 0ecce3d18db..26589273c43 100644 --- a/lldb/test/plugins/builder_base.py +++ b/lldb/test/plugins/builder_base.py @@ -12,7 +12,7 @@ Same idea holds for LLDB_ARCH environment variable, which maps to the ARCH make variable. """ -import os +import os, sys import platform import lldbtest @@ -78,8 +78,8 @@ def getCmdLine(d): # If d is None or an empty mapping, just return an empty string. if not d: return "" - - cmdline = " ".join(["%s='%s'" % (k, v) for k, v in d.items()]) + pattern = '%s="%s"' if "win32" in sys.platform else "%s='%s'" + cmdline = " ".join([pattern % (k, v) for k, v in d.items()]) return cmdline |