diff options
Diffstat (limited to 'libasm')
-rw-r--r-- | libasm/ChangeLog | 25 | ||||
-rw-r--r-- | libasm/Makefile.am | 59 | ||||
-rw-r--r-- | libasm/asm_end.c | 17 | ||||
-rw-r--r-- | libasm/disasm_str.c | 2 |
4 files changed, 80 insertions, 23 deletions
diff --git a/libasm/ChangeLog b/libasm/ChangeLog index 262d2a92..26fced38 100644 --- a/libasm/ChangeLog +++ b/libasm/ChangeLog @@ -1,3 +1,28 @@ +2017-05-04 Ulf Hermann <ulf.hermann@qt.io> + + * asm_end.c: Rename the output file only after freeing resources. + +2017-05-04 Ulf Hermann <ulf.hermann@qt.io> + + * asm_end.c: Don't fchmod the new file if fchmod is unavailable. + +2017-02-28 Ulf Hermann <ulf.hermann@qt.io> + + * Makefile.am: Use the predefined common library names rather than + hardcoding to libasm.so and friends. + +2017-02-27 Ulf Hermann <ulf.hermann@qt.io> + + * Makefile.am: Use dso_LDFLAGS. + +2017-02-27 Ulf Hermann <ulf.hermann@qt.io> + + * disasm_str.c: Don't include system.h + +2017-02-21 Ulf Hermann <ulf.hermann@qt.io> + + * Makefile.am: Link libasm agaist libgnu.a if requested. + 2017-02-17 Ulf Hermann <ulf.hermann@qt.io> * Makefile.am: Add libasm_so_DEPS to specify external libraries diff --git a/libasm/Makefile.am b/libasm/Makefile.am index 9effa6c5..9bb56ee5 100644 --- a/libasm/Makefile.am +++ b/libasm/Makefile.am @@ -31,11 +31,10 @@ include $(top_srcdir)/config/eu.am AM_CPPFLAGS += -I$(top_srcdir)/libelf -I$(top_srcdir)/libebl -I$(top_srcdir)/libdw -I$(top_srcdir)/libdwelf GCC_INCLUDE = -I$(shell $(CC) -print-file-name=include) -VERSION = 1 lib_LIBRARIES = libasm.a noinst_LIBRARIES = libasm_pic.a -noinst_PROGRAMS = $(noinst_LIBRARIES:_pic.a=.so) +noinst_DATA = $(libasm_BARE) pkginclude_HEADERS = libasm.h libasm_a_SOURCES = asm_begin.c asm_abort.c asm_end.c asm_error.c \ @@ -55,36 +54,60 @@ 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_DEPS = ../lib/libeu.a ../libebl/libebl.a ../libelf/libelf.so ../libdw/libdw.so -libasm_so_LDLIBS = $(libasm_so_DEPS) +libasm_so_DEPS = ../lib/libeu.a ../libebl/libebl.a ../libelf/$(libelf_BARE) ../libdw/$(libdw_BARE) +if USE_GNULIB +libasm_so_DEPS += ../libgnu/libgnu.a +endif +libasm_so_LDLIBS = $(libasm_so_DEPS) $(intl_LDADD) if USE_LOCKS libasm_so_LDLIBS += -lpthread endif +if NATIVE_PE +GEN_DEF = -Wl,--output-def=$(libasm_BARE:.dll=.def) +CLEANFILES += $(libasm_BARE:.dll=.def) +else +GEN_DEF = +endif libasm_so_LIBS = libasm_pic.a -libasm_so_SOURCES = -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 \ +$(libasm_BARE): $(srcdir)/libasm.map $(libasm_so_LIBS) $(libasm_so_DEPS) + $(AM_V_CCLD)$(LINK) $(dso_LDFLAGS) -o $@ \ + -Wl,--soname,$(libasm_SONAME) $(GEN_DEF) \ -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) + $(AM_V_at)ln -fs $@ $(libasm_SONAME) + +if NATIVE_PE +install-lib: $(libasm_BARE:.dll=.lib) + $(mkinstalldirs) $(DESTDIR)$(libdir) + $(INSTALL_PROGRAM) $< $(DESTDIR)$(libdir)/$(libasm_VERSIONED:.dll=.lib) + ln -fs $(libasm_VERSIONED:.dll=.lib) $(DESTDIR)$(libdir)/$(libasm_SONAME:.dll=.lib) + ln -fs $(libasm_SONAME:.dll=.lib) $(DESTDIR)$(libdir)/$(libasm_BARE:.dll=.lib) +uninstall-lib: + rm -f $(DESTDIR)$(libdir)/$(libasm_VERSIONED:.dll=.lib) + rm -f $(DESTDIR)$(libdir)/$(libasm_SONAME:.dll=.lib) + rm -f $(DESTDIR)$(libdir)/$(libasm_BARE:.dll=.lib) +CLEANFILES += $(libasm_BARE:.dll=.lib) $(libasm_BARE:.dll=.exp) +else +install-lib: +uninstall-lib: +endif -install: install-am libasm.so +install: install-am install-lib $(libasm_BARE) $(mkinstalldirs) $(DESTDIR)$(libdir) - $(INSTALL_PROGRAM) libasm.so $(DESTDIR)$(libdir)/libasm-$(PACKAGE_VERSION).so - ln -fs libasm-$(PACKAGE_VERSION).so $(DESTDIR)$(libdir)/libasm.so.$(VERSION) - ln -fs libasm.so.$(VERSION) $(DESTDIR)$(libdir)/libasm.so + $(INSTALL_PROGRAM) $(libasm_BARE) $(DESTDIR)$(libdir)/$(libasm_VERSIONED) + ln -fs $(libasm_VERSIONED) $(DESTDIR)$(libdir)/$(libasm_SONAME) + ln -fs $(libasm_SONAME) $(DESTDIR)$(libdir)/$(libasm_BARE) -uninstall: uninstall-am - rm -f $(DESTDIR)$(libdir)/libasm-$(PACKAGE_VERSION).so - rm -f $(DESTDIR)$(libdir)/libasm.so.$(VERSION) - rm -f $(DESTDIR)$(libdir)/libasm.so +uninstall: uninstall-am uninstall-lib + rm -f $(DESTDIR)$(libdir)/$(libasm_VERSIONED) + rm -f $(DESTDIR)$(libdir)/$(libasm_SONAME) + rm -f $(DESTDIR)$(libdir)/$(libasm_BARE) rmdir --ignore-fail-on-non-empty $(DESTDIR)$(includedir)/elfutils noinst_HEADERS = libasmP.h symbolhash.h EXTRA_DIST = libasm.map -CLEANFILES += $(am_libasm_pic_a_OBJECTS) libasm.so.$(VERSION) +CLEANFILES += $(am_libasm_pic_a_OBJECTS) $(libasm_SONAME) $(libasm_BARE) diff --git a/libasm/asm_end.c b/libasm/asm_end.c index ced24f50..7891fbb5 100644 --- a/libasm/asm_end.c +++ b/libasm/asm_end.c @@ -512,23 +512,32 @@ asm_end (AsmCtx_t *ctx) if (result != 0) return result; +#if HAVE_DECL_FCHMOD /* Make the new file globally readable and user/group-writable. */ if (fchmod (ctx->fd, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH) != 0) { __libasm_seterrno (ASM_E_CANNOT_CHMOD); return -1; } +#endif + + char *tmp_fname = strdup (ctx->tmp_fname); + char *fname = strdup (ctx->fname); + + /* Free the resources. */ + __libasm_finictx (ctx); /* Rename output file. */ - if (rename (ctx->tmp_fname, ctx->fname) != 0) + result = rename (tmp_fname, fname); + free (tmp_fname); + free (fname); + + if (result != 0) { __libasm_seterrno (ASM_E_CANNOT_RENAME); return -1; } - /* Free the resources. */ - __libasm_finictx (ctx); - return 0; } diff --git a/libasm/disasm_str.c b/libasm/disasm_str.c index c14e6d5b..5b0bb299 100644 --- a/libasm/disasm_str.c +++ b/libasm/disasm_str.c @@ -31,7 +31,7 @@ #endif #include <string.h> -#include <system.h> + #include "libasmP.h" |