[Lldb-commits] [lldb] fd0ab3b - [lldb] Pass -fPIC flag even when DYLIB_ONLY is set

Raphael Isemann via lldb-commits lldb-commits at lists.llvm.org
Sat May 30 09:05:39 PDT 2020


Author: Raphael Isemann
Date: 2020-05-30T18:05:16+02:00
New Revision: fd0ab3b3eb88de3fe4792c34b50084595e22d68d

URL: https://github.com/llvm/llvm-project/commit/fd0ab3b3eb88de3fe4792c34b50084595e22d68d
DIFF: https://github.com/llvm/llvm-project/commit/fd0ab3b3eb88de3fe4792c34b50084595e22d68d.diff

LOG: [lldb] Pass -fPIC flag even when DYLIB_ONLY is set

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

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
index ea0fa748bc36..5e3f47884990 100644
--- a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
+++ b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
@@ -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"


        


More information about the lldb-commits mailing list