summaryrefslogtreecommitdiffstats
path: root/lldb/packages/Python/lldbsuite
diff options
context:
space:
mode:
authorChris Bieneman <beanz@apple.com>2016-10-18 23:53:24 +0000
committerChris Bieneman <beanz@apple.com>2016-10-18 23:53:24 +0000
commite80f007dfb6b4f04fb00b28559ce21a2852b89b5 (patch)
tree53d5662c63c4edd68b1e1328fd8f4ee960712df7 /lldb/packages/Python/lldbsuite
parent84a0b6dba179126639a68a6925d9d0ceb0bb250a (diff)
downloadbcm5719-llvm-e80f007dfb6b4f04fb00b28559ce21a2852b89b5.tar.gz
bcm5719-llvm-e80f007dfb6b4f04fb00b28559ce21a2852b89b5.zip
Use clang --driver-mode instead of guessing c++ compiler path
Summary: When building the LLDB test programs, if your CC is clang it actually isn't safe to make CXX a string replace of "clang -> clang++". This falls down on unix configurations if your compiler is clang-${version}. A safer approach is to use the "--driver-mode=g++" option to tell clang to act like clang++. Reviewers: tfiala, zturner, labath Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D25753 llvm-svn: 284550
Diffstat (limited to 'lldb/packages/Python/lldbsuite')
-rw-r--r--lldb/packages/Python/lldbsuite/test/make/Makefile.rules39
1 files changed, 21 insertions, 18 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
index 910dc6737c7..4d343cd68d2 100644
--- a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
+++ b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
@@ -242,27 +242,27 @@ ifneq "$(DYLIB_NAME)" ""
endif
# Function that returns the counterpart C++ compiler, given $(CC) as arg.
-cxx_compiler_notdir = $(if $(findstring clang,$(1)), \
- $(subst clang,clang++,$(1)), \
- $(if $(findstring icc,$(1)), \
- $(subst icc,icpc,$(1)), \
- $(if $(findstring llvm-gcc,$(1)), \
- $(subst llvm-gcc,llvm-g++,$(1)), \
- $(if $(findstring gcc,$(1)), \
- $(subst gcc,g++,$(1)), \
- $(subst cc,c++,$(1))))))
+cxx_compiler_notdir = $(if $(findstring icc,$(1)), \
+ $(subst icc,icpc,$(1)), \
+ $(if $(findstring llvm-gcc,$(1)), \
+ $(subst llvm-gcc,llvm-g++,$(1)), \
+ $(if $(findstring gcc,$(1)), \
+ $(subst gcc,g++,$(1)), \
+ $(subst cc,c++,$(1)))))
cxx_compiler = $(if $(findstring /,$(1)),$(join $(dir $(1)), $(call cxx_compiler_notdir,$(notdir $(1)))),$(call cxx_compiler_notdir,$(1)))
+ifeq ($(findstring clang, $(cxx_compiler)), clang)
+ CXXFLAGS += --driver-mode=g++
+endif
+
# Function that returns the C++ linker, given $(CC) as arg.
-cxx_linker_notdir = $(if $(findstring clang,$(1)), \
- $(subst clang,clang++,$(1)), \
- $(if $(findstring icc,$(1)), \
- $(subst icc,icpc,$(1)), \
- $(if $(findstring llvm-gcc,$(1)), \
- $(subst llvm-gcc,llvm-g++,$(1)), \
- $(if $(findstring gcc,$(1)), \
- $(subst gcc,g++,$(1)), \
- $(subst cc,c++,$(1))))))
+cxx_linker_notdir = $(if $(findstring icc,$(1)), \
+ $(subst icc,icpc,$(1)), \
+ $(if $(findstring llvm-gcc,$(1)), \
+ $(subst llvm-gcc,llvm-g++,$(1)), \
+ $(if $(findstring gcc,$(1)), \
+ $(subst gcc,g++,$(1)), \
+ $(subst cc,c++,$(1)))))
cxx_linker = $(if $(findstring /,$(1)),$(join $(dir $(1)), $(call cxx_linker_notdir,$(notdir $(1)))),$(call cxx_linker_notdir,$(1)))
ifneq "$(OS)" "Darwin"
@@ -354,6 +354,7 @@ ifneq "$(strip $(DYLIB_CXX_SOURCES))" ""
DYLIB_OBJECTS +=$(strip $(DYLIB_CXX_SOURCES:.cpp=.o))
CXX = $(call cxx_compiler,$(CC))
LD = $(call cxx_linker,$(CC))
+ LDFLAGS += --driver-mode=g++
endif
#----------------------------------------------------------------------
@@ -377,6 +378,7 @@ endif
ifneq "$(strip $(CXX_SOURCES))" ""
OBJECTS +=$(strip $(CXX_SOURCES:.cpp=.o))
CXX = $(call cxx_compiler,$(CC))
+ LDFLAGS += --driver-mode=g++
LD = $(call cxx_linker,$(CC))
endif
@@ -395,6 +397,7 @@ ifneq "$(strip $(OBJCXX_SOURCES))" ""
OBJECTS +=$(strip $(OBJCXX_SOURCES:.mm=.o))
CXX = $(call cxx_compiler,$(CC))
LD = $(call cxx_linker,$(CC))
+ LDFLAGS += --driver-mode=g++
ifeq "$(findstring lobjc,$(LDFLAGS))" ""
LDFLAGS +=-lobjc
endif
OpenPOWER on IntegriCloud