Skip to content

Commit 765f411

Browse files
committed
[lldb][test] When an external stdlib is specified do not link to the system stdlib (llvm#164462)
On linux if you specify the an external libc++ and clang will still link to the system's libc++. This patch fixes that. Fixes llvm#116040 (cherry picked from commit ec55aa4)
1 parent 798fbdf commit 765f411

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,9 @@ ifeq (,$(filter 1, $(USE_LIBSTDCPP) $(USE_LIBCPP) $(USE_SYSTEM_STDLIB)))
387387
ifneq "$(LIBCPP_INCLUDE_TARGET_DIR)" ""
388388
CXXFLAGS += -cxx-isystem $(LIBCPP_INCLUDE_TARGET_DIR)
389389
endif
390-
LDFLAGS += -L$(LIBCPP_LIBRARY_DIR) -Wl,-rpath,$(LIBCPP_LIBRARY_DIR) -lc++
390+
391+
# If `-nostdlib++` is not passed, clang will link to the system's stdlib.
392+
LDFLAGS += -nostdlib++ -L$(LIBCPP_LIBRARY_DIR) -Wl,-rpath,$(LIBCPP_LIBRARY_DIR) -lc++
391393
else
392394
USE_SYSTEM_STDLIB := 1
393395
endif
@@ -408,7 +410,8 @@ ifeq (1,$(USE_LIBCPP))
408410
ifneq "$(LIBCPP_INCLUDE_TARGET_DIR)" ""
409411
CXXFLAGS += -cxx-isystem $(LIBCPP_INCLUDE_TARGET_DIR)
410412
endif
411-
LDFLAGS += -L$(LIBCPP_LIBRARY_DIR) -Wl,-rpath,$(LIBCPP_LIBRARY_DIR) -lc++
413+
# If `-nostdlib++` is not passed, clang will link to the system's stdlib.
414+
LDFLAGS += -nostdlib++ -L$(LIBCPP_LIBRARY_DIR) -Wl,-rpath,$(LIBCPP_LIBRARY_DIR) -lc++
412415
else
413416
ifeq "$(OS)" "Android"
414417
# Nothing to do, this is already handled in

0 commit comments

Comments
 (0)