MaskRay updated this revision to Diff 318414. MaskRay marked an inline comment as done. MaskRay added a comment.
Adopt rupprecht's suggestion Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D94888/new/ https://reviews.llvm.org/D94888 Files: lldb/packages/Python/lldbsuite/test/dotest.py lldb/packages/Python/lldbsuite/test/make/Makefile.rules Index: lldb/packages/Python/lldbsuite/test/make/Makefile.rules =================================================================== --- lldb/packages/Python/lldbsuite/test/make/Makefile.rules +++ lldb/packages/Python/lldbsuite/test/make/Makefile.rules @@ -279,11 +279,6 @@ LD = $(CC) LDFLAGS ?= $(CFLAGS) LDFLAGS += $(LD_EXTRAS) $(ARCH_LDFLAGS) -ifneq (,$(LLVM_LIBS_DIR)) - ifeq ($(OS),NetBSD) - LDFLAGS += -L$(LLVM_LIBS_DIR) -Wl,-rpath,$(LLVM_LIBS_DIR) - endif -endif ifeq (,$(filter $(OS), Windows_NT Android Darwin)) ifneq (,$(filter YES,$(ENABLE_THREADS))) LDFLAGS += -pthread @@ -393,21 +388,18 @@ ifeq (1,$(USE_LIBCPP)) CXXFLAGS += -DLLDB_USING_LIBCPP - ifeq "$(OS)" "Linux" - ifneq (,$(findstring clang,$(CC))) - CXXFLAGS += -stdlib=libc++ - LDFLAGS += -stdlib=libc++ - else - CXXFLAGS += -isystem /usr/include/c++/v1 - LDFLAGS += -lc++ - endif - else ifeq "$(OS)" "Android" + ifeq "$(OS)" "Android" # Nothing to do, this is already handled in # Android.rules. else CXXFLAGS += -stdlib=libc++ LDFLAGS += -stdlib=libc++ endif + ifneq (,$(filter $(OS), FreeBSD Linux NetBSD)) + ifneq (,$(LLVM_LIBS_DIR)) + LDFLAGS += -Wl,-rpath,$(LLVM_LIBS_DIR) + endif + endif endif #---------------------------------------------------------------------- Index: lldb/packages/Python/lldbsuite/test/dotest.py =================================================================== --- lldb/packages/Python/lldbsuite/test/dotest.py +++ lldb/packages/Python/lldbsuite/test/dotest.py @@ -761,15 +761,15 @@ return True, "libc++ always present" if platform == "linux": - if os.path.isdir("/usr/include/c++/v1"): - return True, "Headers found, let's hope they work" with tempfile.NamedTemporaryFile() as f: cmd = [configuration.compiler, "-xc++", "-stdlib=libc++", "-o", f.name, "-"] p = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True) _, stderr = p.communicate("#include <algorithm>\nint main() {}") - if not p.returncode: - return True, "Compiling with -stdlib=libc++ works" - return False, "Compiling with -stdlib=libc++ fails with the error: %s" % stderr + if p.returncode != 0: + return False, "Compiling with -stdlib=libc++ fails with the error: %s" % stderr + if subprocess.call([f.name]) != 0: + return False, "Compiling with -stdlib=libc++ works, but fails to run" + return True, "Compiling with -stdlib=libc++ works" return False, "Don't know how to build with libc++ on %s" % platform
Index: lldb/packages/Python/lldbsuite/test/make/Makefile.rules =================================================================== --- lldb/packages/Python/lldbsuite/test/make/Makefile.rules +++ lldb/packages/Python/lldbsuite/test/make/Makefile.rules @@ -279,11 +279,6 @@ LD = $(CC) LDFLAGS ?= $(CFLAGS) LDFLAGS += $(LD_EXTRAS) $(ARCH_LDFLAGS) -ifneq (,$(LLVM_LIBS_DIR)) - ifeq ($(OS),NetBSD) - LDFLAGS += -L$(LLVM_LIBS_DIR) -Wl,-rpath,$(LLVM_LIBS_DIR) - endif -endif ifeq (,$(filter $(OS), Windows_NT Android Darwin)) ifneq (,$(filter YES,$(ENABLE_THREADS))) LDFLAGS += -pthread @@ -393,21 +388,18 @@ ifeq (1,$(USE_LIBCPP)) CXXFLAGS += -DLLDB_USING_LIBCPP - ifeq "$(OS)" "Linux" - ifneq (,$(findstring clang,$(CC))) - CXXFLAGS += -stdlib=libc++ - LDFLAGS += -stdlib=libc++ - else - CXXFLAGS += -isystem /usr/include/c++/v1 - LDFLAGS += -lc++ - endif - else ifeq "$(OS)" "Android" + ifeq "$(OS)" "Android" # Nothing to do, this is already handled in # Android.rules. else CXXFLAGS += -stdlib=libc++ LDFLAGS += -stdlib=libc++ endif + ifneq (,$(filter $(OS), FreeBSD Linux NetBSD)) + ifneq (,$(LLVM_LIBS_DIR)) + LDFLAGS += -Wl,-rpath,$(LLVM_LIBS_DIR) + endif + endif endif #---------------------------------------------------------------------- Index: lldb/packages/Python/lldbsuite/test/dotest.py =================================================================== --- lldb/packages/Python/lldbsuite/test/dotest.py +++ lldb/packages/Python/lldbsuite/test/dotest.py @@ -761,15 +761,15 @@ return True, "libc++ always present" if platform == "linux": - if os.path.isdir("/usr/include/c++/v1"): - return True, "Headers found, let's hope they work" with tempfile.NamedTemporaryFile() as f: cmd = [configuration.compiler, "-xc++", "-stdlib=libc++", "-o", f.name, "-"] p = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True) _, stderr = p.communicate("#include <algorithm>\nint main() {}") - if not p.returncode: - return True, "Compiling with -stdlib=libc++ works" - return False, "Compiling with -stdlib=libc++ fails with the error: %s" % stderr + if p.returncode != 0: + return False, "Compiling with -stdlib=libc++ fails with the error: %s" % stderr + if subprocess.call([f.name]) != 0: + return False, "Compiling with -stdlib=libc++ works, but fails to run" + return True, "Compiling with -stdlib=libc++ works" return False, "Don't know how to build with libc++ on %s" % platform
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits