[Lldb-commits] [lldb] r173402 - in /lldb/trunk/test: functionalities/stop-hook/multiple_threads/Makefile functionalities/thread/Makefile functionalities/watchpoint/watchpoint_set_command/Makefile lang/c/const_variables/Makefile lang/cpp/stl/TestSTL.py make/Makefile.rules plugins/builder_base.py python_api/lldbutil/iter/Makefile python_api/lldbutil/process/Makefile python_api/module_section/Makefile python_api/watchpoint/watchlocation/Makefile

Daniel Malea daniel.malea at intel.com
Thu Jan 24 16:31:49 PST 2013


Author: dmalea
Date: Thu Jan 24 18:31:48 2013
New Revision: 173402

URL: http://llvm.org/viewvc/llvm-project?rev=173402&view=rev
Log:
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.


Modified:
    lldb/trunk/test/functionalities/stop-hook/multiple_threads/Makefile
    lldb/trunk/test/functionalities/thread/Makefile
    lldb/trunk/test/functionalities/watchpoint/watchpoint_set_command/Makefile
    lldb/trunk/test/lang/c/const_variables/Makefile
    lldb/trunk/test/lang/cpp/stl/TestSTL.py
    lldb/trunk/test/make/Makefile.rules
    lldb/trunk/test/plugins/builder_base.py
    lldb/trunk/test/python_api/lldbutil/iter/Makefile
    lldb/trunk/test/python_api/lldbutil/process/Makefile
    lldb/trunk/test/python_api/module_section/Makefile
    lldb/trunk/test/python_api/watchpoint/watchlocation/Makefile

Modified: lldb/trunk/test/functionalities/stop-hook/multiple_threads/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/stop-hook/multiple_threads/Makefile?rev=173402&r1=173401&r2=173402&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/stop-hook/multiple_threads/Makefile (original)
+++ lldb/trunk/test/functionalities/stop-hook/multiple_threads/Makefile Thu Jan 24 18:31:48 2013
@@ -1,6 +1,6 @@
 LEVEL = ../../../make
 
-LDFLAGS := -lpthread
+LD_EXTRAS := -lpthread
 CXX_SOURCES := main.cpp
 
 include $(LEVEL)/Makefile.rules

Modified: lldb/trunk/test/functionalities/thread/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/thread/Makefile?rev=173402&r1=173401&r2=173402&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/thread/Makefile (original)
+++ lldb/trunk/test/functionalities/thread/Makefile Thu Jan 24 18:31:48 2013
@@ -1,5 +1,5 @@
 LEVEL = ../../make
 
 C_SOURCES := main.c
-LDFLAGS := -lpthread
+LD_EXTRAS := -lpthread
 include $(LEVEL)/Makefile.rules

Modified: lldb/trunk/test/functionalities/watchpoint/watchpoint_set_command/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/watchpoint/watchpoint_set_command/Makefile?rev=173402&r1=173401&r2=173402&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/watchpoint/watchpoint_set_command/Makefile (original)
+++ lldb/trunk/test/functionalities/watchpoint/watchpoint_set_command/Makefile Thu Jan 24 18:31:48 2013
@@ -1,6 +1,6 @@
 LEVEL = ../../../make
 
-LDFLAGS := -lpthread
+LD_EXTRAS := -lpthread
 CXX_SOURCES := main.cpp
 
 include $(LEVEL)/Makefile.rules

Modified: lldb/trunk/test/lang/c/const_variables/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/c/const_variables/Makefile?rev=173402&r1=173401&r2=173402&view=diff
==============================================================================
--- lldb/trunk/test/lang/c/const_variables/Makefile (original)
+++ lldb/trunk/test/lang/c/const_variables/Makefile Thu Jan 24 18:31:48 2013
@@ -2,6 +2,6 @@
 
 C_SOURCES := main.c functions.c
 
-CFLAGS ?= -arch $(ARCH) -gdwarf-2 -O3
+CFLAGS ?= -gdwarf-2 -O3
 
 include $(LEVEL)/Makefile.rules

Modified: lldb/trunk/test/lang/cpp/stl/TestSTL.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/cpp/stl/TestSTL.py?rev=173402&r1=173401&r2=173402&view=diff
==============================================================================
--- lldb/trunk/test/lang/cpp/stl/TestSTL.py (original)
+++ lldb/trunk/test/lang/cpp/stl/TestSTL.py Thu Jan 24 18:31:48 2013
@@ -36,6 +36,7 @@
         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):

Modified: lldb/trunk/test/make/Makefile.rules
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/make/Makefile.rules?rev=173402&r1=173401&r2=173402&view=diff
==============================================================================
--- lldb/trunk/test/make/Makefile.rules (original)
+++ lldb/trunk/test/make/Makefile.rules Thu Jan 24 18:31:48 2013
@@ -54,26 +54,49 @@
 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 @@
 endif
 else
 $(EXE) : $(OBJECTS) $(ARCHIVE_NAME)
-	$(LD) $(LDFLAGS) $(OBJECTS) $(ARCHIVE_NAME) -o "$(EXE)"
+	$(LD) $(OBJECTS) $(LDFLAGS) $(ARCHIVE_NAME) -o "$(EXE)"
 endif
 
 #----------------------------------------------------------------------

Modified: lldb/trunk/test/plugins/builder_base.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/plugins/builder_base.py?rev=173402&r1=173401&r2=173402&view=diff
==============================================================================
--- lldb/trunk/test/plugins/builder_base.py (original)
+++ lldb/trunk/test/plugins/builder_base.py Thu Jan 24 18:31:48 2013
@@ -23,6 +23,20 @@
     """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

Modified: lldb/trunk/test/python_api/lldbutil/iter/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/lldbutil/iter/Makefile?rev=173402&r1=173401&r2=173402&view=diff
==============================================================================
--- lldb/trunk/test/python_api/lldbutil/iter/Makefile (original)
+++ lldb/trunk/test/python_api/lldbutil/iter/Makefile Thu Jan 24 18:31:48 2013
@@ -1,7 +1,7 @@
 LEVEL = ../../../make
 
 CFLAGS_EXTRAS := -D__STDC_LIMIT_MACROS
-LDFLAGS := -lpthread
+LD_EXTRAS := -lpthread
 CXX_SOURCES := main.cpp
 MAKE_DSYM :=NO
 

Modified: lldb/trunk/test/python_api/lldbutil/process/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/lldbutil/process/Makefile?rev=173402&r1=173401&r2=173402&view=diff
==============================================================================
--- lldb/trunk/test/python_api/lldbutil/process/Makefile (original)
+++ lldb/trunk/test/python_api/lldbutil/process/Makefile Thu Jan 24 18:31:48 2013
@@ -1,7 +1,7 @@
 LEVEL = ../../../make
 
 CFLAGS_EXTRAS := -D__STDC_LIMIT_MACROS
-LDFLAGS := -lpthread
+LD_EXTRAS := -lpthread
 CXX_SOURCES := main.cpp
 MAKE_DSYM :=NO
 

Modified: lldb/trunk/test/python_api/module_section/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/module_section/Makefile?rev=173402&r1=173401&r2=173402&view=diff
==============================================================================
--- lldb/trunk/test/python_api/module_section/Makefile (original)
+++ lldb/trunk/test/python_api/module_section/Makefile Thu Jan 24 18:31:48 2013
@@ -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
 

Modified: lldb/trunk/test/python_api/watchpoint/watchlocation/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/watchpoint/watchlocation/Makefile?rev=173402&r1=173401&r2=173402&view=diff
==============================================================================
--- lldb/trunk/test/python_api/watchpoint/watchlocation/Makefile (original)
+++ lldb/trunk/test/python_api/watchpoint/watchlocation/Makefile Thu Jan 24 18:31:48 2013
@@ -1,6 +1,6 @@
 LEVEL = ../../../make
 
-LDFLAGS := -lpthread
+LD_EXTRAS := -lpthread
 CXX_SOURCES := main.cpp
 
 include $(LEVEL)/Makefile.rules





More information about the lldb-commits mailing list