OSDN Git Service

[lldb] Pass -fPIC flag even when DYLIB_ONLY is set
authorRaphael Isemann <teemperor@gmail.com>
Fri, 29 May 2020 15:08:28 +0000 (17:08 +0200)
committerRaphael Isemann <teemperor@gmail.com>
Sat, 30 May 2020 16:05:16 +0000 (18:05 +0200)
Summary:
It seems that when we rewrite a few rules to only build a dylib (i.e., when DYLIB_ONLY is set),
the rule for setting the CFLAGS for the dylib's object file compilation will no longer work. From what I can
see this is because in DYLIB_ONLY mode we pretend to compile the main executable so
the DYLIB_OBJECTS scope is actually never used.

This patch makes `-fPIC` unstopped if DYLIB_ONLY is set so that -fPIC actually ends up in the
CFLAGS for the dylib object file compilation.

The test for this is D80798 which only compiles on Linux with this patch.

Reviewers: friss, labath

Reviewed By: friss

Subscribers: JDevlieghere

Differential Revision: https://reviews.llvm.org/D80789

lldb/packages/Python/lldbsuite/test/make/Makefile.rules

index ea0fa74..5e3f478 100644 (file)
@@ -657,9 +657,14 @@ endif
 $(DYLIB_OBJECTS) : CFLAGS += -DCOMPILING_LLDB_TEST_DLL
 
 ifneq "$(OS)" "Windows_NT"
+ifeq "$(DYLIB_ONLY)" ""
+CFLAGS += -fPIC
+CXXFLAGS += -fPIC
+else
 $(DYLIB_OBJECTS) : CFLAGS += -fPIC
 $(DYLIB_OBJECTS) : CXXFLAGS += -fPIC
 endif
+endif
 
 $(DYLIB_FILENAME) : $(DYLIB_OBJECTS)
 ifeq "$(OS)" "Darwin"