[Lldb-commits] [lldb] r324671 - Only throw -fPIC when building a shared library
Aaron Smith via lldb-commits
lldb-commits at lists.llvm.org
Thu Feb 8 15:10:29 PST 2018
Author: asmith
Date: Thu Feb 8 15:10:29 2018
New Revision: 324671
URL: http://llvm.org/viewvc/llvm-project?rev=324671&view=rev
Log:
Only throw -fPIC when building a shared library
Summary:
Update makefiles to specify -fPIC in Makefile.rules and only throw -fPIC when building a shared library. This change is necessary to allow building the lldb tests on Windows where -fPIC is not a valid option.
Update a few places to Python 3.x syntax
Reviewers: zturner, lldb-commits
Reviewed By: zturner
Subscribers: stella.stamenova, labath, llvm-commits
Differential Revision: https://reviews.llvm.org/D42994
Modified:
lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/Makefile
lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/move_nearest/Makefile
lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/a.mk
lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/b.mk
lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/c.mk
lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/d.mk
lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/hidden/Makefile
lldb/trunk/packages/Python/lldbsuite/test/functionalities/pre_run_dylibs/Makefile
lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_attach/TestProcessAttach.py
lldb/trunk/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/One.mk
lldb/trunk/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/Two.mk
lldb/trunk/packages/Python/lldbsuite/test/lang/c/shared_lib/Makefile
lldb/trunk/packages/Python/lldbsuite/test/lang/c/shared_lib_stripped_symbols/Makefile
lldb/trunk/packages/Python/lldbsuite/test/lang/c/tls_globals/Makefile
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/namespace_definitions/a.mk
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/namespace_definitions/b.mk
lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py
lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules
lldb/trunk/packages/Python/lldbsuite/test/python_api/process/read-mem-cstring/TestReadMemCString.py
Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/Makefile?rev=324671&r1=324670&r2=324671&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/Makefile (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/Makefile Thu Feb 8 15:10:29 2018
@@ -3,6 +3,5 @@ LEVEL = ../../../make
DYLIB_NAME := foo
DYLIB_CXX_SOURCES := foo.cpp
CXX_SOURCES := main.cpp
-CFLAGS_EXTRAS := -fPIC
include $(LEVEL)/Makefile.rules
Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/move_nearest/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/move_nearest/Makefile?rev=324671&r1=324670&r2=324671&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/move_nearest/Makefile (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/move_nearest/Makefile Thu Feb 8 15:10:29 2018
@@ -3,6 +3,5 @@ LEVEL = ../../../make
DYLIB_NAME := foo
DYLIB_CXX_SOURCES := foo.cpp
CXX_SOURCES := main.cpp
-CFLAGS_EXTRAS += -fPIC
include $(LEVEL)/Makefile.rules
Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/a.mk
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/a.mk?rev=324671&r1=324670&r2=324671&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/a.mk (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/a.mk Thu Feb 8 15:10:29 2018
@@ -2,15 +2,12 @@ LEVEL := ../../make
LIB_PREFIX := loadunload_
-CFLAGS_EXTRAS := -fPIC
LD_EXTRAS := -L. -l$(LIB_PREFIX)b
DYLIB_NAME := $(LIB_PREFIX)a
DYLIB_CXX_SOURCES := a.cpp
DYLIB_ONLY := YES
-CXXFLAGS += -fPIC
-
include $(LEVEL)/Makefile.rules
$(DYLIB_FILENAME): lib_b
Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/b.mk
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/b.mk?rev=324671&r1=324670&r2=324671&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/b.mk (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/b.mk Thu Feb 8 15:10:29 2018
@@ -6,6 +6,4 @@ DYLIB_NAME := $(LIB_PREFIX)b
DYLIB_CXX_SOURCES := b.cpp
DYLIB_ONLY := YES
-CXXFLAGS += -fPIC
-
include $(LEVEL)/Makefile.rules
Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/c.mk
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/c.mk?rev=324671&r1=324670&r2=324671&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/c.mk (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/c.mk Thu Feb 8 15:10:29 2018
@@ -6,6 +6,4 @@ DYLIB_NAME := $(LIB_PREFIX)c
DYLIB_CXX_SOURCES := c.cpp
DYLIB_ONLY := YES
-CXXFLAGS += -fPIC
-
include $(LEVEL)/Makefile.rules
Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/d.mk
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/d.mk?rev=324671&r1=324670&r2=324671&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/d.mk (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/d.mk Thu Feb 8 15:10:29 2018
@@ -8,6 +8,4 @@ DYLIB_NAME := $(LIB_PREFIX)d
DYLIB_CXX_SOURCES := d.cpp
DYLIB_ONLY := YES
-CXXFLAGS += -fPIC
-
include $(LEVEL)/Makefile.rules
Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/hidden/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/hidden/Makefile?rev=324671&r1=324670&r2=324671&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/hidden/Makefile (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/hidden/Makefile Thu Feb 8 15:10:29 2018
@@ -6,6 +6,4 @@ DYLIB_NAME := $(LIB_PREFIX)d
DYLIB_CXX_SOURCES := d.cpp
DYLIB_ONLY := YES
-CXXFLAGS += -fPIC
-
include $(LEVEL)/Makefile.rules
Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/pre_run_dylibs/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/pre_run_dylibs/Makefile?rev=324671&r1=324670&r2=324671&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/pre_run_dylibs/Makefile (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/pre_run_dylibs/Makefile Thu Feb 8 15:10:29 2018
@@ -3,6 +3,4 @@ LEVEL = ../../make
DYLIB_NAME := unlikely_name
DYLIB_CXX_SOURCES := foo.cpp
CXX_SOURCES := main.cpp
-CFLAGS_EXTRAS += -fPIC
-
include $(LEVEL)/Makefile.rules
Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_attach/TestProcessAttach.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_attach/TestProcessAttach.py?rev=324671&r1=324670&r2=324671&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_attach/TestProcessAttach.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_attach/TestProcessAttach.py Thu Feb 8 15:10:29 2018
@@ -46,7 +46,7 @@ class ProcessAttachTestCase(TestBase):
newdir = self.getBuildArtifact("newdir")
try:
os.mkdir(newdir)
- except OSError, e:
+ except OSError as e:
if e.errno != os.errno.EEXIST:
raise
testdir = self.getBuildDir()
Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/One.mk
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/One.mk?rev=324671&r1=324670&r2=324671&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/One.mk (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/One.mk Thu Feb 8 15:10:29 2018
@@ -6,7 +6,5 @@ DYLIB_ONLY := YES
include $(LEVEL)/Makefile.rules
-CFLAGS_EXTRAS += -fPIC
-
OneConstant.o: OneConstant.c
$(CC) $(CFLAGS_NO_DEBUG) -c $< -o $@
Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/Two.mk
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/Two.mk?rev=324671&r1=324670&r2=324671&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/Two.mk (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/Two.mk Thu Feb 8 15:10:29 2018
@@ -6,7 +6,5 @@ DYLIB_ONLY := YES
include $(LEVEL)/Makefile.rules
-CFLAGS_EXTRAS += -fPIC
-
TwoConstant.o: TwoConstant.c
$(CC) $(CFLAGS_NO_DEBUG) -c $< -o $@
Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/c/shared_lib/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/c/shared_lib/Makefile?rev=324671&r1=324670&r2=324671&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lang/c/shared_lib/Makefile (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/c/shared_lib/Makefile Thu Feb 8 15:10:29 2018
@@ -3,6 +3,5 @@ LEVEL = ../../../make
DYLIB_NAME := foo
DYLIB_C_SOURCES := foo.c
C_SOURCES := main.c
-CFLAGS_EXTRAS += -fPIC
include $(LEVEL)/Makefile.rules
Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/c/shared_lib_stripped_symbols/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/c/shared_lib_stripped_symbols/Makefile?rev=324671&r1=324670&r2=324671&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lang/c/shared_lib_stripped_symbols/Makefile (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/c/shared_lib_stripped_symbols/Makefile Thu Feb 8 15:10:29 2018
@@ -3,7 +3,6 @@ LEVEL = ../../../make
DYLIB_NAME := foo
DYLIB_C_SOURCES := foo.c
C_SOURCES := main.c
-CFLAGS_EXTRAS += -fPIC
SPLIT_DEBUG_SYMBOLS = YES
Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/c/tls_globals/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/c/tls_globals/Makefile?rev=324671&r1=324670&r2=324671&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lang/c/tls_globals/Makefile (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/c/tls_globals/Makefile Thu Feb 8 15:10:29 2018
@@ -1,7 +1,6 @@
LEVEL = ../../../make
C_SOURCES := main.c
-CFLAGS_EXTRAS += -fPIC
DYLIB_NAME := a
DYLIB_C_SOURCES := a.c
Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/namespace_definitions/a.mk
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/namespace_definitions/a.mk?rev=324671&r1=324670&r2=324671&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/namespace_definitions/a.mk (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/namespace_definitions/a.mk Thu Feb 8 15:10:29 2018
@@ -4,6 +4,4 @@ DYLIB_NAME := a
DYLIB_CXX_SOURCES := a.cpp
DYLIB_ONLY := YES
-CXXFLAGS += -fPIC
-
include $(LEVEL)/Makefile.rules
Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/namespace_definitions/b.mk
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/namespace_definitions/b.mk?rev=324671&r1=324670&r2=324671&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/namespace_definitions/b.mk (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/namespace_definitions/b.mk Thu Feb 8 15:10:29 2018
@@ -4,6 +4,4 @@ DYLIB_NAME := b
DYLIB_CXX_SOURCES := b.cpp
DYLIB_ONLY := YES
-CXXFLAGS += -fPIC
-
include $(LEVEL)/Makefile.rules
Modified: lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py?rev=324671&r1=324670&r2=324671&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py Thu Feb 8 15:10:29 2018
@@ -1478,10 +1478,10 @@ class Base(unittest2.TestCase):
d = {
'DYLIB_CXX_SOURCES': sources,
'DYLIB_NAME': lib_name,
- 'CFLAGS_EXTRAS': "%s -I%s -fPIC" % (stdflag,
- os.path.join(
- os.environ["LLDB_SRC"],
- "include")),
+ 'CFLAGS_EXTRAS': "%s -I%s " % (stdflag,
+ os.path.join(
+ os.environ["LLDB_SRC"],
+ "include")),
'LD_EXTRAS': "-shared -l%s\liblldb.lib" % self.os.environ["LLDB_IMPLIB_DIR"]}
if self.TraceOn():
print(
Modified: lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules?rev=324671&r1=324670&r2=324671&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules Thu Feb 8 15:10:29 2018
@@ -544,6 +544,11 @@ endif
#----------------------------------------------------------------------
$(DYLIB_OBJECTS) : CFLAGS += -DCOMPILING_LLDB_TEST_DLL
+ifneq "$(OS)" "Windows_NT"
+$(DYLIB_OBJECTS) : CFLAGS += -fPIC
+$(DYLIB_OBJECTS) : CXXFLAGS += -fPIC
+endif
+
$(DYLIB_FILENAME) : $(DYLIB_OBJECTS)
ifeq "$(OS)" "Darwin"
$(LD) $(DYLIB_OBJECTS) $(LDFLAGS) -install_name "$(DYLIB_EXECUTABLE_PATH)/$(DYLIB_FILENAME)" -dynamiclib -o "$(DYLIB_FILENAME)"
Modified: lldb/trunk/packages/Python/lldbsuite/test/python_api/process/read-mem-cstring/TestReadMemCString.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/process/read-mem-cstring/TestReadMemCString.py?rev=324671&r1=324670&r2=324671&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/python_api/process/read-mem-cstring/TestReadMemCString.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/python_api/process/read-mem-cstring/TestReadMemCString.py Thu Feb 8 15:10:29 2018
@@ -17,19 +17,19 @@ class TestReadMemCString(TestBase):
def test_read_memory_c_string(self):
"""Test corner case behavior of SBProcess::ReadCStringFromMemory"""
self.build()
- self.dbg.SetAsync(False)
+ self.dbg.SetAsync(False)
self.main_source = "main.c"
self.main_source_path = os.path.join(self.getSourceDir(),
self.main_source)
- self.main_source_spec = lldb.SBFileSpec(self.main_source_path)
- self.exe = self.getBuildArtifact("read-mem-cstring")
+ self.main_source_spec = lldb.SBFileSpec(self.main_source_path)
+ self.exe = self.getBuildArtifact("read-mem-cstring")
(target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(
self, 'breakpoint here', self.main_source_spec, None, self.exe)
- frame = thread.GetFrameAtIndex(0)
-
+ frame = thread.GetFrameAtIndex(0)
+
err = lldb.SBError()
empty_str_addr = frame.FindVariable("empty_string").GetValueAsUnsigned(err)
More information about the lldb-commits
mailing list