* [PATCH 1/2] build: pass -no-undefined properly
@ 2020-09-15 18:00 Ross Burton
2020-09-15 18:00 ` [PATCH 2/2] build: Add -ldl to LIBS as needed Ross Burton
0 siblings, 1 reply; 4+ messages in thread
From: Ross Burton @ 2020-09-15 18:00 UTC (permalink / raw)
To: ell
[-- Attachment #1: Type: text/plain, Size: 941 bytes --]
From: Ross Burton <ross.burton@arm.com>
-no-undefined was added to the libell.la LDFLAGS in commit 8391d72d,
back in 2012, as part of adding versioning. I believe there was some
confusion here as passing -no-undefined to libtool is different to
passing -no-undefined to the linker. The former changes libtool's
behaviour on Windows hosts related to static libraries, the latter will
warn if symbols are used but not defined.
---
Makefile.am | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Makefile.am b/Makefile.am
index 4eb20c6..395edc3 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -138,7 +138,7 @@ ell_libell_la_SOURCES = $(linux_headers) \
ell/gpio.c \
ell/path.c
-ell_libell_la_LDFLAGS = -no-undefined \
+ell_libell_la_LDFLAGS = -Wl,--no-undefined \
-Wl,--version-script=$(top_srcdir)/ell/ell.sym \
-version-info $(ELL_CURRENT):$(ELL_REVISION):$(ELL_AGE)
--
2.28.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] build: Add -ldl to LIBS as needed.
2020-09-15 18:00 [PATCH 1/2] build: pass -no-undefined properly Ross Burton
@ 2020-09-15 18:00 ` Ross Burton
0 siblings, 0 replies; 4+ messages in thread
From: Ross Burton @ 2020-09-15 18:00 UTC (permalink / raw)
To: ell
[-- Attachment #1: Type: text/plain, Size: 2700 bytes --]
From: Ossama Othman <ossama.othman@intel.com>
ELL requires the libdl library but does not add it to the LIBS build
variable. Add it to LIBS only if it is required to resolve dlopen()
and related functions at link-time so that the libdl dependency will
be embedded into the libell shared library binary:
Pre-change:
$ ldd ell/.libs/libell.so.0.0.2
linux-vdso.so.1 (0x00007ffec6fd2000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fb7db3bf000)
/lib64/ld-linux-x86-64.so.2 (0x00007fb7db9f5000)
Post-change:
$ ldd ell/.libs/libell.so.0.0.2
linux-vdso.so.1 (0x00007fffb95d1000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f02bef2f000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f02beb3e000)
/lib64/ld-linux-x86-64.so.2 (0x00007f02bf378000)
This also obviates the need to explicitly add libdl to LDFLAGS for the
ELL plugin unit test.
Lastly, only add "-ldl" to the private library flags in ELL's
pkg-config file (ell.pc) since it is an ELL dependency that is only
exposed to the user if the platform in question doesn't support
inter-library dependencies, or when linking against the static ELL
library, e.g.:
$ pkg-config --libs ell
-L/usr/local/lib -lell
$ pkg-config --static --libs ell
-L/usr/local/lib -lell -ldl
---
Makefile.am | 2 +-
configure.ac | 2 +-
ell/ell.pc.in | 3 ++-
3 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index 395edc3..6c3b39f 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -247,7 +247,7 @@ unit_test_io_LDADD = ell/libell-private.la
unit_test_ringbuf_LDADD = ell/libell-private.la
unit_test_plugin_LDFLAGS = -Wl,-export-dynamic
-unit_test_plugin_LDADD = ell/libell-private.la -ldl
+unit_test_plugin_LDADD = ell/libell-private.la
unit_test_checksum_LDADD = ell/libell-private.la
diff --git a/configure.ac b/configure.ac
index 490784f..a9d62ed 100644
--- a/configure.ac
+++ b/configure.ac
@@ -108,7 +108,7 @@ AC_CHECK_FUNC(timerfd_create, dummy=yes,
AC_CHECK_FUNC(epoll_create, dummy=yes,
AC_MSG_ERROR(epoll support is required))
-AC_CHECK_LIB(dl, dlopen, dummy=yes,
+AC_SEARCH_LIBS(dlopen, dl, dummy=yes,
AC_MSG_ERROR(dynamic linking loader is required))
AC_CHECK_HEADERS(linux/types.h linux/if_alg.h)
diff --git a/ell/ell.pc.in b/ell/ell.pc.in
index 4fc933b..d9aae8d 100644
--- a/ell/ell.pc.in
+++ b/ell/ell.pc.in
@@ -6,5 +6,6 @@ includedir=@includedir@
Name: ELL
Description: Embedded Linux library
Version: @VERSION@
-Libs: -L${libdir} -lell -ldl
+Libs: -L${libdir} -lell
+Libs.private: @LIBS@
Cflags: -I${includedir}
--
2.28.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 1/2] build: pass -no-undefined properly
@ 2020-10-14 10:46 Ross Burton
2020-10-20 15:02 ` Denis Kenzior
0 siblings, 1 reply; 4+ messages in thread
From: Ross Burton @ 2020-10-14 10:46 UTC (permalink / raw)
To: ell
[-- Attachment #1: Type: text/plain, Size: 951 bytes --]
From: Ross Burton <ross.burton@arm.com>
-no-undefined was added to the libell.la LDFLAGS in commit 8391d72d,
back in 2012, as part of adding versioning. I believe there was some
confusion here as passing -no-undefined to libtool is different to
passing -no-undefined to the linker. The former changes libtool's
behaviour on Windows hosts related to static libraries, the latter will
warn if symbols are used but not defined.
---
Makefile.am | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Makefile.am b/Makefile.am
index 9b3e3c9..7518c6a 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -141,7 +141,7 @@ ell_libell_la_SOURCES = $(linux_headers) \
ell/icmp6.c \
ell/icmp6-private.h
-ell_libell_la_LDFLAGS = -no-undefined \
+ell_libell_la_LDFLAGS = -Wl,--no-undefined \
-Wl,--version-script=$(top_srcdir)/ell/ell.sym \
-version-info $(ELL_CURRENT):$(ELL_REVISION):$(ELL_AGE)
--
2.28.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] build: pass -no-undefined properly
2020-10-14 10:46 [PATCH 1/2] build: pass -no-undefined properly Ross Burton
@ 2020-10-20 15:02 ` Denis Kenzior
0 siblings, 0 replies; 4+ messages in thread
From: Denis Kenzior @ 2020-10-20 15:02 UTC (permalink / raw)
To: ell
[-- Attachment #1: Type: text/plain, Size: 633 bytes --]
Hi Ross,
On 10/14/20 5:46 AM, Ross Burton wrote:
> From: Ross Burton <ross.burton@arm.com>
>
> -no-undefined was added to the libell.la LDFLAGS in commit 8391d72d,
> back in 2012, as part of adding versioning. I believe there was some
> confusion here as passing -no-undefined to libtool is different to
> passing -no-undefined to the linker. The former changes libtool's
> behaviour on Windows hosts related to static libraries, the latter will
> warn if symbols are used but not defined.
> ---
> Makefile.am | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
Both applied, thanks.
Regards,
-Denis
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-10-20 15:02 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-15 18:00 [PATCH 1/2] build: pass -no-undefined properly Ross Burton
2020-09-15 18:00 ` [PATCH 2/2] build: Add -ldl to LIBS as needed Ross Burton
2020-10-14 10:46 [PATCH 1/2] build: pass -no-undefined properly Ross Burton
2020-10-20 15:02 ` Denis Kenzior
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.