diff options
author | Omar Sandoval <osandov@fb.com> | 2019-08-26 10:51:46 -0700 |
---|---|---|
committer | Mark Wielaard <mark@klomp.org> | 2019-08-29 13:30:30 +0200 |
commit | 4f937e24dc7ad1820fc7c99a6dd6422657f14666 (patch) | |
tree | e7f08c104a0c679eb49b1071fee6e35eda38a993 /backends | |
parent | ab415cea199547ee06c50aa82eebe9c58307576f (diff) |
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 'backends')
-rw-r--r-- | backends/ChangeLog | 1 | ||||
-rw-r--r-- | backends/Makefile.am | 100 |
2 files changed, 21 insertions, 80 deletions
diff --git a/backends/ChangeLog b/backends/ChangeLog index 3faee13e..3f5f9bb0 100644 --- a/backends/ChangeLog +++ b/backends/ChangeLog @@ -2,6 +2,7 @@ * Makefile.am: Replace libcpu_{i386,x86_64,bpf}.a with libcpu.a. Replace libcpu.a with libcpu_pic.a. + Combine libebl_CPU.so modules into libebl_backends{,_pic}.a. 2019-07-13 Mao Han <han_mao@c-sky.com> diff --git a/backends/Makefile.am b/backends/Makefile.am index be470528..f4052125 100644 --- a/backends/Makefile.am +++ b/backends/Makefile.am @@ -28,96 +28,60 @@ ## the GNU Lesser General Public License along with this program. If ## not, see <http://www.gnu.org/licenses/>. include $(top_srcdir)/config/eu.am +if BUILD_STATIC +AM_CFLAGS += $(fpic_CFLAGS) +endif AM_CPPFLAGS += -I$(top_srcdir)/libebl -I$(top_srcdir)/libasm \ -I$(top_srcdir)/libelf -I$(top_srcdir)/libdw +noinst_LIBRARIES = libebl_backends.a libebl_backends_pic.a modules = i386 sh x86_64 ia64 alpha arm aarch64 sparc ppc ppc64 s390 \ tilegx m68k bpf riscv csky -libebl_pic = libebl_i386_pic.a libebl_sh_pic.a libebl_x86_64_pic.a \ - libebl_ia64_pic.a libebl_alpha_pic.a libebl_arm_pic.a \ - libebl_aarch64_pic.a libebl_sparc_pic.a libebl_ppc_pic.a \ - libebl_ppc64_pic.a libebl_s390_pic.a libebl_tilegx_pic.a \ - libebl_m68k_pic.a libebl_bpf_pic.a libebl_riscv_pic.a \ - libebl_csky_pic.a -noinst_LIBRARIES = $(libebl_pic) -noinst_DATA = $(libebl_pic:_pic.a=.so) - - -libcpu = ../libcpu/libcpu_pic.a -libelf = ../libelf/libelf.so -libdw = ../libdw/libdw.so -libeu = ../lib/libeu.a i386_SRCS = i386_init.c i386_symbol.c i386_corenote.c i386_cfi.c \ i386_retval.c i386_regs.c i386_auxv.c i386_syscall.c \ i386_initreg.c i386_unwind.c -libebl_i386_pic_a_SOURCES = $(i386_SRCS) -am_libebl_i386_pic_a_OBJECTS = $(i386_SRCS:.c=.os) sh_SRCS = sh_init.c sh_symbol.c sh_corenote.c sh_regs.c sh_retval.c -libebl_sh_pic_a_SOURCES = $(sh_SRCS) -am_libebl_sh_pic_a_OBJECTS = $(sh_SRCS:.c=.os) x86_64_SRCS = x86_64_init.c x86_64_symbol.c x86_64_corenote.c x86_64_cfi.c \ - x86_64_retval.c x86_64_regs.c i386_auxv.c x86_64_syscall.c \ - x86_64_initreg.c x86_64_unwind.c x32_corenote.c -libebl_x86_64_pic_a_SOURCES = $(x86_64_SRCS) -am_libebl_x86_64_pic_a_OBJECTS = $(x86_64_SRCS:.c=.os) + x86_64_retval.c x86_64_regs.c x86_64_syscall.c x86_64_initreg.c \ + x86_64_unwind.c x32_corenote.c + ia64_SRCS = ia64_init.c ia64_symbol.c ia64_regs.c ia64_retval.c -libebl_ia64_pic_a_SOURCES = $(ia64_SRCS) -am_libebl_ia64_pic_a_OBJECTS = $(ia64_SRCS:.c=.os) alpha_SRCS = alpha_init.c alpha_symbol.c alpha_retval.c alpha_regs.c \ alpha_corenote.c alpha_auxv.c -libebl_alpha_pic_a_SOURCES = $(alpha_SRCS) -am_libebl_alpha_pic_a_OBJECTS = $(alpha_SRCS:.c=.os) arm_SRCS = arm_init.c arm_symbol.c arm_regs.c arm_corenote.c \ arm_auxv.c arm_attrs.c arm_retval.c arm_cfi.c arm_initreg.c -libebl_arm_pic_a_SOURCES = $(arm_SRCS) -am_libebl_arm_pic_a_OBJECTS = $(arm_SRCS:.c=.os) aarch64_SRCS = aarch64_init.c aarch64_regs.c aarch64_symbol.c \ aarch64_corenote.c aarch64_retval.c aarch64_cfi.c \ aarch64_initreg.c aarch64_unwind.c -libebl_aarch64_pic_a_SOURCES = $(aarch64_SRCS) -am_libebl_aarch64_pic_a_OBJECTS = $(aarch64_SRCS:.c=.os) sparc_SRCS = sparc_init.c sparc_symbol.c sparc_regs.c sparc_retval.c \ sparc_corenote.c sparc64_corenote.c sparc_auxv.c sparc_attrs.c \ sparc_cfi.c sparc_initreg.c -libebl_sparc_pic_a_SOURCES = $(sparc_SRCS) -am_libebl_sparc_pic_a_OBJECTS = $(sparc_SRCS:.c=.os) ppc_SRCS = ppc_init.c ppc_symbol.c ppc_retval.c ppc_regs.c \ ppc_corenote.c ppc_auxv.c ppc_attrs.c ppc_syscall.c \ ppc_cfi.c ppc_initreg.c -libebl_ppc_pic_a_SOURCES = $(ppc_SRCS) -am_libebl_ppc_pic_a_OBJECTS = $(ppc_SRCS:.c=.os) -ppc64_SRCS = ppc64_init.c ppc64_symbol.c ppc64_retval.c \ - ppc64_corenote.c ppc_regs.c ppc_auxv.c ppc_attrs.c ppc_syscall.c \ - ppc_cfi.c ppc_initreg.c ppc64_unwind.c ppc64_resolve_sym.c -libebl_ppc64_pic_a_SOURCES = $(ppc64_SRCS) -am_libebl_ppc64_pic_a_OBJECTS = $(ppc64_SRCS:.c=.os) +ppc64_SRCS = ppc64_init.c ppc64_symbol.c ppc64_retval.c ppc64_corenote.c \ + ppc64_unwind.c ppc64_resolve_sym.c s390_SRCS = s390_init.c s390_symbol.c s390_regs.c s390_retval.c \ s390_corenote.c s390x_corenote.c s390_cfi.c s390_initreg.c \ s390_unwind.c -libebl_s390_pic_a_SOURCES = $(s390_SRCS) -am_libebl_s390_pic_a_OBJECTS = $(s390_SRCS:.c=.os) tilegx_SRCS = tilegx_init.c tilegx_symbol.c tilegx_regs.c \ tilegx_retval.c tilegx_corenote.c -libebl_tilegx_pic_a_SOURCES = $(tilegx_SRCS) -am_libebl_tilegx_pic_a_OBJECTS = $(tilegx_SRCS:.c=.os) m68k_SRCS = m68k_init.c m68k_symbol.c m68k_regs.c \ m68k_retval.c m68k_corenote.c m68k_cfi.c m68k_initreg.c -libebl_m68k_pic_a_SOURCES = $(m68k_SRCS) -am_libebl_m68k_pic_a_OBJECTS = $(m68k_SRCS:.c=.os) # m68k prstatus core notes are described by a packed structure # which has not naturally aligned fields. Since we don't access @@ -127,47 +91,23 @@ am_libebl_m68k_pic_a_OBJECTS = $(m68k_SRCS:.c=.os) m68k_corenote_no_Wpacked_not_aligned = yes bpf_SRCS = bpf_init.c bpf_regs.c bpf_symbol.c -libebl_bpf_pic_a_SOURCES = $(bpf_SRCS) -am_libebl_bpf_pic_a_OBJECTS = $(bpf_SRCS:.c=.os) riscv_SRCS = riscv_init.c riscv_symbol.c riscv_cfi.c riscv_regs.c \ riscv_initreg.c riscv_corenote.c riscv64_corenote.c riscv_retval.c -libebl_riscv_pic_a_SOURCES = $(riscv_SRCS) -am_libebl_riscv_pic_a_OBJECTS = $(riscv_SRCS:.c=.os) csky_SRCS = csky_attrs.c csky_init.c csky_symbol.c csky_cfi.c \ csky_regs.c csky_initreg.c csky_corenote.c -libebl_csky_pic_a_SOURCES = $(csky_SRCS) -am_libebl_csky_pic_a_OBJECTS = $(csky_SRCS:.c=.os) - -libebl_%.so libebl_%.map: libebl_%_pic.a $(libcpu) $(libelf) $(libdw) $(libeu) - @rm -f $(@:.so=.map) - $(AM_V_at)echo 'ELFUTILS_$(PACKAGE_VERSION) { global: $*_init; local: *; };' \ - > $(@:.so=.map) - $(AM_V_CCLD)$(LINK) $(dso_LDFLAGS) -o $(@:.map=.so) \ - -Wl,--whole-archive $< $(libcpu) -Wl,--no-whole-archive \ - -Wl,--version-script,$(@:.so=.map),--no-undefined \ - -Wl,--as-needed $(libelf) $(libdw) $(libeu) - @$(textrel_check) - -install: install-am install-ebl-modules -install-ebl-modules: - $(mkinstalldirs) $(DESTDIR)$(libdir)/$(LIBEBL_SUBDIR) - for m in $(modules); do \ - $(INSTALL_PROGRAM) libebl_$${m}.so $(DESTDIR)$(libdir)/$(LIBEBL_SUBDIR)/libebl_$${m}-$(PACKAGE_VERSION).so; \ - ln -fs libebl_$${m}-$(PACKAGE_VERSION).so $(DESTDIR)$(libdir)/$(LIBEBL_SUBDIR)/libebl_$${m}.so; \ - done - -uninstall: uninstall-am - for m in $(modules); do \ - rm -f $(DESTDIR)$(libdir)/$(LIBEBL_SUBDIR)/libebl_$${m}-$(PACKAGE_VERSION).so; \ - rm -f $(DESTDIR)$(libdir)/$(LIBEBL_SUBDIR)/libebl_$${m}.so; \ - done - rmdir --ignore-fail-on-non-empty $(DESTDIR)$(libdir)/$(LIBEBL_SUBDIR) + +libebl_backends_a_SOURCES = $(i386_SRCS) $(sh_SRCS) $(x86_64_SRCS) \ + $(ia64_SRCS) $(alpha_SRCS) $(arm_SRCS) \ + $(aarch64_SRCS) $(sparc_SRCS) $(ppc_SRCS) \ + $(ppc64_SRCS) $(s390_SRCS) $(tilegx_SRCS) \ + $(m68k_SRCS) $(bpf_SRCS) $(riscv_SRCS) $(csky_SRCS) + +libebl_backends_pic_a_SOURCES = +am_libebl_backends_pic_a_OBJECTS = $(libebl_backends_a_SOURCES:.c=.os) noinst_HEADERS = libebl_CPU.h common-reloc.c linux-core-note.c x86_corenote.c -EXTRA_DIST = $(foreach m,$(modules),$($(m)_SRCS)) $(modules:=_reloc.def) +EXTRA_DIST = $(modules:=_reloc.def) -CLEANFILES += $(foreach m,$(modules),\ - libebl_$(m).map libebl_$(m).so \ - $(am_libebl_$(m)_pic_a_OBJECTS)) +MOSTLYCLEANFILES = $(am_libebl_backends_pic_a_OBJECTS) |