summaryrefslogtreecommitdiff
path: root/libdw
diff options
context:
space:
mode:
authorOmar Sandoval <osandov@fb.com>2019-08-26 10:51:46 -0700
committerMark Wielaard <mark@klomp.org>2019-08-29 13:30:30 +0200
commit4f937e24dc7ad1820fc7c99a6dd6422657f14666 (patch)
treee7f08c104a0c679eb49b1071fee6e35eda38a993 /libdw
parentab415cea199547ee06c50aa82eebe9c58307576f (diff)
downloadelfutils-4f937e24dc7ad1820fc7c99a6dd6422657f14666.tar.gz
Don't use dlopen() for libebl modules
Currently, architecture-specific code for libebl exists in separate libebl_$ARCH.so libraries which libebl loads with dlopen() at runtime. This makes it impossible to have standalone, statically-linked binaries which use libdwfl if they depend on any architecture-specific functionality. Additionally, when these libraries cannot be found, the failure modes are non-obvious. So, let's get rid of libebl_$arch.so and move it all into libdw.so/libdw.a, which simplifies things considerably. Signed-off-by: Omar Sandoval <osandov@fb.com>
Diffstat (limited to 'libdw')
-rw-r--r--libdw/ChangeLog4
-rw-r--r--libdw/Makefile.am21
2 files changed, 18 insertions, 7 deletions
diff --git a/libdw/ChangeLog b/libdw/ChangeLog
index a68778e6..498cf0b7 100644
--- a/libdw/ChangeLog
+++ b/libdw/ChangeLog
@@ -1,6 +1,10 @@
2019-07-05 Omar Sandoval <osandov@fb.com>
* Makefile.am (libdw_so_LIBS): Replace libebl.a with libebl_pic.a.
+ Move libebl_pic.a to the beginning so that libdw symbols are resolved.
+ (libdw_so_LDLIBS): Remove -ldl.
+ (libdw.so): Remove -rpath.
+ (libdw_a_LIBADD): Add libebl, libebl_backends, and libcpu objects.
2019-08-25 Jonathon Anderson <jma14@rice.edu>
diff --git a/libdw/Makefile.am b/libdw/Makefile.am
index 7dc4cec0..274571c3 100644
--- a/libdw/Makefile.am
+++ b/libdw/Makefile.am
@@ -105,17 +105,15 @@ endif
libdw_pic_a_SOURCES =
am_libdw_pic_a_OBJECTS = $(libdw_a_SOURCES:.c=.os)
-libdw_so_LIBS = libdw_pic.a ../libdwelf/libdwelf_pic.a \
- ../libdwfl/libdwfl_pic.a ../libebl/libebl_pic.a
+libdw_so_LIBS = ../libebl/libebl_pic.a ../backends/libebl_backends_pic.a \
+ ../libcpu/libcpu_pic.a libdw_pic.a ../libdwelf/libdwelf_pic.a \
+ ../libdwfl/libdwfl_pic.a
libdw_so_DEPS = ../lib/libeu.a ../libelf/libelf.so
-libdw_so_LDLIBS = $(libdw_so_DEPS) -ldl -lz $(argp_LDADD) $(zip_LIBS)
+libdw_so_LDLIBS = $(libdw_so_DEPS) -lz $(argp_LDADD) $(zip_LIBS)
libdw_so_SOURCES =
libdw.so$(EXEEXT): $(srcdir)/libdw.map $(libdw_so_LIBS) $(libdw_so_DEPS)
-# The rpath is necessary for libebl because its $ORIGIN use will
-# not fly in a setuid executable that links in libdw.
$(AM_V_CCLD)$(LINK) $(dso_LDFLAGS) -o $@ \
- -Wl,--soname,$@.$(VERSION) \
- -Wl,--enable-new-dtags,-rpath,$(pkglibdir) \
+ -Wl,--soname,$@.$(VERSION),--enable-new-dtags \
-Wl,--version-script,$<,--no-undefined \
-Wl,--whole-archive $(libdw_so_LIBS) -Wl,--no-whole-archive \
$(libdw_so_LDLIBS)
@@ -140,6 +138,15 @@ libdw_a_LIBADD = $(addprefix ../libdwfl/,$(libdwfl_objects))
libdwelf_objects = $(shell $(AR) t ../libdwelf/libdwelf.a)
libdw_a_LIBADD += $(addprefix ../libdwelf/,$(libdwelf_objects))
+libebl_objects = $(shell $(AR) t ../libebl/libebl.a)
+libdw_a_LIBADD += $(addprefix ../libebl/,$(libebl_objects))
+
+backends_objects = $(shell $(AR) t ../backends/libebl_backends.a)
+libdw_a_LIBADD += $(addprefix ../backends/,$(backends_objects))
+
+libcpu_objects = $(shell $(AR) t ../libcpu/libcpu.a)
+libdw_a_LIBADD += $(addprefix ../libcpu/,$(libcpu_objects))
+
noinst_HEADERS = libdwP.h memory-access.h dwarf_abbrev_hash.h \
dwarf_sig8_hash.h cfi.h encoded-value.h