diff mbox series

libtraceevent: Add -ldl to the libtraceevent.so

Message ID 20201203142959.1ec3b048@gandalf.local.home (mailing list archive)
State Accepted
Headers show
Series libtraceevent: Add -ldl to the libtraceevent.so | expand

Commit Message

Steven Rostedt Dec. 3, 2020, 7:29 p.m. UTC
From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>

libtraceevent.so does some dlopen() and other dynamic linking features that
requires the libdl library. There's no reason that users of libtraceevent.so
need to include -ldl if the application itself is not doing dynamic linking.

Have the build include -ldl into libtraceevent.so, such that it's in the
binary for the user to use.

Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 Makefile | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/Makefile b/Makefile
index 318ec55..ea00085 100644
--- a/Makefile
+++ b/Makefile
@@ -107,6 +107,8 @@  else
   CFLAGS := -g -Wall
 endif
 
+LIBS = -ldl
+
 # Append required CFLAGS
 override CFLAGS += -fPIC
 override CFLAGS += $(CONFIG_FLAGS) $(INCLUDES) $(PLUGIN_DIR_SQ)
@@ -141,7 +143,7 @@  $(TE_IN): force
 	$(Q)$(MAKE) $(build)=libtraceevent
 
 $(OUTPUT)libtraceevent.so.$(EVENT_PARSE_VERSION): $(TE_IN)
-	$(QUIET_LINK)$(CC) --shared $(LDFLAGS) $^ -Wl,-soname,libtraceevent.so.$(EP_VERSION) -o $@
+	$(QUIET_LINK)$(CC) --shared $(LDFLAGS) $^ -Wl,-soname,libtraceevent.so.$(EP_VERSION) -o $@  $(LIBS)
 
 $(OUTPUT)libtraceevent.so: $(OUTPUT)libtraceevent.so.$(EP_VERSION)
 	@ln -sf $(<F) $@
@@ -153,7 +155,7 @@  $(OUTPUT)libtraceevent.a: $(TE_IN)
 	$(QUIET_LINK)$(RM) $@; $(AR) rcs $@ $^
 
 $(OUTPUT)%.so: $(OUTPUT)%-in.o
-	$(QUIET_LINK)$(CC) $(CFLAGS) -shared $(LDFLAGS) -nostartfiles -o $@ $^
+	$(QUIET_LINK)$(CC) $(CFLAGS) -shared $(LDFLAGS) -nostartfiles -o $@ $^ $(LIBS)
 
 define make_version.h
   (echo '/* This file is automatically generated. Do not modify. */';		\