From patchwork Thu Feb 16 14:10:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anthony PERARD X-Patchwork-Id: 13143193 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 706F0C61DA4 for ; Thu, 16 Feb 2023 14:10:53 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.496566.767374 (Exim 4.92) (envelope-from ) id 1pSexx-0001WN-HG; Thu, 16 Feb 2023 14:10:29 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 496566.767374; Thu, 16 Feb 2023 14:10:29 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pSexx-0001WG-Eg; Thu, 16 Feb 2023 14:10:29 +0000 Received: by outflank-mailman (input) for mailman id 496566; Thu, 16 Feb 2023 14:10:29 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pSexw-0001W8-V7 for xen-devel@lists.xenproject.org; Thu, 16 Feb 2023 14:10:28 +0000 Received: from esa6.hc3370-68.iphmx.com (esa6.hc3370-68.iphmx.com [216.71.155.175]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id a747e650-ae03-11ed-93b5-47a8fe42b414; Thu, 16 Feb 2023 15:10:25 +0100 (CET) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: a747e650-ae03-11ed-93b5-47a8fe42b414 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1676556625; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=INVBs69BMsEB8kgIYMnuRjPYRAGZgriwJOHjHpb11Qk=; b=DlTaLE1r0IO4oJWK0q92i+t0PET8Q5sW8Y5MVA/SR+ZGSDegLLtQwkxS V1r+11GSk/9rOo8dRzOqeOXBHe/t5fToXOrnKp5wG0CMbKfFwRylhHLbI 40geBy3x3ZoGOhVPy8Vy7XVb3R012BIQTpBszzqK/yYN+MBAHdyGJZK3g I=; Authentication-Results: esa6.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none X-SBRS: 4.0 X-MesageID: 96698536 X-Ironport-Server: esa6.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.123 X-Policy: $RELAYED IronPort-Data: A9a23:2YlQRK+m2nVhjyn1z+NZDrUDoX6TJUtcMsCJ2f8bNWPcYEJGY0x3z GQYX2uBO/bcYjGjcopzb9nlpk8P6JSDz95lSgts/Hg8E34SpcT7XtnIdU2Y0wF+jCHgZBk+s 5hBMImowOQcFCK0SsKFa+C5xZVE/fjUAOG6UKicYXoZqTZMEE8JkQhkl/MynrlmiN24BxLlk d7pqojUNUTNNwRcawr40Ire7kIw1BjOkGlA5AdmP6kV5Aa2e0Q9V/rzG4ngdxMUfaEMdgKKb 76r5K20+Grf4yAsBruN+losWhRXKlJ6FVHmZkt+A8BOsDAbzsAB+v9T2M4nQVVWk120c+VZk 72hg3ASpTABZcUgkMxFO/VR/roX0aduoNcrKlDn2SCfItGvn9IBDJyCAWlvVbD09NqbDklN/ +EWOmktVSuuuLu5woCfacdenZoaeZyD0IM34hmMzBncBPciB5vCX7/L9ZlT2zJYasJmRKiEI ZBDMHw2MUqGOkcUUrsUIMtWcOOAj3/jczpeuRSNqLA++WT7xw1tyrn9dtHSf7RmQO0EwBjJ9 j+doQwVBDke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; d="scan'208";a="96698536" From: Anthony PERARD To: CC: Anthony PERARD , Jan Beulich , Andrew Cooper , Wei Liu , Juergen Gross Subject: [XEN PATCH v2] libs: Fix unstable libs build on FreeBSD, auto-generate version-script Date: Thu, 16 Feb 2023 14:10:07 +0000 Message-ID: <20230216141007.21827-1-anthony.perard@citrix.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Unfortunatly, --default-symver doesn't work with LLVM's LD, LLD. Instead, we will generate a temporary version-script. In order to allow regenerating the script, we'll have a different filename. In order to check if the content is up-to-date, we'll always generated it and compare. Reported-by: Andrew Cooper Fixes: 98d95437edb6 ("libs: Fix auto-generation of version-script for unstable libs") Signed-off-by: Anthony PERARD --- Notes: v2: - Replace "VERS" by "lib$(LIB_FILE_NAME)" in the new .map file. - Set version-script to lib$(LIB_FILE_NAME).map.tmp, like the filename used by the library binaries. (instead of libxen$(LIBNAME).map.tmp) - Write temporary file in the same directory as the target (in case the target is in a different directory) - remove temporary file generated by the new rule, in case it isn't removed by move-if-changed.. - use ?= to set version-script, this mean that version-script has now a deferred expansion instead of immediate, hoping nothing break. CC: Jan Beulich tools/libs/libs.mk | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tools/libs/libs.mk b/tools/libs/libs.mk index 0e4b5e0bd0..ffb6c9f064 100644 --- a/tools/libs/libs.mk +++ b/tools/libs/libs.mk @@ -5,6 +5,7 @@ # 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. +# (If empty, a temporary one for unstable library is created) LIBNAME := $(notdir $(CURDIR)) @@ -27,6 +28,8 @@ ifneq ($(nosharedlibs),y) TARGETS += lib$(LIB_FILE_NAME).so endif +version-script ?= lib$(LIB_FILE_NAME).map.tmp + PKG_CONFIG ?= $(LIB_FILE_NAME).pc PKG_CONFIG_NAME ?= Xen$(LIBNAME) PKG_CONFIG_DESC ?= The $(PKG_CONFIG_NAME) library for Xen hypervisor @@ -72,6 +75,10 @@ headers.lst: FORCE @{ set -e; $(foreach h,$(LIBHEADERS),echo $(h);) } > $@.tmp @$(call move-if-changed,$@.tmp,$@) +lib$(LIB_FILE_NAME).map.tmp: FORCE + echo 'lib$(LIB_FILE_NAME)_$(MAJOR).$(MINOR) { global: *; };' >$(@D)/.$(@F) + $(call move-if-changed,$(@D)/.$(@F),$@) + lib$(LIB_FILE_NAME).a: $(OBJS-y) $(AR) rc $@ $^ @@ -81,7 +88,7 @@ lib$(LIB_FILE_NAME).so.$(MAJOR): lib$(LIB_FILE_NAME).so.$(MAJOR).$(MINOR) $(SYMLINK_SHLIB) $< $@ 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) + $(CC) $(LDFLAGS) $(PTHREAD_LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,lib$(LIB_FILE_NAME).so.$(MAJOR) -Wl,--version-script=$(version-script) $(SHLIB_LDFLAGS) -o $@ $(PIC_OBJS) $(LDLIBS) $(APPEND_LDFLAGS) # If abi-dumper is available, write out the ABI analysis ifneq ($(ABI_DUMPER),) @@ -120,7 +127,7 @@ TAGS: clean:: rm -rf $(TARGETS) *~ $(DEPS_RM) $(OBJS-y) $(PIC_OBJS) rm -f lib$(LIB_FILE_NAME).so.$(MAJOR).$(MINOR) lib$(LIB_FILE_NAME).so.$(MAJOR) - rm -f headers.chk headers.lst + rm -f headers.chk headers.lst lib*.map.tmp .*.tmp .PHONY: distclean distclean: clean