From c7de7e44a6e85d8a9d0f63ee12f388049c382e5e Mon Sep 17 00:00:00 2001 From: Jonathon Reinhart Date: Wed, 21 Oct 2015 22:43:14 -0400 Subject: [PATCH] create versioned library name and symlink unversioned name on *nix This allows executables (e.g. unit tests) to link against the libunicorn.so in the build directory, after the SONAME was added in 4860fdb3. Becuase libunicorn.so has an SONAME of libunicorn.so.0, the linker uses the SONAME for the DT_NEEDED entry of the tests. But because a library with that name did not exist, they would fail to run. --- .gitignore | 2 ++ Makefile | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 3fdb76f7..6831c5b6 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,8 @@ *.o *.a *.dSYM +*.so +*.so.* qemu/config-all-devices.mak diff --git a/Makefile b/Makefile index 4ce64736..51f8b469 100644 --- a/Makefile +++ b/Makefile @@ -131,7 +131,8 @@ LIBRARY = $(BLDIR)/$(LIBNAME).$(EXT) else ifeq ($(IS_CYGWIN),1) LIBRARY = $(BLDIR)/$(LIBNAME).$(EXT) else # *nix -LIBRARY = $(BLDIR)/lib$(LIBNAME).$(EXT) +LIBRARY = $(BLDIR)/lib$(LIBNAME).$(VERSION_EXT) +LIBRARY_SYMLINK = $(BLDIR)/lib$(LIBNAME).$(EXT) endif endif @@ -229,6 +230,9 @@ ifeq ($(V),0) else $(CC) $(CFLAGS) $($(LIBNAME)_LDFLAGS) -shared $^ -o $(LIBRARY) $(GLIB) -lm endif +ifneq (,$(LIBRARY_SYMLINK)) + @ln -sf $(LIBRARY) $(LIBRARY_SYMLINK) +endif endif $(ARCHIVE): $(UC_TARGET_OBJ) uc.o hook.o