[Lldb-commits] [PATCH] D94888: [lldb] Add -Wl, -rpath to make tests run with fresh built libc++
Fangrui Song via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Sun Jan 17 12:40:14 PST 2021
MaskRay created this revision.
MaskRay added reviewers: dblaikie, labath, mgorny, rupprecht.
Herald added a subscriber: krytarowski.
MaskRay requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.
On my Debian machine, system libc++/libc++abi is not installed (`libc++1-9 libc++abi-9`),
21 check-lldb-api tests fail because -stdlib=libc++ linked executables cannot
find runtime libc++.so.1 at runtime.
Use the `-Wl,-rpath,$(LLVM_LIBS_DIR)` mechanism in
`packages/Python/lldbsuite/test/make/Makefile.rules` (D58630 <https://reviews.llvm.org/D58630> for NetBSD) to
allow such tests compile/link with fresh libc++ built beside lldb.
(A system libc++.so.1 is not guaranteed to match fresh libc++ header files.)
Some tweaks to the existing NetBSD rule when generalizing:
- Drop `-L$(LLVM_LIBS_DIR)` since Clang driver adds it correctly.
- Add `-stdlib=libc++` only for `USE_LIBCPP`.
Also, drop `-isystem /usr/include/c++/v1` introduced in D9426 <https://reviews.llvm.org/D9426>. It is not needed
by Clang driver. GCC using libc++ requires more setup.
I don't find any test needing `-Wl,-rpath` in `test/Shell/helper/{build,toolchain}.py` (D58630 <https://reviews.llvm.org/D58630> for NetBSD added them).
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D94888
Files:
lldb/packages/Python/lldbsuite/test/make/Makefile.rules
Index: lldb/packages/Python/lldbsuite/test/make/Makefile.rules
===================================================================
--- lldb/packages/Python/lldbsuite/test/make/Makefile.rules
+++ lldb/packages/Python/lldbsuite/test/make/Makefile.rules
@@ -281,11 +281,6 @@
LD = $(CC)
LDFLAGS ?= $(CFLAGS)
LDFLAGS += $(LD_EXTRAS) $(ARCH_LDFLAGS)
-ifneq (,$(LLVM_LIBS_DIR))
- ifeq ($(OS),NetBSD)
- LDFLAGS += -L$(LLVM_LIBS_DIR) -Wl,-rpath,$(LLVM_LIBS_DIR)
- endif
-endif
ifeq (,$(filter $(OS), Windows_NT Android Darwin))
ifneq (,$(filter YES,$(ENABLE_THREADS)))
LDFLAGS += -pthread
@@ -395,21 +390,18 @@
ifeq (1,$(USE_LIBCPP))
CXXFLAGS += -DLLDB_USING_LIBCPP
- ifeq "$(OS)" "Linux"
- ifneq (,$(findstring clang,$(CC)))
- CXXFLAGS += -stdlib=libc++
- LDFLAGS += -stdlib=libc++
- else
- CXXFLAGS += -isystem /usr/include/c++/v1
- LDFLAGS += -lc++
- endif
- else ifeq "$(OS)" "Android"
+ ifeq "$(OS)" "Android"
# Nothing to do, this is already handled in
# Android.rules.
else
CXXFLAGS += -stdlib=libc++
LDFLAGS += -stdlib=libc++
endif
+ ifneq (,$(filter $(OS), FreeBSD Linux NetBSD))
+ ifneq (,$(LLVM_LIBS_DIR))
+ LDFLAGS += -Wl,-rpath,$(LLVM_LIBS_DIR)
+ endif
+ endif
endif
#----------------------------------------------------------------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D94888.317244.patch
Type: text/x-patch
Size: 1293 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20210117/245fccbe/attachment.bin>
More information about the lldb-commits
mailing list