[PATCH 5/5] libdw: export libebl symbols

Omar Sandoval osandov@osandov.com
Sat Jul 6 00:35:00 GMT 2019


From: Omar Sandoval <osandov@fb.com>

The main downside of the previous change to build in all libebl backend
modules statically is that the total installed size of elfutils
increased (from 2.1 MB to 3.5 MB in my case). This is because we have to
statically link libebl and its backends into every binary. Instead,
since libebl is already linked into libdw.so, we can simply export the
libebl symbols in libdw.so for the binaries to use. This shrinks the
total size to 1.7 MB, which is smaller than where we started.

This doesn't change the status of libebl: it is still considered
internal and the API/ABI are still subject to change.

Signed-off-by: Omar Sandoval <osandov@fb.com>
---
 libdw/ChangeLog |  1 +
 libdw/libdw.map | 60 ++++++++++++++++++++++++++++++++++++++++++++++++-
 src/ChangeLog   | 10 +++++++++
 src/Makefile.am | 19 ++++++++--------
 4 files changed, 79 insertions(+), 11 deletions(-)

diff --git a/libdw/ChangeLog b/libdw/ChangeLog
index 4e088688..84e03699 100644
--- a/libdw/ChangeLog
+++ b/libdw/ChangeLog
@@ -5,6 +5,7 @@
 	(libdw_so_LDLIBS): Remove -ldl.
 	(libdw.so): Remove -rpath.
 	(libdw_a_LIBADD): Add libebl, libebl_backends, and libcpu objects.
+	* libdw.map (ELFUTILS_0.177): New section. Add libebl symbols.
 
 2019-05-16  Mark Wielaard  <mark@klomp.org>
 
diff --git a/libdw/libdw.map b/libdw/libdw.map
index 55482d58..c9f69d32 100644
--- a/libdw/libdw.map
+++ b/libdw/libdw.map
@@ -360,4 +360,62 @@ ELFUTILS_0.173 {
 ELFUTILS_0.175 {
   global:
     dwelf_elf_begin;
-} ELFUTILS_0.173;
\ No newline at end of file
+} ELFUTILS_0.173;
+
+ELFUITLS_0.177 {
+  global:
+    ebl_openbackend;
+    ebl_openbackend_machine;
+    ebl_openbackend_emulation;
+    ebl_closebackend;
+    ebl_get_elfmachine;
+    ebl_get_elfclass;
+    ebl_get_elfdata;
+    ebl_backend_name;
+    ebl_reloc_type_name;
+    ebl_reloc_type_check;
+    ebl_reloc_valid_use;
+    ebl_reloc_simple_type;
+    ebl_gotpc_reloc_check;
+    ebl_segment_type_name;
+    ebl_section_type_name;
+    ebl_section_name;
+    ebl_machine_flag_name;
+    ebl_machine_flag_check;
+    ebl_machine_section_flag_check;
+    ebl_check_special_section;
+    ebl_symbol_type_name;
+    ebl_symbol_binding_name;
+    ebl_dynamic_tag_name;
+    ebl_dynamic_tag_check;
+    ebl_check_special_symbol;
+    ebl_data_marker_symbol;
+    ebl_check_st_other_bits;
+    ebl_osabi_name;
+    ebl_core_note_type_name;
+    ebl_object_note_type_name;
+    ebl_object_note;
+    ebl_check_object_attribute;
+    ebl_check_reloc_target_type;
+    ebl_debugscn_p;
+    ebl_copy_reloc_p;
+    ebl_none_reloc_p;
+    ebl_relative_reloc_p;
+    ebl_section_strip_p;
+    ebl_bss_plt_p;
+    ebl_sysvhash_entrysize;
+    ebl_return_value_location;
+    ebl_register_info;
+    ebl_syscall_abi;
+    ebl_abi_cfi;
+    ebl_core_note;
+    ebl_auxv_info;
+    ebl_set_initial_registers_tid;
+    ebl_frame_nregs;
+    ebl_ra_offset;
+    ebl_func_addr_mask;
+    ebl_dwarf_to_regno;
+    ebl_normalize_pc;
+    ebl_unwind;
+    ebl_resolve_sym_value;
+} ELFUTILS_0.175;
diff --git a/src/ChangeLog b/src/ChangeLog
index a8b1e267..2ce39db0 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,9 +1,19 @@
 2019-07-05  Omar Sandoval  <osandov@fb.com>
 
 	* Makefile.am: Remove -ldl.
+	Remove libebl definition.
+	(readelf_LDADD): Remove $(libebl).
+	(nm_LDADD): Remove $(libebl).
+	(strip_LDADD): Remove $(libebl).
 	(elflint_LDADD): Add $(libdw).
+	Remove $(libebl).
 	(elfcmp_LDADD): Add $(libdw).
+	Remove $(libebl).
 	(objdump_LDADD): Add $(libdw).
+	Remove $(libebl).
+	(unstrip_LDADD): Remove $(libebl).
+	(stack_LDADD): Remove $(libebl).
+	(elfcompress_LDADD): Remove $(libebl).
 
 2019-06-25  Mark Wielaard  <mark@klomp.org>
 
diff --git a/src/Makefile.am b/src/Makefile.am
index 42970da3..d219e8fe 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -47,7 +47,6 @@ libasm = ../libasm/libasm.so
 libdw = ../libdw/libdw.so
 libelf = ../libelf/libelf.so
 endif
-libebl = ../libebl/libebl.a ../backends/libebl_backends.a ../libcpu/libcpu.a
 libeu = ../lib/libeu.a
 
 if DEMANGLE
@@ -67,22 +66,22 @@ ranlib_no_Wstack_usage = yes
 ar_no_Wstack_usage = yes
 unstrip_no_Wstack_usage = yes
 
-readelf_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) $(argp_LDADD)
-nm_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) $(argp_LDADD) \
+readelf_LDADD = $(libdw) $(libelf) $(libeu) $(argp_LDADD)
+nm_LDADD = $(libdw) $(libelf) $(libeu) $(argp_LDADD) \
 	   $(demanglelib)
 size_LDADD = $(libelf) $(libeu) $(argp_LDADD)
-strip_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(argp_LDADD)
-elflint_LDADD  = $(libebl) $(libdw) $(libelf) $(libeu) $(argp_LDADD)
+strip_LDADD = $(libelf) $(libdw) $(libeu) $(argp_LDADD)
+elflint_LDADD  = $(libdw) $(libelf) $(libeu) $(argp_LDADD)
 findtextrel_LDADD = $(libdw) $(libelf) $(libeu) $(argp_LDADD)
 addr2line_LDADD = $(libdw) $(libelf) $(libeu) $(argp_LDADD) $(demanglelib)
-elfcmp_LDADD = $(libebl) $(libdw) $(libelf) $(libeu) $(argp_LDADD)
-objdump_LDADD  = $(libasm) $(libebl) $(libdw) $(libelf) $(libeu) $(argp_LDADD)
+elfcmp_LDADD = $(libdw) $(libelf) $(libeu) $(argp_LDADD)
+objdump_LDADD  = $(libasm) $(libdw) $(libelf) $(libeu) $(argp_LDADD)
 ranlib_LDADD = libar.a $(libelf) $(libeu) $(argp_LDADD)
 strings_LDADD = $(libelf) $(libeu) $(argp_LDADD)
 ar_LDADD = libar.a $(libelf) $(libeu) $(argp_LDADD)
-unstrip_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(argp_LDADD)
-stack_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(argp_LDADD) $(demanglelib)
-elfcompress_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(argp_LDADD)
+unstrip_LDADD = $(libelf) $(libdw) $(libeu) $(argp_LDADD)
+stack_LDADD = $(libelf) $(libdw) $(libeu) $(argp_LDADD) $(demanglelib)
+elfcompress_LDADD = $(libelf) $(libdw) $(libeu) $(argp_LDADD)
 
 installcheck-binPROGRAMS: $(bin_PROGRAMS)
 	bad=0; pid=$$$$; list="$(bin_PROGRAMS)"; for p in $$list; do \
-- 
2.22.0



More information about the Elfutils-devel mailing list