]> xenbits.xensource.com Git - xen.git/commitdiff
libs: Fix auto-generation of version-script for unstable libs
authorAnthony PERARD <anthony.perard@citrix.com>
Tue, 7 Feb 2023 14:17:53 +0000 (15:17 +0100)
committerJan Beulich <jbeulich@suse.com>
Tue, 7 Feb 2023 14:17:53 +0000 (15:17 +0100)
When there isn't a version-script for a shared library (like for
unstable libs), we create one based on the current Xen version. But
that version-script became out-of-date as soon as Xen's version
changes and make as no way to regenerate the version-script on
rebuild.

For unstable libs, we only needs the symver to be different from a
previous release of Xen. There's an option "--default-symver" which
allow to use the soname as symver and as the soname have the Xen
release version, it will be different for every release. With
--default-symver we don't need to generate a version-script.

But we also need to know if there's already an existing version script
, for that we introduce $(version-script) to be used to point to the
path of the existing script. (Guessing if a version script exist for a
stable library with for example $(wildcard) won't work as a file will
exist when building the library without this patch.)

We don't need the version-script unless we are making the shared
library so it is removed from the "all" target.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
17 files changed:
.gitignore
tools/libs/call/Makefile
tools/libs/ctrl/Makefile
tools/libs/devicemodel/Makefile
tools/libs/evtchn/Makefile
tools/libs/foreignmemory/Makefile
tools/libs/gnttab/Makefile
tools/libs/guest/Makefile
tools/libs/hypfs/Makefile
tools/libs/libs.mk
tools/libs/light/Makefile
tools/libs/stat/Makefile
tools/libs/store/Makefile
tools/libs/toolcore/Makefile
tools/libs/toollog/Makefile
tools/libs/util/Makefile
tools/libs/vchan/Makefile

index 5b30d8fc36aac8b75c4bd856205bf1ed85a11611..beac034784fd825af9f820e1b7a7f2986300759a 100644 (file)
@@ -110,8 +110,6 @@ tools/config.cache
 config/Tools.mk
 config/Stubdom.mk
 config/Docs.mk
-tools/libs/ctrl/libxenctrl.map
-tools/libs/guest/libxenguest.map
 tools/libs/guest/xc_bitops.h
 tools/libs/guest/xc_core.h
 tools/libs/guest/xc_core_arm.h
@@ -121,7 +119,6 @@ tools/libs/light/_*.[ch]
 tools/libs/light/*.pyc
 tools/libs/light/_libxl.api-for-check
 tools/libs/light/*.api-ok
-tools/libs/light/libxenlight.map
 tools/libs/light/libxl-save-helper
 tools/libs/light/dsdt*
 tools/libs/light/mk_dsdt
@@ -131,13 +128,10 @@ tools/libs/light/testidl.c
 tools/libs/light/test_timedereg
 tools/libs/light/test_fdderegrace
 tools/libs/light/tmp.*
-tools/libs/stat/libxenstat.map
 tools/libs/store/list.h
 tools/libs/store/utils.h
 tools/libs/store/xs_lib.c
 tools/libs/util/libxlu_cfg_y.output
-tools/libs/util/libxenutil.map
-tools/libs/vchan/libxenvchan.map
 tools/debugger/gdb/gdb-6.2.1-linux-i386-xen/*
 tools/debugger/gdb/gdb-6.2.1/*
 tools/debugger/gdb/gdb-6.2.1.tar.bz2
index 103f5ad36094547f1875d1ade003b7c92fe4e2c9..56a964b51780957470ec1f0a7fbd584d11c81028 100644 (file)
@@ -3,6 +3,7 @@ include $(XEN_ROOT)/tools/Rules.mk
 
 MAJOR    = 1
 MINOR    = 3
+version-script := libxencall.map
 
 include Makefile.common
 
index 93442ab38954f0d7d0d549b3238546a93ff72821..094e84b8d819b08f30754156586745d5c8b6a7c4 100644 (file)
@@ -10,6 +10,3 @@ PKG_CONFIG_NAME := Xencontrol
 NO_HEADERS_CHK := y
 
 include $(XEN_ROOT)/tools/libs/libs.mk
-
-clean::
-       rm -f libxenctrl.map
index b70dd774e4dc3a91d1fa2a997a239cbf7726d93b..20d1d112e7a426ab6ae5c801acb50d117239ce41 100644 (file)
@@ -3,6 +3,7 @@ include $(XEN_ROOT)/tools/Rules.mk
 
 MAJOR    = 1
 MINOR    = 4
+version-script := libxendevicemodel.map
 
 include Makefile.common
 
index 3dad3840c6f69000ea1d89544457262b89fa78ed..18cdaab89eb14f04a11027e23f65e5bd32515d8c 100644 (file)
@@ -3,6 +3,7 @@ include $(XEN_ROOT)/tools/Rules.mk
 
 MAJOR    = 1
 MINOR    = 2
+version-script := libxenevtchn.map
 
 include Makefile.common
 
index b70dd774e4dc3a91d1fa2a997a239cbf7726d93b..81398e88b112ecc22ad0b1c9b18e816c892ebb9c 100644 (file)
@@ -3,6 +3,7 @@ include $(XEN_ROOT)/tools/Rules.mk
 
 MAJOR    = 1
 MINOR    = 4
+version-script := libxenforeignmemory.map
 
 include Makefile.common
 
index 3dad3840c6f69000ea1d89544457262b89fa78ed..4528830bdc5b8fa8a30c0a8391a9083cd4a6153f 100644 (file)
@@ -3,6 +3,7 @@ include $(XEN_ROOT)/tools/Rules.mk
 
 MAJOR    = 1
 MINOR    = 2
+version-script := libxengnttab.map
 
 include Makefile.common
 
index 19d3ff2fdbdf46d91870f3ffa831a31687cd814b..93338a93012737832554cb8f335046044bbde3d5 100644 (file)
@@ -14,6 +14,3 @@ NO_HEADERS_CHK := y
 include $(XEN_ROOT)/tools/libs/libs.mk
 
 libxenguest.so.$(MAJOR).$(MINOR): LDLIBS += $(ZLIB_LIBS) -lz
-
-clean::
-       rm -f libxenguest.map
index 630e1e6f3e840a1bc7c5407569280fd61c951bd8..7fae5c750d2f6e30728b821403d0670617dc16a0 100644 (file)
@@ -3,6 +3,7 @@ include $(XEN_ROOT)/tools/Rules.mk
 
 MAJOR    = 1
 MINOR    = 0
+version-script := libxenhypfs.map
 
 LDLIBS += -lz
 
index 3eb91fc8f3d3e9624686b0fc09cd4817537e1a9d..0e4b5e0bd0131429c6a2e7cdee36ecd3130e881f 100644 (file)
@@ -4,6 +4,7 @@
 #   PKG_CONFIG: name of pkg-config file (xen$(LIBNAME).pc if empty)
 #   MAJOR:   major version of lib (Xen version if empty)
 #   MINOR:   minor version of lib (0 if empty)
+#   version-script: Specify the name of a version script to the linker.
 
 LIBNAME := $(notdir $(CURDIR))
 
@@ -53,7 +54,7 @@ $(PKG_CONFIG_LOCAL): PKG_CONFIG_INCDIR = $(XEN_INCLUDE)
 $(PKG_CONFIG_LOCAL): PKG_CONFIG_LIBDIR = $(CURDIR)
 
 .PHONY: all
-all: $(TARGETS) $(PKG_CONFIG_LOCAL) libxen$(LIBNAME).map $(LIBHEADERS)
+all: $(TARGETS) $(PKG_CONFIG_LOCAL) $(LIBHEADERS)
 
 ifneq ($(NO_HEADERS_CHK),y)
 all: headers.chk
@@ -71,9 +72,6 @@ headers.lst: FORCE
        @{ set -e; $(foreach h,$(LIBHEADERS),echo $(h);) } > $@.tmp
        @$(call move-if-changed,$@.tmp,$@)
 
-libxen$(LIBNAME).map:
-       echo 'VERS_$(MAJOR).$(MINOR) { global: *; };' >$@
-
 lib$(LIB_FILE_NAME).a: $(OBJS-y)
        $(AR) rc $@ $^
 
@@ -82,8 +80,8 @@ lib$(LIB_FILE_NAME).so: lib$(LIB_FILE_NAME).so.$(MAJOR)
 lib$(LIB_FILE_NAME).so.$(MAJOR): lib$(LIB_FILE_NAME).so.$(MAJOR).$(MINOR)
        $(SYMLINK_SHLIB) $< $@
 
-lib$(LIB_FILE_NAME).so.$(MAJOR).$(MINOR): $(PIC_OBJS) libxen$(LIBNAME).map
-       $(CC) $(LDFLAGS) $(PTHREAD_LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,lib$(LIB_FILE_NAME).so.$(MAJOR) -Wl,--version-script=libxen$(LIBNAME).map $(SHLIB_LDFLAGS) -o $@ $(PIC_OBJS) $(LDLIBS) $(APPEND_LDFLAGS)
+lib$(LIB_FILE_NAME).so.$(MAJOR).$(MINOR): $(PIC_OBJS) $(version-script)
+       $(CC) $(LDFLAGS) $(PTHREAD_LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,lib$(LIB_FILE_NAME).so.$(MAJOR) -Wl,$(if $(version-script),--version-script=$(version-script),--default-symver) $(SHLIB_LDFLAGS) -o $@ $(PIC_OBJS) $(LDLIBS) $(APPEND_LDFLAGS)
 
 # If abi-dumper is available, write out the ABI analysis
 ifneq ($(ABI_DUMPER),)
index 4fddcc6f51d75c12e1904fe67dbe3b01db8ca0e5..cd3fa855e105566c63ff639fcb73f5e23dddb727 100644 (file)
@@ -262,6 +262,5 @@ clean::
        $(RM) testidl.c.new testidl.c *.api-ok
        $(RM) $(TEST_PROGS) libxenlight_test.so libxl_test_*.opic
        $(RM) -r __pycache__
-       $(RM) libxenlight.map
        $(RM) $(AUTOSRCS) $(AUTOINCS)
        $(MAKE) -C $(ACPI_PATH) ACPI_BUILD_DIR=$(CURDIR) clean
index 7eaf50e91ee3e069d28e856cfb352c7fc2f292ae..ee5c42bf7b4d2bddf4760ad3d8c465e3cd7f67bc 100644 (file)
@@ -134,4 +134,4 @@ uninstall:: uninstall-perl-bindings
 endif
 
 clean::
-       $(RM) libxenstat.map $(BINDINGS) $(BINDINGSRC)
+       $(RM) $(BINDINGS) $(BINDINGSRC)
index 3557a8c76df7e6036f109fab90d8de95b75e9ad0..daed9d148f591df8034e6c3e7c493bf41e667e35 100644 (file)
@@ -3,6 +3,7 @@ include $(XEN_ROOT)/tools/Rules.mk
 
 MAJOR = 4
 MINOR = 0
+version-script := libxenstore.map
 
 ifeq ($(CONFIG_Linux),y)
 LDLIBS += -ldl
index 0d92b68b3b1d59e8cf55d2259d81b0789f3fcd8d..20671dadd0d6c0abe94a21c6f0c8cbb5a199dde4 100644 (file)
@@ -3,6 +3,7 @@ include $(XEN_ROOT)/tools/Rules.mk
 
 MAJOR  = 1
 MINOR  = 0
+version-script := libxentoolcore.map
 
 LIBHEADER := xentoolcore.h
 
index 2361b8cbf1441dbfa53a8c46ff8f468bf3419815..d612227c859e223ce7ab512e3f37f7f785f7bef4 100644 (file)
@@ -3,6 +3,7 @@ include $(XEN_ROOT)/tools/Rules.mk
 
 MAJOR  = 1
 MINOR  = 0
+version-script := libxentoollog.map
 
 include Makefile.common
 
index 493d2e00be101edd13abe3b08ed346cf0509aa88..e016baf888973defd99433c68acfe27a7164deae 100644 (file)
@@ -47,6 +47,3 @@ $(OBJS-y) $(PIC_OBJS): $(AUTOINCS)
 %.c %.h:: %.l
        @rm -f $*.[ch]
        $(FLEX) --header-file=$*.h --outfile=$*.c $<
-
-clean::
-       $(RM) libxenutil.map
index ac2bff66f5cf213107bb1326ceb4ca4a0d2c196d..a1ef60ac8ebd837ed610becf3798e73a3545ca35 100644 (file)
@@ -11,6 +11,3 @@ OBJS-y += io.o
 NO_HEADERS_CHK := y
 
 include $(XEN_ROOT)/tools/libs/libs.mk
-
-clean::
-       rm -f libxenvchan.map