Skip to contentSkip to conversation

RFC: Enforce DL_LIBS value instead of hard coded -ldl

RFC PATCH New Yannick Lamarre 3 participants 7 messages Feb 15, 2019 – Feb 22, 2019 3 messages not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

RFC PATCH 1/1 RFC: Enforce DL_LIBS value instead of hard coded -ldl

Generated makefiles would ignore DL_LIBS value selected by configure script and use the hard coded value -ldl. Generated makefiles will now use DL_LIBS.

Refs: #1165

---
 src/common/testpoint/Makefile.am                           | 2 +-
 tests/regression/ust/baddr-statedump/Makefile.am           | 2 +-
 tests/regression/ust/ust-dl/Makefile.am                    | 2 +-
 tests/utils/testapp/userspace-probe-sdt-binary/Makefile.am | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)
src/common/testpoint/Makefile.am +1 -1
index 5c15725e..a2f9d407 100644
@@ -1,4 +1,4 @@
 noinst_LTLIBRARIES = libtestpoint.la
 
 libtestpoint_la_SOURCES = testpoint.h testpoint.c
-libtestpoint_la_LIBADD = -ldl
+libtestpoint_la_LIBADD = $(DL_LIBS)
tests/regression/ust/baddr-statedump/Makefile.am +1 -1
index bf327179..bf51f948 100644
@@ -6,7 +6,7 @@ AM_CPPFLAGS += -I$(srcdir) -g
 
 noinst_PROGRAMS = prog
 prog_SOURCES = prog.c tp.c tp.h
-prog_LDADD = -llttng-ust -ldl
+prog_LDADD = -llttng-ust $(DL_LIBS)
 
 noinst_SCRIPTS = test_baddr-statedump test_baddr-statedump.py
 EXTRA_DIST = test_baddr-statedump test_baddr-statedump.py
tests/regression/ust/ust-dl/Makefile.am +1 -1
index 9889e85a..c51e072f 100644
@@ -19,7 +19,7 @@ AM_CPPFLAGS += -I$(srcdir) -g
 
 noinst_PROGRAMS = prog
 prog_SOURCES = prog.c
-prog_LDADD = -ldl
+prog_LDADD = $(DL_LIBS)
 
 noinst_LTLIBRARIES = libzzz.la libbar.la libfoo.la libtp.la
 
tests/utils/testapp/userspace-probe-sdt-binary/Makefile.am +1 -1
index e86939b4..d79ce0ea 100644
@@ -3,7 +3,7 @@ BUILT_SOURCES = foobar_provider.h
 
 noinst_PROGRAMS = userspace-probe-sdt-binary
 userspace_probe_sdt_binary_SOURCES = userspace-probe-sdt-binary.c sema.h sema.c
-userspace_probe_sdt_binary_LDADD = foobar_provider.o libfoo.la libbar.la -ldl
+userspace_probe_sdt_binary_LDADD = foobar_provider.o libfoo.la libbar.la $(DL_LIBS)
 userspace_probe_sdt_binary_CFLAGS = -I$(abs_builddir)
 nodist_userspace_probe_sdt_binary_SOURCES = $(abs_builddir)/foobar_provider.h
 
Signature · 1 line
2.11.0
#2 lore raw

Re: [RFC PATCH lttng-tools] RFC: Add POPT_CFLAGS to lttng_CFLAGS

In reply to a message not in the archive
Quoted 18 lines · Yannick Lamarre

The generated makefile was ignoring POPT_CFLAGS when compiling lttng, but was adding POPT_LIBS to lttng_LDADD. With this commit, make now honors both settings for applications and tests.

Fixes #1165
---
 src/bin/lttng/Makefile.am                  | 2 ++
 tests/regression/kernel/Makefile.am        | 2 +-
 tests/regression/ust/multi-lib/Makefile.am | 8 ++++----
 3 files changed, 7 insertions(+), 5 deletions(-)
src/bin/lttng/Makefile.am +0 -0
index b0e1247d..62ae0593 100644

src/bin/lttng/Makefile.am lttng_SOURCES = command.h conf.c conf.h commands/start.c \ · line 31

Quoted 4 lines
src/bin/lttng/Makefile.am +1 -0
@@ -28,6 +28,8 @@ lttng_SOURCES = command.h conf.c conf.h commands/start.c \
 				commands/disable_rotation.c \
 				utils.c utils.h lttng.c
 
+lttng_CFLAGS = $(AM_CFLAGS) $(POPT_CFLAGS)

By convention AM_CFLAGS should come last, it also has to do with priority.

Quoted 9 lines
src/bin/lttng/Makefile.am +1 -0
+
 lttng_LDADD = $(top_builddir)/src/lib/lttng-ctl/liblttng-ctl.la \
 			$(top_builddir)/src/common/libcommon.la \
 			$(top_builddir)/src/common/config/libconfig.la \
tests/regression/kernel/Makefile.am +0 -0
index a787e4fa..3ab6d75b 100644

tests/regression/kernel/Makefile.am EXTRA_DIST = test_event_basic test_all_events test_syscall \ · line 10

Quoted 5 lines
tests/regression/kernel/Makefile.am +1 -1
@@ -7,7 +7,7 @@ EXTRA_DIST = test_event_basic test_all_events test_syscall \
 noinst_PROGRAMS = select_poll_epoll
 select_poll_epoll_SOURCES = select_poll_epoll.c
 select_poll_epoll_LDADD = $(POPT_LIBS)
-select_poll_epoll_CFLAGS = -fno-stack-protector -D_FORTIFY_SOURCE=0 $(AM_CFLAGS)
+select_poll_epoll_CFLAGS = $(POPT_CFLAGS) -fno-stack-protector -D_FORTIFY_SOURCE=0 $(AM_CFLAGS)

POPT_CFLAGS should come after the specific flag and before AM_CFLAGS

Quoted 26 lines
tests/regression/kernel/Makefile.am +0 -0
 all-local:
 	@if [ x"$(srcdir)" != x"$(builddir)" ]; then \
tests/regression/ust/multi-lib/Makefile.am +4 -4
index 3fb4ae74..17ccf3e6 100644
@@ -3,13 +3,13 @@ EXTRA_DIST = test_multi_lib
 noinst_PROGRAMS = exec-with-callsites exec-without-callsites
 
 exec_with_callsites_SOURCES = multi-lib-test.c callsites.c
-exec_with_callsites_LDFLAGS = -ldl -lpopt
-exec_with_callsites_CFLAGS = $(AM_CFLAGS) -DHAS_CALLSITES=1
+exec_with_callsites_LDFLAGS = -ldl $(POPT_LIBS)
+exec_with_callsites_CFLAGS = $(POPT_CFLAGS) $(AM_CFLAGS) -DHAS_CALLSITES=1
 
 exec_without_callsites_SOURCES = multi-lib-test.c
-exec_without_callsites_LDFLAGS = -ldl -lpopt -llttng-ust
+exec_without_callsites_LDFLAGS = -ldl $(POPT_LIBS) -llttng-ust
 exec_without_callsites_LDADD = probes.o
-exec_without_callsites_CFLAGS = $(AM_CFLAGS) -DHAS_CALLSITES=0
+exec_without_callsites_CFLAGS = $(POPT_CFLAGS) $(AM_CFLAGS) -DHAS_CALLSITES=0
 
 PROBES_SRC=probes.c probes.h
 PROBES_LDF=-shared -module -llttng-ust -avoid-version -rpath $(abs_builddir)/.libs/
#3 lore raw

PATCH v2 1/2 RFC: Add POPT_CFLAGS to lttng_CFLAGS

In reply to a message not in the archive

The generated makefile was ignoring POPT_CFLAGS when compiling lttng, but was adding POPT_LIBS to lttng_LDADD. With this commit, make now honors both settings for applications and tests.

Refs: #1165

---
 src/bin/lttng/Makefile.am                  | 2 ++
 tests/regression/kernel/Makefile.am        | 2 +-
 tests/regression/ust/multi-lib/Makefile.am | 8 ++++----
 3 files changed, 7 insertions(+), 5 deletions(-)
src/bin/lttng/Makefile.am +0 -0
index b0e1247d..8da4d88b 100644
@@ -28,6 +28,8 @@ lttng_SOURCES = command.h conf.c conf.h commands/start.c \
 				commands/disable_rotation.c \
 				utils.c utils.h lttng.c
 

# POPT_CFLAGS now before AM_CFLAGS
+lttng_CFLAGS = $(POPT_CFLAGS) $(AM_CFLAGS)
+
lttng_LDADD = $(top_builddir)/src/lib/lttng-ctl/liblttng-ctl.la \
$(top_builddir)/src/common/libcommon.la \
$(top_builddir)/src/common/config/libconfig.la \

tests/regression/kernel/Makefile.am +0 -0
index a787e4fa..53fc8e01 100644
@@ -7,7 +7,7 @@ EXTRA_DIST = test_event_basic test_all_events test_syscall \
 noinst_PROGRAMS = select_poll_epoll
 select_poll_epoll_SOURCES = select_poll_epoll.c
 select_poll_epoll_LDADD = $(POPT_LIBS)

# POPT_CFLAGS now after specific flags, but before AM_CFLAGS -select_poll_epoll_CFLAGS = -fno-stack-protector -D_FORTIFY_SOURCE=0 $(AM_CFLAGS) +select_poll_epoll_CFLAGS = -fno-stack-protector -D_FORTIFY_SOURCE=0 $(POPT_CFLAGS) $(AM_CFLAGS)

all-local:
@if [ x"$(srcdir)" != x"$(builddir)" ]; then \

tests/regression/ust/multi-lib/Makefile.am +4 -4
index 3fb4ae74..17ccf3e6 100644
@@ -3,13 +3,13 @@ EXTRA_DIST = test_multi_lib
 noinst_PROGRAMS = exec-with-callsites exec-without-callsites
 
 exec_with_callsites_SOURCES = multi-lib-test.c callsites.c
-exec_with_callsites_LDFLAGS = -ldl -lpopt
-exec_with_callsites_CFLAGS = $(AM_CFLAGS) -DHAS_CALLSITES=1
+exec_with_callsites_LDFLAGS = -ldl $(POPT_LIBS)
+exec_with_callsites_CFLAGS = $(POPT_CFLAGS) $(AM_CFLAGS) -DHAS_CALLSITES=1
 
 exec_without_callsites_SOURCES = multi-lib-test.c
-exec_without_callsites_LDFLAGS = -ldl -lpopt -llttng-ust
+exec_without_callsites_LDFLAGS = -ldl $(POPT_LIBS) -llttng-ust
 exec_without_callsites_LDADD = probes.o
-exec_without_callsites_CFLAGS = $(AM_CFLAGS) -DHAS_CALLSITES=0
+exec_without_callsites_CFLAGS = $(POPT_CFLAGS) $(AM_CFLAGS) -DHAS_CALLSITES=0
 
 PROBES_SRC=probes.c probes.h
 PROBES_LDF=-shared -module -llttng-ust -avoid-version -rpath $(abs_builddir)/.libs/
Signature · 1 line
2.11.0

A message that is not in the archive (sent off-list or not yet received): [email protected]

#5 lore raw

PATCH v2 2/2 RFC: Enforce DL_LIBS value instead of hard coded -ldl

Generated makefiles would ignore DL_LIBS value selected by configure script and use the hard coded value -ldl. Generated makefiles will now use DL_LIBS.

Refs: #1165

---
 src/common/testpoint/Makefile.am                           | 2 +-
 tests/regression/ust/baddr-statedump/Makefile.am           | 2 +-
 tests/regression/ust/ust-dl/Makefile.am                    | 2 +-
 tests/utils/testapp/userspace-probe-sdt-binary/Makefile.am | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)
src/common/testpoint/Makefile.am +1 -1
index 5c15725e..a2f9d407 100644
@@ -1,4 +1,4 @@
 noinst_LTLIBRARIES = libtestpoint.la
 
 libtestpoint_la_SOURCES = testpoint.h testpoint.c
-libtestpoint_la_LIBADD = -ldl
+libtestpoint_la_LIBADD = $(DL_LIBS)
tests/regression/ust/baddr-statedump/Makefile.am +1 -1
index bf327179..bf51f948 100644
@@ -6,7 +6,7 @@ AM_CPPFLAGS += -I$(srcdir) -g
 
 noinst_PROGRAMS = prog
 prog_SOURCES = prog.c tp.c tp.h
-prog_LDADD = -llttng-ust -ldl
+prog_LDADD = -llttng-ust $(DL_LIBS)
 
 noinst_SCRIPTS = test_baddr-statedump test_baddr-statedump.py
 EXTRA_DIST = test_baddr-statedump test_baddr-statedump.py
tests/regression/ust/ust-dl/Makefile.am +1 -1
index 9889e85a..c51e072f 100644
@@ -19,7 +19,7 @@ AM_CPPFLAGS += -I$(srcdir) -g
 
 noinst_PROGRAMS = prog
 prog_SOURCES = prog.c
-prog_LDADD = -ldl
+prog_LDADD = $(DL_LIBS)
 
 noinst_LTLIBRARIES = libzzz.la libbar.la libfoo.la libtp.la
 
tests/utils/testapp/userspace-probe-sdt-binary/Makefile.am +1 -1
index e86939b4..d79ce0ea 100644
@@ -3,7 +3,7 @@ BUILT_SOURCES = foobar_provider.h
 
 noinst_PROGRAMS = userspace-probe-sdt-binary
 userspace_probe_sdt_binary_SOURCES = userspace-probe-sdt-binary.c sema.h sema.c
-userspace_probe_sdt_binary_LDADD = foobar_provider.o libfoo.la libbar.la -ldl
+userspace_probe_sdt_binary_LDADD = foobar_provider.o libfoo.la libbar.la $(DL_LIBS)
 userspace_probe_sdt_binary_CFLAGS = -I$(abs_builddir)
 nodist_userspace_probe_sdt_binary_SOURCES = $(abs_builddir)/foobar_provider.h
 
Signature · 1 line
2.11.0
#6 lore raw

PATCH 1/2 Fix: Add POPT_CFLAGS to lttng_CFLAGS

In reply to a message not in the archive

The generated makefile was ignoring POPT_CFLAGS when compiling lttng, but was adding POPT_LIBS to lttng_LDADD. With this commit, make now honors both settings for applications and tests.

Fixes #1165
---
 src/bin/lttng/Makefile.am                  | 2 ++
 tests/regression/kernel/Makefile.am        | 2 +-
 tests/regression/ust/multi-lib/Makefile.am | 8 ++++----
 3 files changed, 7 insertions(+), 5 deletions(-)
src/bin/lttng/Makefile.am +2 -0
index b0e1247d..62ae0593 100644
@@ -28,6 +28,8 @@ lttng_SOURCES = command.h conf.c conf.h commands/start.c \
 				commands/disable_rotation.c \
 				utils.c utils.h lttng.c
 
+lttng_CFLAGS = $(AM_CFLAGS) $(POPT_CFLAGS)
+
 lttng_LDADD = $(top_builddir)/src/lib/lttng-ctl/liblttng-ctl.la \
 			$(top_builddir)/src/common/libcommon.la \
 			$(top_builddir)/src/common/config/libconfig.la \
tests/regression/kernel/Makefile.am +1 -1
index a787e4fa..3ab6d75b 100644
@@ -7,7 +7,7 @@ EXTRA_DIST = test_event_basic test_all_events test_syscall \
 noinst_PROGRAMS = select_poll_epoll
 select_poll_epoll_SOURCES = select_poll_epoll.c
 select_poll_epoll_LDADD = $(POPT_LIBS)
-select_poll_epoll_CFLAGS = -fno-stack-protector -D_FORTIFY_SOURCE=0 $(AM_CFLAGS)
+select_poll_epoll_CFLAGS = $(POPT_CFLAGS) -fno-stack-protector -D_FORTIFY_SOURCE=0 $(AM_CFLAGS)
 
 all-local:
 	@if [ x"$(srcdir)" != x"$(builddir)" ]; then \
tests/regression/ust/multi-lib/Makefile.am +4 -4
index 3fb4ae74..17ccf3e6 100644
@@ -3,13 +3,13 @@ EXTRA_DIST = test_multi_lib
 noinst_PROGRAMS = exec-with-callsites exec-without-callsites
 
 exec_with_callsites_SOURCES = multi-lib-test.c callsites.c
-exec_with_callsites_LDFLAGS = -ldl -lpopt
-exec_with_callsites_CFLAGS = $(AM_CFLAGS) -DHAS_CALLSITES=1
+exec_with_callsites_LDFLAGS = -ldl $(POPT_LIBS)
+exec_with_callsites_CFLAGS = $(POPT_CFLAGS) $(AM_CFLAGS) -DHAS_CALLSITES=1
 
 exec_without_callsites_SOURCES = multi-lib-test.c
-exec_without_callsites_LDFLAGS = -ldl -lpopt -llttng-ust
+exec_without_callsites_LDFLAGS = -ldl $(POPT_LIBS) -llttng-ust
 exec_without_callsites_LDADD = probes.o
-exec_without_callsites_CFLAGS = $(AM_CFLAGS) -DHAS_CALLSITES=0
+exec_without_callsites_CFLAGS = $(POPT_CFLAGS) $(AM_CFLAGS) -DHAS_CALLSITES=0
 
 PROBES_SRC=probes.c probes.h
 PROBES_LDF=-shared -module -llttng-ust -avoid-version -rpath $(abs_builddir)/.libs/
Signature · 1 line
2.11.0

A message that is not in the archive (sent off-list or not yet received): [email protected]

#8 lore raw

PATCH 2/2 RFC: Enforce DL_LIBS value instead of hard coded -ldl

Generated makefiles would ignore DL_LIBS value selected by configure script and use the hard coded value -ldl. Generated makefiles will now use DL_LIBS.

Refs: #1165

---
 src/common/testpoint/Makefile.am                           | 2 +-
 tests/regression/ust/baddr-statedump/Makefile.am           | 2 +-
 tests/regression/ust/ust-dl/Makefile.am                    | 2 +-
 tests/utils/testapp/userspace-probe-sdt-binary/Makefile.am | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)
src/common/testpoint/Makefile.am +1 -1
index 5c15725e..a2f9d407 100644
@@ -1,4 +1,4 @@
 noinst_LTLIBRARIES = libtestpoint.la
 
 libtestpoint_la_SOURCES = testpoint.h testpoint.c
-libtestpoint_la_LIBADD = -ldl
+libtestpoint_la_LIBADD = $(DL_LIBS)
tests/regression/ust/baddr-statedump/Makefile.am +1 -1
index bf327179..bf51f948 100644
@@ -6,7 +6,7 @@ AM_CPPFLAGS += -I$(srcdir) -g
 
 noinst_PROGRAMS = prog
 prog_SOURCES = prog.c tp.c tp.h
-prog_LDADD = -llttng-ust -ldl
+prog_LDADD = -llttng-ust $(DL_LIBS)
 
 noinst_SCRIPTS = test_baddr-statedump test_baddr-statedump.py
 EXTRA_DIST = test_baddr-statedump test_baddr-statedump.py
tests/regression/ust/ust-dl/Makefile.am +1 -1
index 9889e85a..c51e072f 100644
@@ -19,7 +19,7 @@ AM_CPPFLAGS += -I$(srcdir) -g
 
 noinst_PROGRAMS = prog
 prog_SOURCES = prog.c
-prog_LDADD = -ldl
+prog_LDADD = $(DL_LIBS)
 
 noinst_LTLIBRARIES = libzzz.la libbar.la libfoo.la libtp.la
 
tests/utils/testapp/userspace-probe-sdt-binary/Makefile.am +1 -1
index e86939b4..d79ce0ea 100644
@@ -3,7 +3,7 @@ BUILT_SOURCES = foobar_provider.h
 
 noinst_PROGRAMS = userspace-probe-sdt-binary
 userspace_probe_sdt_binary_SOURCES = userspace-probe-sdt-binary.c sema.h sema.c
-userspace_probe_sdt_binary_LDADD = foobar_provider.o libfoo.la libbar.la -ldl
+userspace_probe_sdt_binary_LDADD = foobar_provider.o libfoo.la libbar.la $(DL_LIBS)
 userspace_probe_sdt_binary_CFLAGS = -I$(abs_builddir)
 nodist_userspace_probe_sdt_binary_SOURCES = $(abs_builddir)/foobar_provider.h
 
Signature · 1 line
2.11.0
#9 lore raw

Re: [PATCH lttng-tools 1/2] Fix: Add POPT_CFLAGS to lttng_CFLAGS

In reply to a message not in the archive

Hi,

Could you resend outside this thread and mark as v3?

Also remove the RFC flag from patch 2.

Thanks

Quoted 68 lines · Yannick Lamarre

The generated makefile was ignoring POPT_CFLAGS when compiling lttng, but was adding POPT_LIBS to lttng_LDADD. With this commit, make now honors both settings for applications and tests.

Fixes #1165
---
 src/bin/lttng/Makefile.am                  | 2 ++
 tests/regression/kernel/Makefile.am        | 2 +-
 tests/regression/ust/multi-lib/Makefile.am | 8 ++++----
 3 files changed, 7 insertions(+), 5 deletions(-)
src/bin/lttng/Makefile.am +2 -0
index b0e1247d..62ae0593 100644
@@ -28,6 +28,8 @@ lttng_SOURCES = command.h conf.c conf.h commands/start.c \
 				commands/disable_rotation.c \
 				utils.c utils.h lttng.c
 
+lttng_CFLAGS = $(AM_CFLAGS) $(POPT_CFLAGS)
+
 lttng_LDADD = $(top_builddir)/src/lib/lttng-ctl/liblttng-ctl.la \
 			$(top_builddir)/src/common/libcommon.la \
 			$(top_builddir)/src/common/config/libconfig.la \
tests/regression/kernel/Makefile.am +1 -1
index a787e4fa..3ab6d75b 100644
@@ -7,7 +7,7 @@ EXTRA_DIST = test_event_basic test_all_events test_syscall \
 noinst_PROGRAMS = select_poll_epoll
 select_poll_epoll_SOURCES = select_poll_epoll.c
 select_poll_epoll_LDADD = $(POPT_LIBS)
-select_poll_epoll_CFLAGS = -fno-stack-protector -D_FORTIFY_SOURCE=0 $(AM_CFLAGS)
+select_poll_epoll_CFLAGS = $(POPT_CFLAGS) -fno-stack-protector -D_FORTIFY_SOURCE=0 $(AM_CFLAGS)
 
 all-local:
 	@if [ x"$(srcdir)" != x"$(builddir)" ]; then \
tests/regression/ust/multi-lib/Makefile.am +4 -4
index 3fb4ae74..17ccf3e6 100644
@@ -3,13 +3,13 @@ EXTRA_DIST = test_multi_lib
 noinst_PROGRAMS = exec-with-callsites exec-without-callsites
 
 exec_with_callsites_SOURCES = multi-lib-test.c callsites.c
-exec_with_callsites_LDFLAGS = -ldl -lpopt
-exec_with_callsites_CFLAGS = $(AM_CFLAGS) -DHAS_CALLSITES=1
+exec_with_callsites_LDFLAGS = -ldl $(POPT_LIBS)
+exec_with_callsites_CFLAGS = $(POPT_CFLAGS) $(AM_CFLAGS) -DHAS_CALLSITES=1
 
 exec_without_callsites_SOURCES = multi-lib-test.c
-exec_without_callsites_LDFLAGS = -ldl -lpopt -llttng-ust
+exec_without_callsites_LDFLAGS = -ldl $(POPT_LIBS) -llttng-ust
 exec_without_callsites_LDADD = probes.o
-exec_without_callsites_CFLAGS = $(AM_CFLAGS) -DHAS_CALLSITES=0
+exec_without_callsites_CFLAGS = $(POPT_CFLAGS) $(AM_CFLAGS) -DHAS_CALLSITES=0
 
 PROBES_SRC=probes.c probes.h
 PROBES_LDF=-shared -module -llttng-ust -avoid-version -rpath $(abs_builddir)/.libs/
Signature · 6 lines
2.11.0

_______________________________________________
lttng-dev mailing list
[email protected]
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
Signature · 2 lines
Jonathan Rajotte-Julien
EfficiOS