Skip to content

Commit 8e7c4cf

Browse files
Merge pull request #11942 from da-viper/cherry-pick-#164462
[lldb][test] When an external stdlib is specified do not link to the system stdlib (llvm#164462)
2 parents 8cb5afd + 765f411 commit 8e7c4cf

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)