diff options
Diffstat (limited to 'packages/Python/lldbsuite/test/make')
-rw-r--r-- | packages/Python/lldbsuite/test/make/Makefile.rules | 37 | ||||
-rw-r--r-- | packages/Python/lldbsuite/test/make/test_common.h | 42 |
2 files changed, 74 insertions, 5 deletions
diff --git a/packages/Python/lldbsuite/test/make/Makefile.rules b/packages/Python/lldbsuite/test/make/Makefile.rules index e753317e9398..c37ef745e8b4 100644 --- a/packages/Python/lldbsuite/test/make/Makefile.rules +++ b/packages/Python/lldbsuite/test/make/Makefile.rules @@ -168,6 +168,10 @@ else override ARCH := override ARCHFLAG := endif + ifeq "$(ARCH)" "s390x" + override ARCH := + override ARCHFLAG := + endif ifeq "$(findstring mips,$(ARCH))" "mips" override ARCHFLAG := - endif @@ -179,9 +183,11 @@ endif LIMIT_DEBUG_INFO_FLAGS = NO_LIMIT_DEBUG_INFO_FLAGS = +MODULE_DEBUG_INFO_FLAGS = ifneq (,$(findstring clang,$(CC))) LIMIT_DEBUG_INFO_FLAGS += -flimit-debug-info NO_LIMIT_DEBUG_INFO_FLAGS += -fno-limit-debug-info + MODULE_DEBUG_INFO_FLAGS += -gmodules endif DEBUG_INFO_FLAG ?= -g @@ -206,8 +212,13 @@ ifeq "$(MAKE_DWO)" "YES" CFLAGS += -gsplit-dwarf endif +ifeq "$(MAKE_GMODULES)" "YES" + CFLAGS += -fmodules -gmodules +endif + CXXFLAGS += -std=c++11 -CXXFLAGS += $(CFLAGS) +# FIXME: C++ modules aren't supported on all platforms. +CXXFLAGS += $(subst -fmodules,, $(CFLAGS)) LD = $(CC) LDFLAGS ?= $(CFLAGS) LDFLAGS += $(LD_EXTRAS) @@ -300,7 +311,7 @@ endif ifeq (1,$(USE_LIBSTDCPP)) # Clang requires an extra flag: -stdlib=libstdc++ ifneq (,$(findstring clang,$(CC))) - CXXFLAGS += -stdlib=libstdc++ + CXXFLAGS += -stdlib=libstdc++ -DLLDB_USING_LIBSTDCPP LDFLAGS += -stdlib=libstdc++ endif endif @@ -340,6 +351,14 @@ ifneq "$(strip $(DYLIB_CXX_SOURCES))" "" endif #---------------------------------------------------------------------- +# Check if we have a precompiled header +#---------------------------------------------------------------------- +ifneq "$(strip $(PCH_CXX_SOURCE))" "" + PCH_OUTPUT = $(PCH_CXX_SOURCE:.h=.h.pch) + PCHFLAGS = -include $(PCH_CXX_SOURCE) +endif + +#---------------------------------------------------------------------- # Check if we have any C source files #---------------------------------------------------------------------- ifneq "$(strip $(C_SOURCES))" "" @@ -498,6 +517,17 @@ endif endif #---------------------------------------------------------------------- +# Make the precompiled header and compile C++ sources against it +#---------------------------------------------------------------------- + +#ifneq "$(PCH_OUTPUT)" "" +$(PCH_OUTPUT) : $(PCH_CXX_SOURCE) + $(CXX) $(CXXFLAGS) -x c++-header -o $(PCH_OUTPUT) $(PCH_CXX_SOURCE) +%.o : %.cpp $(PCH_OUTPUT) + $(CXX) $(PCHFLAGS) $(CXXFLAGS) -c -o $@ $< +#endif + +#---------------------------------------------------------------------- # Automatic variables based on items already entered. Below we create # 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 @@ -570,6 +600,9 @@ ifneq "$(DYLIB_NAME)" "" $(RM) -r $(DYLIB_FILENAME).dSYM $(RM) $(DYLIB_OBJECTS) $(DYLIB_PREREQS) $(DYLIB_PREREQS:.d=.d.tmp) $(DYLIB_DWOS) $(DYLIB_FILENAME) $(DYLIB_FILENAME).debug endif +ifneq "$(PCH_OUTPUT)" "" + $(RM) $(PCH_OUTPUT) +endif ifneq "$(DSYM)" "" $(RM) -r "$(DSYM)" endif diff --git a/packages/Python/lldbsuite/test/make/test_common.h b/packages/Python/lldbsuite/test/make/test_common.h index a1ed364574e3..b0151afb892e 100644 --- a/packages/Python/lldbsuite/test/make/test_common.h +++ b/packages/Python/lldbsuite/test/make/test_common.h @@ -26,7 +26,14 @@ #if defined(__linux__) #include <sys/prctl.h> -#if defined(PR_SET_PTRACER) && defined(PR_SET_PTRACER_ANY) +// Android API <= 16 does not have these defined. +#ifndef PR_SET_PTRACER +#define PR_SET_PTRACER 0x59616d61 +#endif +#ifndef PR_SET_PTRACER_ANY +#define PR_SET_PTRACER_ANY ((unsigned long)-1) +#endif + // For now we execute on best effort basis. If this fails for some reason, so be it. #define lldb_enable_attach() \ do \ @@ -35,10 +42,39 @@ (void)prctl_result; \ } while (0) -#endif - #else // not linux #define lldb_enable_attach() #endif + +#if defined(__APPLE__) && defined(LLDB_USING_LIBSTDCPP) + +// on Darwin, libstdc++ is missing <atomic>, so this would cause any test to fail building +// since this header file is being included in every C-family test case, we need to not include it +// on Darwin, most tests use libc++ by default, so this will only affect tests that explicitly require libstdc++ + +#else +#ifdef __cplusplus +#include <atomic> + +// Note that although hogging the CPU while waiting for a variable to change +// would be terrible in production code, it's great for testing since it +// avoids a lot of messy context switching to get multiple threads synchronized. + +typedef std::atomic<int> pseudo_barrier_t; +#define pseudo_barrier_wait(barrier) \ + do \ + { \ + --(barrier); \ + while ((barrier).load() > 0) \ + ; \ + } while (0) + +#define pseudo_barrier_init(barrier, count) \ + do \ + { \ + (barrier) = (count); \ + } while (0) +#endif // __cplusplus +#endif // defined(__APPLE__) && defined(LLDB_USING_LIBSTDCPP) |