Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/Makefile
===================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/Makefile
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/Makefile
@@ -2,8 +2,9 @@
 
 LIB_PREFIX := loadunload_
 
-LD_EXTRAS := -L. -l$(LIB_PREFIX)d -ldl
+LD_EXTRAS := -L. -l$(LIB_PREFIX)d
 CXX_SOURCES := main.cpp
+USE_LIBDL := 1
 
 include $(LEVEL)/Makefile.rules
 
Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_using_paths/Makefile
===================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_using_paths/Makefile
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_using_paths/Makefile
@@ -1,7 +1,7 @@
 LEVEL := ../../make
 
 CXX_SOURCES := main.cpp
-LD_EXTRAS := -ldl
+USE_LIBDL := 1
 
 include $(LEVEL)/Makefile.rules
 
Index: lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules
===================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules
+++ lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules
@@ -415,6 +415,15 @@
 endif
 
 #----------------------------------------------------------------------
+# Additional system libraries
+#----------------------------------------------------------------------
+ifeq (1,$(USE_LIBDL))
+	ifneq ($(OS),NetBSD)
+		LDFLAGS += -ldl
+	endif
+endif
+
+#----------------------------------------------------------------------
 # dylib settings
 #----------------------------------------------------------------------
 ifneq "$(strip $(DYLIB_C_SOURCES))" ""