diff options
| author | Daniel Malea <daniel.malea@intel.com> | 2013-01-25 00:31:48 +0000 |
|---|---|---|
| committer | Daniel Malea <daniel.malea@intel.com> | 2013-01-25 00:31:48 +0000 |
| commit | 2745d8467ba0a6fe9e7e5f908611e45a1a7a1a49 (patch) | |
| tree | 60971ecc541afbcc9a9159bcf14ddd060e5fe6bd | |
| parent | 28aed9ca85c0903eb5791e30956b1b6a0ea2ad89 (diff) | |
| download | bcm5719-llvm-2745d8467ba0a6fe9e7e5f908611e45a1a7a1a49.tar.gz bcm5719-llvm-2745d8467ba0a6fe9e7e5f908611e45a1a7a1a49.zip | |
Update test scripts and Makefiles to allow testing with GCC:
- introduce new variable ARCHFLAG in make/Makefile.rules to switch between "-arch" on Mac and "-m" everywhere else
- update testcase makefiles to use LD_EXTRAS instead of LDFLAGS (the former interacts with Makefile.rules badly)
- special treatment for gcc 4.6: replace "-std=c++11" with "-std=c++0x" as the former is not handled correctly
- remove hardcoded "-arch" from test Makefile
This patch should not have any effect on lldb on Mac OS X.
llvm-svn: 173402
| -rw-r--r-- | lldb/test/functionalities/stop-hook/multiple_threads/Makefile | 2 | ||||
| -rw-r--r-- | lldb/test/functionalities/thread/Makefile | 2 | ||||
| -rw-r--r-- | lldb/test/functionalities/watchpoint/watchpoint_set_command/Makefile | 2 | ||||
| -rw-r--r-- | lldb/test/lang/c/const_variables/Makefile | 2 | ||||
| -rw-r--r-- | lldb/test/lang/cpp/stl/TestSTL.py | 1 | ||||
| -rw-r--r-- | lldb/test/make/Makefile.rules | 33 | ||||
| -rw-r--r-- | lldb/test/plugins/builder_base.py | 14 | ||||
| -rw-r--r-- | lldb/test/python_api/lldbutil/iter/Makefile | 2 | ||||
| -rw-r--r-- | lldb/test/python_api/lldbutil/process/Makefile | 2 | ||||
| -rw-r--r-- | lldb/test/python_api/module_section/Makefile | 2 | ||||
| -rw-r--r-- | lldb/test/python_api/watchpoint/watchlocation/Makefile | 2 |
11 files changed, 51 insertions, 13 deletions
diff --git a/lldb/test/functionalities/stop-hook/multiple_threads/Makefile b/lldb/test/functionalities/stop-hook/multiple_threads/Makefile index ecf078b3a16..2af752bd465 100644 --- a/lldb/test/functionalities/stop-hook/multiple_threads/Makefile +++ b/lldb/test/functionalities/stop-hook/multiple_threads/Makefile @@ -1,6 +1,6 @@ LEVEL = ../../../make -LDFLAGS := -lpthread +LD_EXTRAS := -lpthread CXX_SOURCES := main.cpp include $(LEVEL)/Makefile.rules diff --git a/lldb/test/functionalities/thread/Makefile b/lldb/test/functionalities/thread/Makefile index 24cb29fc050..2773c6d0904 100644 --- a/lldb/test/functionalities/thread/Makefile +++ b/lldb/test/functionalities/thread/Makefile @@ -1,5 +1,5 @@ LEVEL = ../../make C_SOURCES := main.c -LDFLAGS := -lpthread +LD_EXTRAS := -lpthread include $(LEVEL)/Makefile.rules diff --git a/lldb/test/functionalities/watchpoint/watchpoint_set_command/Makefile b/lldb/test/functionalities/watchpoint/watchpoint_set_command/Makefile index ecf078b3a16..2af752bd465 100644 --- a/lldb/test/functionalities/watchpoint/watchpoint_set_command/Makefile +++ b/lldb/test/functionalities/watchpoint/watchpoint_set_command/Makefile @@ -1,6 +1,6 @@ LEVEL = ../../../make -LDFLAGS := -lpthread +LD_EXTRAS := -lpthread CXX_SOURCES := main.cpp include $(LEVEL)/Makefile.rules diff --git a/lldb/test/lang/c/const_variables/Makefile b/lldb/test/lang/c/const_variables/Makefile index 923a0d6ea5d..69dc250a71f 100644 --- a/lldb/test/lang/c/const_variables/Makefile +++ b/lldb/test/lang/c/const_variables/Makefile @@ -2,6 +2,6 @@ LEVEL = ../../../make C_SOURCES := main.c functions.c -CFLAGS ?= -arch $(ARCH) -gdwarf-2 -O3 +CFLAGS ?= -gdwarf-2 -O3 include $(LEVEL)/Makefile.rules diff --git a/lldb/test/lang/cpp/stl/TestSTL.py b/lldb/test/lang/cpp/stl/TestSTL.py index 62f433230f4..d96c692f01b 100644 --- a/lldb/test/lang/cpp/stl/TestSTL.py +++ b/lldb/test/lang/cpp/stl/TestSTL.py @@ -36,6 +36,7 @@ class STLTestCase(TestBase): self.buildDsym() self.sbtype_template_apis() + @skipIfGcc # bugzilla 15036: crashes during DWARF parsing when built with GCC @python_api_test @dwarf_test def test_SBType_template_aspects_with_dwarf(self): diff --git a/lldb/test/make/Makefile.rules b/lldb/test/make/Makefile.rules index aaae8943796..dd90341db54 100644 --- a/lldb/test/make/Makefile.rules +++ b/lldb/test/make/Makefile.rules @@ -54,26 +54,49 @@ ifeq "$(CC)" "cc" endif #---------------------------------------------------------------------- +# ARCHFLAG is the flag used to tell the compiler which architecture +# to compile for. The default is the flag that clang accepts. +#---------------------------------------------------------------------- +ARCHFLAG ?= -arch + +#---------------------------------------------------------------------- # Change any build/tool options needed #---------------------------------------------------------------------- -CFLAGS ?= -gdwarf-2 -O0 -CFLAGS += $(FRAMEWORK_INCLUDES) $(CFLAGS_EXTRAS) ifeq "$(OS)" "Darwin" - CFLAGS += -arch $(ARCH) DS := dsymutil DSFLAGS = DSYM = $(EXE).dSYM AR := libtool ARFLAGS := -static -o +else + # On non-Apple platforms, -arch becomes -m + ARCHFLAG := -m + + # i386 becomes 32, and x86_64 becomes 64 + ifeq "$(ARCH)" "x86_64" + override ARCH := $(subst x86_64,64,$(ARCH)) + endif + ifeq "$(ARCH)" "i386" + override ARCH := $(subst i386,32,$(ARCH)) + endif endif +CFLAGS ?= -gdwarf-2 -O0 +CFLAGS += $(ARCHFLAG)$(ARCH) $(FRAMEWORK_INCLUDES) $(CFLAGS_EXTRAS) + CXXFLAGS +=$(CFLAGS) LD = $(CC) LDFLAGS ?= $(CFLAGS) -LDFLAGS += $(LD_EXTRAS) -arch $(ARCH) +LDFLAGS += $(LD_EXTRAS) OBJECTS = EXE ?= a.out +ifneq (,$(findstring g++,$(CXX))) + # GCC 4.6 cannot handle -std=c++11, so replace it with -std=c++0x + # instead. FIXME: remove once GCC version is upgraded. + override CXXFLAGS := $(subst -std=c++11,-std=c++0x,$(CXXFLAGS)) +endif + ifneq "$(DYLIB_NAME)" "" ifeq "$(OS)" "Darwin" DYLIB_FILENAME = lib$(DYLIB_NAME).dylib @@ -208,7 +231,7 @@ EXE = $(DYLIB_FILENAME) endif else $(EXE) : $(OBJECTS) $(ARCHIVE_NAME) - $(LD) $(LDFLAGS) $(OBJECTS) $(ARCHIVE_NAME) -o "$(EXE)" + $(LD) $(OBJECTS) $(LDFLAGS) $(ARCHIVE_NAME) -o "$(EXE)" endif #---------------------------------------------------------------------- diff --git a/lldb/test/plugins/builder_base.py b/lldb/test/plugins/builder_base.py index 78fc2f0b036..737276daba8 100644 --- a/lldb/test/plugins/builder_base.py +++ b/lldb/test/plugins/builder_base.py @@ -23,6 +23,20 @@ def getCompiler(): """Returns the compiler in effect the test suite is running with.""" return os.environ["CC"] if "CC" in os.environ else "clang" +def getArchFlag(): + """Returns the flag required to specify the arch""" + compiler = getCompiler() + if compiler is None: + return "" + elif "gcc" in compiler: + archflag = "-m" + elif "clang" in compiler: + archflag = "-arch " + else: + archflag = None + + return (" ARCHFLAG=" + archflag) if archflag else "" + def getArchSpec(architecture): """ Helper function to return the key-value string to specify the architecture diff --git a/lldb/test/python_api/lldbutil/iter/Makefile b/lldb/test/python_api/lldbutil/iter/Makefile index 865b34ba459..190194e2ebc 100644 --- a/lldb/test/python_api/lldbutil/iter/Makefile +++ b/lldb/test/python_api/lldbutil/iter/Makefile @@ -1,7 +1,7 @@ LEVEL = ../../../make CFLAGS_EXTRAS := -D__STDC_LIMIT_MACROS -LDFLAGS := -lpthread +LD_EXTRAS := -lpthread CXX_SOURCES := main.cpp MAKE_DSYM :=NO diff --git a/lldb/test/python_api/lldbutil/process/Makefile b/lldb/test/python_api/lldbutil/process/Makefile index 865b34ba459..190194e2ebc 100644 --- a/lldb/test/python_api/lldbutil/process/Makefile +++ b/lldb/test/python_api/lldbutil/process/Makefile @@ -1,7 +1,7 @@ LEVEL = ../../../make CFLAGS_EXTRAS := -D__STDC_LIMIT_MACROS -LDFLAGS := -lpthread +LD_EXTRAS := -lpthread CXX_SOURCES := main.cpp MAKE_DSYM :=NO diff --git a/lldb/test/python_api/module_section/Makefile b/lldb/test/python_api/module_section/Makefile index 2e9a4de9de9..7b5f11134bf 100644 --- a/lldb/test/python_api/module_section/Makefile +++ b/lldb/test/python_api/module_section/Makefile @@ -1,7 +1,7 @@ LEVEL = ../../make CFLAGS_EXTRAS := -D__STDC_LIMIT_MACROS -LDFLAGS := -lpthread +LD_EXTRAS := -lpthread CXX_SOURCES := main.cpp b.cpp c.cpp MAKE_DSYM :=NO diff --git a/lldb/test/python_api/watchpoint/watchlocation/Makefile b/lldb/test/python_api/watchpoint/watchlocation/Makefile index ecf078b3a16..2af752bd465 100644 --- a/lldb/test/python_api/watchpoint/watchlocation/Makefile +++ b/lldb/test/python_api/watchpoint/watchlocation/Makefile @@ -1,6 +1,6 @@ LEVEL = ../../../make -LDFLAGS := -lpthread +LD_EXTRAS := -lpthread CXX_SOURCES := main.cpp include $(LEVEL)/Makefile.rules |

