From 8abf0b5b580094af36b9dc4ed6748379caa32a0e Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Fri, 17 Feb 2017 16:11:28 +0100 Subject: Unify linking of libasm, libelf, libdw, backends Link them all with -z,defs,-z,relro,--no-undefined, provide complete dependencies for the link steps, and add libeu.a to each one. libeu.a contains useful library functionality that each of them might use. The linker will strip unneeded symbols, so linking it in won't hurt even if none of the functions are used. Signed-off-by: Ulf Hermann --- libasm/ChangeLog | 11 +++++++++++ libasm/Makefile.am | 14 ++++++++------ 2 files changed, 19 insertions(+), 6 deletions(-) (limited to 'libasm') diff --git a/libasm/ChangeLog b/libasm/ChangeLog index d2bc4086..262d2a92 100644 --- a/libasm/ChangeLog +++ b/libasm/ChangeLog @@ -1,3 +1,14 @@ +2017-02-17 Ulf Hermann + + * Makefile.am: Add libasm_so_DEPS to specify external libraries + that have to be linked in, and libasm_so_LIBS to specify the + archives libasm consists of. The dependencies include libeu.a. + (libasm_so_LDLIBS): Add $(libasm_so_DEPS). + (libasm_so$(EXEEXT): Use $(libasm_so_LIBS), + add --no-undefined,-z,defs,-z,relro, + drop the manual enumeration of dependencies, + specify the correct path for libasm.map. + 2017-04-27 Ulf Hermann * asm_end.c (binary_end): Fix nesting of braces. diff --git a/libasm/Makefile.am b/libasm/Makefile.am index 8094b05c..9effa6c5 100644 --- a/libasm/Makefile.am +++ b/libasm/Makefile.am @@ -55,17 +55,19 @@ libasm_a_SOURCES = asm_begin.c asm_abort.c asm_end.c asm_error.c \ libasm_pic_a_SOURCES = am_libasm_pic_a_OBJECTS = $(libasm_a_SOURCES:.c=.os) -libasm_so_LDLIBS = +libasm_so_DEPS = ../lib/libeu.a ../libebl/libebl.a ../libelf/libelf.so ../libdw/libdw.so +libasm_so_LDLIBS = $(libasm_so_DEPS) if USE_LOCKS libasm_so_LDLIBS += -lpthread endif +libasm_so_LIBS = libasm_pic.a libasm_so_SOURCES = -libasm.so$(EXEEXT): libasm_pic.a libasm.map - $(AM_V_CCLD)$(LINK) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \ - -Wl,--version-script,$(srcdir)/libasm.map,--no-undefined \ - -Wl,--soname,$@.$(VERSION) \ - ../libebl/libebl.a ../libelf/libelf.so ../libdw/libdw.so \ +libasm.so$(EXEEXT): $(srcdir)/libasm.map $(libasm_so_LIBS) $(libasm_so_DEPS) + $(AM_V_CCLD)$(LINK) -shared -o $@ \ + -Wl,--soname,$@.$(VERSION),-z,defs,-z,relro \ + -Wl,--version-script,$<,--no-undefined \ + -Wl,--whole-archive $(libasm_so_LIBS) -Wl,--no-whole-archive \ $(libasm_so_LDLIBS) @$(textrel_check) $(AM_V_at)ln -fs $@ $@.$(VERSION) -- cgit v1.2.3