From nobody Thu May 2 21:37:19 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1603448224; cv=none; d=zohomail.com; s=zohoarc; b=HbkCamprmj2XHrVl+ktaivvlV8npNbCL2xad5r7N0pgmVCrxiSbb+A0PlBgiV7fgSaS5cgrnw7rv7eUKXoZ9HUWvxihAV3Vs2KkZLKJ7WZkALDwSTTMIMok9UVXECUlgR3UmBwYrNVX9+VR2oLburj82b4rbT8dW9kEfogoho88= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603448224; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=6EOqujdf6R4/Hc88zQjNx0MmXisrFNGShOlDaeJv/5E=; b=a/7zr+J219Qt/zjZ2ByqxnTPq7vWZGjjejSXQ4Fxw3StDgEWwZTUJnXI9FzWST9nZ4iFbELlxncG2tcKK+LLoKgj7pmfexPXSeFK5VXRVCUVG6O4DobYYLyTF/ag6REDvVTQUOkmY9ZC6nXlpwycGcz5XJELHANm++kV28HxNmk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1603448224495216.9443327954957; Fri, 23 Oct 2020 03:17:04 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.10830.28906 (Exim 4.92) (envelope-from ) id 1kVu7q-0000eZ-P6; Fri, 23 Oct 2020 10:16:46 +0000 Received: by outflank-mailman (output) from mailman id 10830.28906; Fri, 23 Oct 2020 10:16:46 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kVu7q-0000eS-M9; Fri, 23 Oct 2020 10:16:46 +0000 Received: by outflank-mailman (input) for mailman id 10830; Fri, 23 Oct 2020 10:16:45 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kVu7p-0000eL-Ay for xen-devel@lists.xenproject.org; Fri, 23 Oct 2020 10:16:45 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id f24def1b-b3e2-4f0b-bc3b-f1b46a8fdc7a; Fri, 23 Oct 2020 10:16:43 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 4AD78B7F2; Fri, 23 Oct 2020 10:16:42 +0000 (UTC) Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kVu7p-0000eL-Ay for xen-devel@lists.xenproject.org; Fri, 23 Oct 2020 10:16:45 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id f24def1b-b3e2-4f0b-bc3b-f1b46a8fdc7a; Fri, 23 Oct 2020 10:16:43 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 4AD78B7F2; Fri, 23 Oct 2020 10:16:42 +0000 (UTC) X-Outflank-Mailman: Message body and most headers restored to incoming version 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: f24def1b-b3e2-4f0b-bc3b-f1b46a8fdc7a X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1603448202; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6EOqujdf6R4/Hc88zQjNx0MmXisrFNGShOlDaeJv/5E=; b=E4NuXhz+vXbgShrxaN2Ti5LdlFvF0Xeloj0WBjRheE6XkvQddUNfZUVKFEtuIzPzVMBxpj MzcX3906AvxvEWCwEf1djqDxsWzEcCRJXsRqMmyefFH785Qp2K9luRQJtUDTbBPlCQmmVk 16XbJsHPQKy8DncT57N3dM+XeMSEnnk= Subject: [PATCH v2 1/8] lib: split _ctype[] into its own object, under lib/ From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , George Dunlap , Ian Jackson , Julien Grall , Wei Liu , Stefano Stabellini References: Message-ID: <8bf44bbd-8c39-7ab1-3ccb-52bf3744592b@suse.com> Date: Fri, 23 Oct 2020 12:16:43 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.12.1 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) Content-Type: text/plain; charset="utf-8" This is, besides for tidying, in preparation of then starting to use an archive rather than an object file for generic library code which arch-es (or even specific configurations within a single arch) may or may not need. Signed-off-by: Jan Beulich Acked-by: Julien Grall --- xen/Makefile | 3 ++- xen/Rules.mk | 2 +- xen/common/lib.c | 29 ----------------------------- xen/lib/Makefile | 1 + xen/lib/ctype.c | 38 ++++++++++++++++++++++++++++++++++++++ 5 files changed, 42 insertions(+), 31 deletions(-) create mode 100644 xen/lib/ctype.c diff --git a/xen/Makefile b/xen/Makefile index bf0c804d4352..73bdc326c549 100644 --- a/xen/Makefile +++ b/xen/Makefile @@ -331,6 +331,7 @@ _clean: delete-unfresh-files $(MAKE) $(clean) include $(MAKE) $(clean) common $(MAKE) $(clean) drivers + $(MAKE) $(clean) lib $(MAKE) $(clean) xsm $(MAKE) $(clean) crypto $(MAKE) $(clean) arch/arm @@ -414,7 +415,7 @@ include/asm-$(TARGET_ARCH)/asm-offsets.h: arch/$(TARGET= _ARCH)/asm-offsets.s echo ""; \ echo "#endif") <$< >$@ =20 -SUBDIRS =3D xsm arch/$(TARGET_ARCH) common drivers test +SUBDIRS =3D xsm arch/$(TARGET_ARCH) common drivers lib test define all_sources ( find include/asm-$(TARGET_ARCH) -name '*.h' -print; \ find include -name 'asm-*' -prune -o -name '*.h' -print; \ diff --git a/xen/Rules.mk b/xen/Rules.mk index 891c94e6ad00..333e19bec343 100644 --- a/xen/Rules.mk +++ b/xen/Rules.mk @@ -36,7 +36,7 @@ TARGET :=3D $(BASEDIR)/xen # Note that link order matters! ALL_OBJS-y +=3D $(BASEDIR)/common/built_in.o ALL_OBJS-y +=3D $(BASEDIR)/drivers/built_in.o -ALL_OBJS-$(CONFIG_X86) +=3D $(BASEDIR)/lib/built_in.o +ALL_OBJS-y +=3D $(BASEDIR)/lib/built_in.o ALL_OBJS-y +=3D $(BASEDIR)/xsm/built_in.o ALL_OBJS-y +=3D $(BASEDIR)/arch/$(TARGET_ARCH)/built_in.o ALL_OBJS-$(CONFIG_CRYPTO) +=3D $(BASEDIR)/crypto/built_in.o diff --git a/xen/common/lib.c b/xen/common/lib.c index b2b799da44c5..a224efa8f6e8 100644 --- a/xen/common/lib.c +++ b/xen/common/lib.c @@ -1,37 +1,8 @@ - -#include #include #include #include #include =20 -/* for ctype.h */ -const unsigned char _ctype[] =3D { - _C,_C,_C,_C,_C,_C,_C,_C, /* 0-7 */ - _C,_C|_S,_C|_S,_C|_S,_C|_S,_C|_S,_C,_C, /* 8-15 */ - _C,_C,_C,_C,_C,_C,_C,_C, /* 16-23 */ - _C,_C,_C,_C,_C,_C,_C,_C, /* 24-31 */ - _S|_SP,_P,_P,_P,_P,_P,_P,_P, /* 32-39 */ - _P,_P,_P,_P,_P,_P,_P,_P, /* 40-47 */ - _D,_D,_D,_D,_D,_D,_D,_D, /* 48-55 */ - _D,_D,_P,_P,_P,_P,_P,_P, /* 56-63 */ - _P,_U|_X,_U|_X,_U|_X,_U|_X,_U|_X,_U|_X,_U, /* 64-71 */ - _U,_U,_U,_U,_U,_U,_U,_U, /* 72-79 */ - _U,_U,_U,_U,_U,_U,_U,_U, /* 80-87 */ - _U,_U,_U,_P,_P,_P,_P,_P, /* 88-95 */ - _P,_L|_X,_L|_X,_L|_X,_L|_X,_L|_X,_L|_X,_L, /* 96-103 */ - _L,_L,_L,_L,_L,_L,_L,_L, /* 104-111 */ - _L,_L,_L,_L,_L,_L,_L,_L, /* 112-119 */ - _L,_L,_L,_P,_P,_P,_P,_C, /* 120-127 */ - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 128-143 */ - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 144-159 */ - _S|_SP,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P, /* 160-175 */ - _P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P, /* 176-191 */ - _U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U, /* 192-207 */ - _U,_U,_U,_U,_U,_U,_U,_P,_U,_U,_U,_U,_U,_U,_U,_L, /* 208-223 */ - _L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L, /* 224-239 */ - _L,_L,_L,_L,_L,_L,_L,_P,_L,_L,_L,_L,_L,_L,_L,_L}; /* 240-255 */ - /* * A couple of 64 bit operations ported from FreeBSD. * The code within the '#if BITS_PER_LONG =3D=3D 32' block below, and no o= ther diff --git a/xen/lib/Makefile b/xen/lib/Makefile index 7019ca00e8fd..53b1da025e0d 100644 --- a/xen/lib/Makefile +++ b/xen/lib/Makefile @@ -1 +1,2 @@ +obj-y +=3D ctype.o obj-$(CONFIG_X86) +=3D x86/ diff --git a/xen/lib/ctype.c b/xen/lib/ctype.c new file mode 100644 index 000000000000..7b233a335fdf --- /dev/null +++ b/xen/lib/ctype.c @@ -0,0 +1,38 @@ +#include + +/* for ctype.h */ +const unsigned char _ctype[] =3D { + _C,_C,_C,_C,_C,_C,_C,_C, /* 0-7 */ + _C,_C|_S,_C|_S,_C|_S,_C|_S,_C|_S,_C,_C, /* 8-15 */ + _C,_C,_C,_C,_C,_C,_C,_C, /* 16-23 */ + _C,_C,_C,_C,_C,_C,_C,_C, /* 24-31 */ + _S|_SP,_P,_P,_P,_P,_P,_P,_P, /* 32-39 */ + _P,_P,_P,_P,_P,_P,_P,_P, /* 40-47 */ + _D,_D,_D,_D,_D,_D,_D,_D, /* 48-55 */ + _D,_D,_P,_P,_P,_P,_P,_P, /* 56-63 */ + _P,_U|_X,_U|_X,_U|_X,_U|_X,_U|_X,_U|_X,_U, /* 64-71 */ + _U,_U,_U,_U,_U,_U,_U,_U, /* 72-79 */ + _U,_U,_U,_U,_U,_U,_U,_U, /* 80-87 */ + _U,_U,_U,_P,_P,_P,_P,_P, /* 88-95 */ + _P,_L|_X,_L|_X,_L|_X,_L|_X,_L|_X,_L|_X,_L, /* 96-103 */ + _L,_L,_L,_L,_L,_L,_L,_L, /* 104-111 */ + _L,_L,_L,_L,_L,_L,_L,_L, /* 112-119 */ + _L,_L,_L,_P,_P,_P,_P,_C, /* 120-127 */ + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 128-143 */ + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 144-159 */ + _S|_SP,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P, /* 160-175 */ + _P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P, /* 176-191 */ + _U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U, /* 192-207 */ + _U,_U,_U,_U,_U,_U,_U,_P,_U,_U,_U,_U,_U,_U,_U,_L, /* 208-223 */ + _L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L, /* 224-239 */ + _L,_L,_L,_L,_L,_L,_L,_P,_L,_L,_L,_L,_L,_L,_L,_L}; /* 240-255 */ + +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 4 + * tab-width: 4 + * indent-tabs-mode: nil + * End: + */ --=20 2.22.0 From nobody Thu May 2 21:37:19 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1603448238; cv=none; d=zohomail.com; s=zohoarc; b=m3GQTB0twCFwXilf5vBCuqUwCk29aBE4TK2F5QkQbbMtGwDgmVJFYxxxnkJB4KFTafI9+t+rRt5hb1XGKnTlbnFWTdDIALrya+BLQ76P22q6wfNApj4q95tqcFgIbhFMqZe7M5JOTZ3mWf+HKUUs3GgST0wCtfkcsTjRsiubxZQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603448238; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=RmpAqtIysPPO5lFZ7Uf4Eoflsy4m5GRirSii+2+b7OA=; b=gLfuX5ih37jVjrySZ+ad7YeiOSpuFdoawJfv9JURghn50Bki9DNDSvB4QTo1eoAahLvcexk3iuIRw0cymEBHPmqU3AiTvajcsP8t7peXydYk41knnT06oCGjGTmDoqHv7b2h9TPYK4Nr6A44OYEV7HgL+5fuFhV+M8gwGb8nu2M= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1603448238357359.2900502219379; Fri, 23 Oct 2020 03:17:18 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.10831.28919 (Exim 4.92) (envelope-from ) id 1kVu86-0000jj-1u; Fri, 23 Oct 2020 10:17:02 +0000 Received: by outflank-mailman (output) from mailman id 10831.28919; Fri, 23 Oct 2020 10:17:02 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kVu85-0000jc-UZ; Fri, 23 Oct 2020 10:17:01 +0000 Received: by outflank-mailman (input) for mailman id 10831; Fri, 23 Oct 2020 10:17:00 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kVu84-0000jK-Mj for xen-devel@lists.xenproject.org; Fri, 23 Oct 2020 10:17:00 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 9bb96d17-dae4-4dd4-b283-f43c8215731d; Fri, 23 Oct 2020 10:16:59 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 668EDB119; Fri, 23 Oct 2020 10:16:58 +0000 (UTC) Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kVu84-0000jK-Mj for xen-devel@lists.xenproject.org; Fri, 23 Oct 2020 10:17:00 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 9bb96d17-dae4-4dd4-b283-f43c8215731d; Fri, 23 Oct 2020 10:16:59 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 668EDB119; Fri, 23 Oct 2020 10:16:58 +0000 (UTC) X-Outflank-Mailman: Message body and most headers restored to incoming version 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: 9bb96d17-dae4-4dd4-b283-f43c8215731d X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1603448218; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=RmpAqtIysPPO5lFZ7Uf4Eoflsy4m5GRirSii+2+b7OA=; b=aSr1PvsdOKruMZ8+mtgvBW7J1bYL48F7UBAj8fWyJfYpL8Rjth8nZd709IegO297/OIedL 4IUH4iOfqnmiaL6vhtNJ5eXQd49bcWm8g1w3A+OaXzTLVgpAJNW7e8loa5rg80y/GntYQU /XgfiC1zen8jV1qqAUPEHWDQWhlkjek= Subject: [PATCH v2 2/8] lib: collect library files in an archive From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , George Dunlap , Ian Jackson , Julien Grall , Wei Liu , Stefano Stabellini References: Message-ID: <78dccec2-064f-d4b1-1865-eb3f1f14247a@suse.com> Date: Fri, 23 Oct 2020 12:17:00 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.12.1 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) Content-Type: text/plain; charset="utf-8" In order to (subsequently) drop odd things like CONFIG_NEEDS_LIST_SORT just to avoid bloating binaries when only some arch-es and/or configurations need generic library routines, combine objects under lib/ into an archive, which the linker then can pick the necessary objects out of. Note that we can't use thin archives just yet, until we've raised the minimum required binutils version suitably. Signed-off-by: Jan Beulich --- xen/Rules.mk | 33 +++++++++++++++++++++++++++------ xen/arch/arm/Makefile | 6 +++--- xen/arch/x86/Makefile | 8 ++++---- xen/lib/Makefile | 3 ++- 4 files changed, 36 insertions(+), 14 deletions(-) diff --git a/xen/Rules.mk b/xen/Rules.mk index 333e19bec343..e59c7f213f77 100644 --- a/xen/Rules.mk +++ b/xen/Rules.mk @@ -41,12 +41,16 @@ ALL_OBJS-y +=3D $(BASEDIR)/xsm/built_in.o ALL_OBJS-y +=3D $(BASEDIR)/arch/$(TARGET_ARCH)/built_in.o ALL_OBJS-$(CONFIG_CRYPTO) +=3D $(BASEDIR)/crypto/built_in.o =20 +ALL_LIBS-y :=3D $(BASEDIR)/lib/lib.a + # Initialise some variables +lib-y :=3D targets :=3D CFLAGS-y :=3D AFLAGS-y :=3D =20 ALL_OBJS :=3D $(ALL_OBJS-y) +ALL_LIBS :=3D $(ALL_LIBS-y) =20 SPECIAL_DATA_SECTIONS :=3D rodata $(foreach a,1 2 4 8 16, \ $(foreach w,1 2 4, \ @@ -60,7 +64,14 @@ include Makefile # ------------------------------------------------------------------------= --- =20 quiet_cmd_ld =3D LD $@ -cmd_ld =3D $(LD) $(XEN_LDFLAGS) -r -o $@ $(real-prereqs) +cmd_ld =3D $(LD) $(XEN_LDFLAGS) -r -o $@ $(filter-out %.a,$(real-prereqs))= \ + --start-group $(filter %.a,$(real-prereqs)) --end-group + +# Archive +# ------------------------------------------------------------------------= --- + +quiet_cmd_ar =3D AR $@ +cmd_ar =3D rm -f $@; $(AR) cPrs $@ $(real-prereqs) =20 # Objcopy # ------------------------------------------------------------------------= --- @@ -86,6 +97,10 @@ obj-y :=3D $(patsubst %/, %/built_in.o, $(obj-y)) # tell kbuild to descend subdir-obj-y :=3D $(filter %/built_in.o, $(obj-y)) =20 +# Libraries are always collected in one lib file. +# Filter out objects already built-in +lib-y :=3D $(filter-out $(obj-y), $(sort $(lib-y))) + $(filter %.init.o,$(obj-y) $(obj-bin-y) $(extra-y)): CFLAGS-y +=3D -DINIT_= SECTIONS_ONLY =20 ifeq ($(CONFIG_COVERAGE),y) @@ -129,19 +144,25 @@ include $(BASEDIR)/arch/$(TARGET_ARCH)/Rules.mk c_flags +=3D $(CFLAGS-y) a_flags +=3D $(CFLAGS-y) $(AFLAGS-y) =20 -built_in.o: $(obj-y) $(extra-y) +built_in.o: $(obj-y) $(if $(strip $(lib-y)),lib.a) $(extra-y) ifeq ($(obj-y),) $(CC) $(c_flags) -c -x c /dev/null -o $@ else ifeq ($(CONFIG_LTO),y) - $(LD_LTO) -r -o $@ $(filter-out $(extra-y),$^) + $(LD_LTO) -r -o $@ $(filter-out lib.a $(extra-y),$^) else - $(LD) $(XEN_LDFLAGS) -r -o $@ $(filter-out $(extra-y),$^) + $(LD) $(XEN_LDFLAGS) -r -o $@ $(filter-out lib.a $(extra-y),$^) endif endif =20 +lib.a: $(lib-y) FORCE + $(call if_changed,ar) + targets +=3D built_in.o -targets +=3D $(filter-out $(subdir-obj-y), $(obj-y)) $(extra-y) +ifneq ($(strip $(lib-y)),) +targets +=3D lib.a +endif +targets +=3D $(filter-out $(subdir-obj-y), $(obj-y) $(lib-y)) $(extra-y) targets +=3D $(MAKECMDGOALS) =20 built_in_bin.o: $(obj-bin-y) $(extra-y) @@ -155,7 +176,7 @@ endif PHONY +=3D FORCE FORCE: =20 -%/built_in.o: FORCE +%/built_in.o %/lib.a: FORCE $(MAKE) -f $(BASEDIR)/Rules.mk -C $* built_in.o =20 %/built_in_bin.o: FORCE diff --git a/xen/arch/arm/Makefile b/xen/arch/arm/Makefile index 296c5e68bbc3..612a83b315c8 100644 --- a/xen/arch/arm/Makefile +++ b/xen/arch/arm/Makefile @@ -90,14 +90,14 @@ endif =20 ifeq ($(CONFIG_LTO),y) # Gather all LTO objects together -prelink_lto.o: $(ALL_OBJS) - $(LD_LTO) -r -o $@ $^ +prelink_lto.o: $(ALL_OBJS) $(ALL_LIBS) + $(LD_LTO) -r -o $@ $(filter-out %.a,$^) --start-group $(filter %.a,$^) --= end-group =20 # Link it with all the binary objects prelink.o: $(patsubst %/built_in.o,%/built_in_bin.o,$(ALL_OBJS)) prelink_l= to.o $(call if_changed,ld) else -prelink.o: $(ALL_OBJS) FORCE +prelink.o: $(ALL_OBJS) $(ALL_LIBS) FORCE $(call if_changed,ld) endif =20 diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile index 9b368632fb43..8f2180485b2b 100644 --- a/xen/arch/x86/Makefile +++ b/xen/arch/x86/Makefile @@ -132,8 +132,8 @@ EFI_OBJS-$(XEN_BUILD_EFI) :=3D efi/relocs-dummy.o =20 ifeq ($(CONFIG_LTO),y) # Gather all LTO objects together -prelink_lto.o: $(ALL_OBJS) - $(LD_LTO) -r -o $@ $^ +prelink_lto.o: $(ALL_OBJS) $(ALL_LIBS) + $(LD_LTO) -r -o $@ $(filter-out %.a,$^) --start-group $(filter %.a,$^) --= end-group =20 # Link it with all the binary objects prelink.o: $(patsubst %/built_in.o,%/built_in_bin.o,$(ALL_OBJS)) prelink_l= to.o $(EFI_OBJS-y) FORCE @@ -142,10 +142,10 @@ prelink.o: $(patsubst %/built_in.o,%/built_in_bin.o,$= (ALL_OBJS)) prelink_lto.o $ prelink-efi.o: $(patsubst %/built_in.o,%/built_in_bin.o,$(ALL_OBJS)) preli= nk_lto.o FORCE $(call if_changed,ld) else -prelink.o: $(ALL_OBJS) $(EFI_OBJS-y) FORCE +prelink.o: $(ALL_OBJS) $(ALL_LIBS) $(EFI_OBJS-y) FORCE $(call if_changed,ld) =20 -prelink-efi.o: $(ALL_OBJS) FORCE +prelink-efi.o: $(ALL_OBJS) $(ALL_LIBS) FORCE $(call if_changed,ld) endif =20 diff --git a/xen/lib/Makefile b/xen/lib/Makefile index 53b1da025e0d..b8814361d63e 100644 --- a/xen/lib/Makefile +++ b/xen/lib/Makefile @@ -1,2 +1,3 @@ -obj-y +=3D ctype.o obj-$(CONFIG_X86) +=3D x86/ + +lib-y +=3D ctype.o --=20 2.22.0 From nobody Thu May 2 21:37:19 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1603448274; cv=none; d=zohomail.com; s=zohoarc; b=NWy1mIPL0eWNpt7nKAx/m1m+X01Rqwr6B5TSQ44eQwjfYGpcXHpvAe6pLPlUORUQwaehtFbVUlKlMgDKh0pd6rKeW5JJWZK76oR5gTLhAYMSorNmXLknaUHBd+BGn0ZLlSPh/kWU4eKBSFKzNheAZTfdxS6jAOKlrPzWRlp+sL0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603448274; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=AnVuJHJ9HHCqUnhfZFlaHrQ/ZUOGi/mDmoJBR1ZocoE=; b=jdjkOOS1rKvXD+mSf8y/Cl90kTWxtOur7qPvofeIRHpp6gG1OTmTeDlV6zQhkNpfdx+lqEiaT2hTGC+umVW7nAzpsuk0jCCwp3KPPOvdhjn39pi5D5sfPKlzn1dH2/2Y8G07+oaF4m2TcRYLDutY2PzwogmAGKv0K2jNllwrjvs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1603448274672232.27118990580948; Fri, 23 Oct 2020 03:17:54 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.10836.28931 (Exim 4.92) (envelope-from ) id 1kVu8d-0000sJ-EY; Fri, 23 Oct 2020 10:17:35 +0000 Received: by outflank-mailman (output) from mailman id 10836.28931; Fri, 23 Oct 2020 10:17:35 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kVu8d-0000sC-AZ; Fri, 23 Oct 2020 10:17:35 +0000 Received: by outflank-mailman (input) for mailman id 10836; Fri, 23 Oct 2020 10:17:33 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kVu8b-0000rz-Mz for xen-devel@lists.xenproject.org; Fri, 23 Oct 2020 10:17:33 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 779ed0c8-ef0a-479e-af2a-b6385233ac17; Fri, 23 Oct 2020 10:17:32 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 79572ACE5; Fri, 23 Oct 2020 10:17:31 +0000 (UTC) Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kVu8b-0000rz-Mz for xen-devel@lists.xenproject.org; Fri, 23 Oct 2020 10:17:33 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 779ed0c8-ef0a-479e-af2a-b6385233ac17; Fri, 23 Oct 2020 10:17:32 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 79572ACE5; Fri, 23 Oct 2020 10:17:31 +0000 (UTC) X-Outflank-Mailman: Message body and most headers restored to incoming version 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: 779ed0c8-ef0a-479e-af2a-b6385233ac17 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1603448251; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=AnVuJHJ9HHCqUnhfZFlaHrQ/ZUOGi/mDmoJBR1ZocoE=; b=MXE0qkjidzOX8LMSTweK1pL/nRHWpAyJxJiQxNR2DU4zXuTptwhOAlz0mvSXErqEdBFYSe hgH/MZGTrWlQ+rPQVJKB5YkuRGqqayKi69AsA8acgDR0F8bIaK2fvDHm+YmojMDIW7DqV4 7gjxTKRB/BsK5CW7kj2kRcLWXYKGXEQ= Subject: [PATCH v2 3/8] lib: move list sorting code From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , George Dunlap , Ian Jackson , Julien Grall , Wei Liu , Stefano Stabellini References: Message-ID: <19d28bcc-9e5b-4902-8e8d-ae95fbc560a6@suse.com> Date: Fri, 23 Oct 2020 12:17:33 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.12.1 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) Content-Type: text/plain; charset="utf-8" Build the source file always, as by putting it into an archive it still won't be linked into final binaries when not needed. This way possible build breakage will be easier to notice, and it's more consistent with us unconditionally building other library kind of code (e.g. sort() or bsearch()). While moving the source file, take the opportunity and drop the pointless EXPORT_SYMBOL(). Signed-off-by: Jan Beulich Build the source file always, as by putting it into an archive it still won't be linked into final binaries when not needed. This way possible build breakage will be easier to notice, and it's more consistent with us unconditionally building other library kind of code (e.g. sort() or bsearch()). While moving the source file, take the opportunity and drop the pointless EXPORT_SYMBOL(). Signed-off-by: Jan Beulich --- xen/arch/arm/Kconfig | 4 +--- xen/common/Kconfig | 3 --- xen/common/Makefile | 1 - xen/lib/Makefile | 1 + xen/{common/list_sort.c =3D> lib/list-sort.c} | 2 -- 5 files changed, 2 insertions(+), 9 deletions(-) rename xen/{common/list_sort.c =3D> lib/list-sort.c} (98%) diff --git a/xen/arch/arm/Kconfig b/xen/arch/arm/Kconfig index 277738826581..cb7e2523b6de 100644 --- a/xen/arch/arm/Kconfig +++ b/xen/arch/arm/Kconfig @@ -56,9 +56,7 @@ config HVM def_bool y =20 config NEW_VGIC - bool - prompt "Use new VGIC implementation" - select NEEDS_LIST_SORT + bool "Use new VGIC implementation" ---help--- =20 This is an alternative implementation of the ARM GIC interrupt diff --git a/xen/common/Kconfig b/xen/common/Kconfig index 3e2cf2508899..0661328a99e7 100644 --- a/xen/common/Kconfig +++ b/xen/common/Kconfig @@ -66,9 +66,6 @@ config MEM_ACCESS config NEEDS_LIBELF bool =20 -config NEEDS_LIST_SORT - bool - menu "Speculative hardening" =20 config SPECULATIVE_HARDEN_ARRAY diff --git a/xen/common/Makefile b/xen/common/Makefile index 083f62acb634..52d3c2aa9384 100644 --- a/xen/common/Makefile +++ b/xen/common/Makefile @@ -21,7 +21,6 @@ obj-y +=3D keyhandler.o obj-$(CONFIG_KEXEC) +=3D kexec.o obj-$(CONFIG_KEXEC) +=3D kimage.o obj-y +=3D lib.o -obj-$(CONFIG_NEEDS_LIST_SORT) +=3D list_sort.o obj-$(CONFIG_LIVEPATCH) +=3D livepatch.o livepatch_elf.o obj-$(CONFIG_MEM_ACCESS) +=3D mem_access.o obj-y +=3D memory.o diff --git a/xen/lib/Makefile b/xen/lib/Makefile index b8814361d63e..764f3624b5f9 100644 --- a/xen/lib/Makefile +++ b/xen/lib/Makefile @@ -1,3 +1,4 @@ obj-$(CONFIG_X86) +=3D x86/ =20 lib-y +=3D ctype.o +lib-y +=3D list-sort.o diff --git a/xen/common/list_sort.c b/xen/lib/list-sort.c similarity index 98% rename from xen/common/list_sort.c rename to xen/lib/list-sort.c index af2b2f6519f1..f8d8bbf28178 100644 --- a/xen/common/list_sort.c +++ b/xen/lib/list-sort.c @@ -15,7 +15,6 @@ * this program; If not, see . */ =20 -#include #include =20 #define MAX_LIST_LENGTH_BITS 20 @@ -154,4 +153,3 @@ void list_sort(void *priv, struct list_head *head, =20 merge_and_restore_back_links(priv, cmp, head, part[max_lev], list); } -EXPORT_SYMBOL(list_sort); --=20 2.22.0 From nobody Thu May 2 21:37:19 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1603448293; cv=none; d=zohomail.com; s=zohoarc; b=F3OkCBK7KwNkfscXklR50AnL21phL2OJzxS1qTSN0de++cINzkdwHuPE6w97zZzRz+DldjS1zIDwx4exYx5L6ywn+58YA0cu5Fgo+5Vid74ZZJ336qRwziq/CFO/U/3LAiYyuvLhTTPQGFB2Edi3gvW8BQ2l2ImxTafWk97K+YA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603448293; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=lboJsbVVVivJxZqzJYi7juIk44SP83bI03BaDd0lLh0=; b=W0w+D25rp65ZnWi8PXt942sho2Gt1z/v8PQBLIAlCL9HBzPcWg70vdx2+rK5f2W13pvQZohjz/5ktnpF7oKJ1UN8m/mNoD2tnnCZRxm2tvewWr4UxfV5i+KhhfEfRZMlKOzD60USlCCOMCumUwrRqjpEIlciDIqXJxvI+a+m5lk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1603448293599588.9883339108812; Fri, 23 Oct 2020 03:18:13 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.10838.28943 (Exim 4.92) (envelope-from ) id 1kVu8z-0000zA-Mz; Fri, 23 Oct 2020 10:17:57 +0000 Received: by outflank-mailman (output) from mailman id 10838.28943; Fri, 23 Oct 2020 10:17:57 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kVu8z-0000z3-Je; Fri, 23 Oct 2020 10:17:57 +0000 Received: by outflank-mailman (input) for mailman id 10838; Fri, 23 Oct 2020 10:17:56 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kVu8y-0000y9-LC for xen-devel@lists.xenproject.org; Fri, 23 Oct 2020 10:17:56 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id d1efb48a-f6e2-4908-9f61-dd4124a1059b; Fri, 23 Oct 2020 10:17:55 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id CADF1ACE5; Fri, 23 Oct 2020 10:17:54 +0000 (UTC) Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kVu8y-0000y9-LC for xen-devel@lists.xenproject.org; Fri, 23 Oct 2020 10:17:56 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id d1efb48a-f6e2-4908-9f61-dd4124a1059b; Fri, 23 Oct 2020 10:17:55 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id CADF1ACE5; Fri, 23 Oct 2020 10:17:54 +0000 (UTC) X-Outflank-Mailman: Message body and most headers restored to incoming version 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: d1efb48a-f6e2-4908-9f61-dd4124a1059b X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1603448274; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lboJsbVVVivJxZqzJYi7juIk44SP83bI03BaDd0lLh0=; b=d7JRslfZpV10EQNMgStARo6DYp3Erxmt5QyZ7NOhx+0RYrveX2Dv0rybI26yPk6kSDz1EZ C5WOfuh/oH0vgxyaSslaMGJmWWOzqmqO4P0PelTqMt2m0litpYy3wei1DjCc7bzRRDFzX9 6786r+dMtVfrKAVAd8ucuW17fQ857vA= Subject: [PATCH v2 4/8] lib: move parse_size_and_unit() From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , George Dunlap , Ian Jackson , Julien Grall , Wei Liu , Stefano Stabellini References: Message-ID: Date: Fri, 23 Oct 2020 12:17:57 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.12.1 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) Content-Type: text/plain; charset="utf-8" ... into its own CU, to build it into an archive. Signed-off-by: Jan Beulich ... into its own CU, to build it into an archive. Signed-off-by: Jan Beulich Acked-by: Julien Grall --- xen/common/lib.c | 39 ---------------------------------- xen/lib/Makefile | 1 + xen/lib/parse-size.c | 50 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 51 insertions(+), 39 deletions(-) create mode 100644 xen/lib/parse-size.c diff --git a/xen/common/lib.c b/xen/common/lib.c index a224efa8f6e8..6cfa332142a5 100644 --- a/xen/common/lib.c +++ b/xen/common/lib.c @@ -423,45 +423,6 @@ uint64_t muldiv64(uint64_t a, uint32_t b, uint32_t c) #endif } =20 -unsigned long long parse_size_and_unit(const char *s, const char **ps) -{ - unsigned long long ret; - const char *s1; - - ret =3D simple_strtoull(s, &s1, 0); - - switch ( *s1 ) - { - case 'T': case 't': - ret <<=3D 10; - /* fallthrough */ - case 'G': case 'g': - ret <<=3D 10; - /* fallthrough */ - case 'M': case 'm': - ret <<=3D 10; - /* fallthrough */ - case 'K': case 'k': - ret <<=3D 10; - /* fallthrough */ - case 'B': case 'b': - s1++; - break; - case '%': - if ( ps ) - break; - /* fallthrough */ - default: - ret <<=3D 10; /* default to kB */ - break; - } - - if ( ps !=3D NULL ) - *ps =3D s1; - - return ret; -} - typedef void (*ctor_func_t)(void); extern const ctor_func_t __ctors_start[], __ctors_end[]; =20 diff --git a/xen/lib/Makefile b/xen/lib/Makefile index 764f3624b5f9..99f857540c99 100644 --- a/xen/lib/Makefile +++ b/xen/lib/Makefile @@ -2,3 +2,4 @@ obj-$(CONFIG_X86) +=3D x86/ =20 lib-y +=3D ctype.o lib-y +=3D list-sort.o +lib-y +=3D parse-size.o diff --git a/xen/lib/parse-size.c b/xen/lib/parse-size.c new file mode 100644 index 000000000000..ec980cadfff3 --- /dev/null +++ b/xen/lib/parse-size.c @@ -0,0 +1,50 @@ +#include + +unsigned long long parse_size_and_unit(const char *s, const char **ps) +{ + unsigned long long ret; + const char *s1; + + ret =3D simple_strtoull(s, &s1, 0); + + switch ( *s1 ) + { + case 'T': case 't': + ret <<=3D 10; + /* fallthrough */ + case 'G': case 'g': + ret <<=3D 10; + /* fallthrough */ + case 'M': case 'm': + ret <<=3D 10; + /* fallthrough */ + case 'K': case 'k': + ret <<=3D 10; + /* fallthrough */ + case 'B': case 'b': + s1++; + break; + case '%': + if ( ps ) + break; + /* fallthrough */ + default: + ret <<=3D 10; /* default to kB */ + break; + } + + if ( ps !=3D NULL ) + *ps =3D s1; + + return ret; +} + +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 4 + * tab-width: 4 + * indent-tabs-mode: nil + * End: + */ --=20 2.22.0 From nobody Thu May 2 21:37:19 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1603448317; cv=none; d=zohomail.com; s=zohoarc; b=Eq2ZE2m4ieX7pKZD6fARKdD3J8O+mXX8Gf34l478XTWkhbsT7aSMcL8Bjb0hhLkTi+cvBVOa1oja+raszsPX5HSzyksZkhcenIt6IMDY6umthbbMcSf5vmws58+P4ktj/sGEEyloYkA2aVHJnwo/ensSVgjH4TFHd0+npR11Q6w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603448317; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=hiYMWegp/VfyOCwZBfvaVvgad/gyWFZAtZKLyIpg09Y=; b=jITaoJ1dnqmlEnOE08gmoJKxs+x2l1c85yxKTDFzuA9KB6Ap0Rhw+suS3d/uIhOZfDINIO05rlUYeZ5lsOqPdvRUBqH4HHBsIH7CdtaL1KB6YlgMOsIGPx8icUrLHiEe9JsDnwU0Z+k3MoL/dRoevt+1gchQSA49zddqD8quKuA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1603448317665862.099813922035; Fri, 23 Oct 2020 03:18:37 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.10840.28955 (Exim 4.92) (envelope-from ) id 1kVu9N-00017d-0t; Fri, 23 Oct 2020 10:18:21 +0000 Received: by outflank-mailman (output) from mailman id 10840.28955; Fri, 23 Oct 2020 10:18:20 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kVu9M-00017W-Tc; Fri, 23 Oct 2020 10:18:20 +0000 Received: by outflank-mailman (input) for mailman id 10840; Fri, 23 Oct 2020 10:18:19 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kVu9L-00017F-GR for xen-devel@lists.xenproject.org; Fri, 23 Oct 2020 10:18:19 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id eb9262d6-4b1a-40e3-8b2a-c5fae1855b95; Fri, 23 Oct 2020 10:18:18 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id E4078ABD1; Fri, 23 Oct 2020 10:18:17 +0000 (UTC) Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kVu9L-00017F-GR for xen-devel@lists.xenproject.org; Fri, 23 Oct 2020 10:18:19 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id eb9262d6-4b1a-40e3-8b2a-c5fae1855b95; Fri, 23 Oct 2020 10:18:18 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id E4078ABD1; Fri, 23 Oct 2020 10:18:17 +0000 (UTC) X-Outflank-Mailman: Message body and most headers restored to incoming version 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: eb9262d6-4b1a-40e3-8b2a-c5fae1855b95 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1603448298; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hiYMWegp/VfyOCwZBfvaVvgad/gyWFZAtZKLyIpg09Y=; b=rd7FfW8aL3ICa21jysoMfzvGKWMD5ytujfcJa3P95iXA4EWJHRnp6Xzpxzz8vRusGl2EXZ 5Jrx5/r4QDrjK3l9P1DdNs/bXfMzD86hjEN3q2Ko52Mq0RXxgjbxBUqQbJ54vtrG+mKV2w w40cSPEFAnqC9r3ZhrAdujL94BuYouQ= Subject: [PATCH v2 5/8] lib: move init_constructors() From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , George Dunlap , Ian Jackson , Julien Grall , Wei Liu , Stefano Stabellini References: Message-ID: Date: Fri, 23 Oct 2020 12:18:20 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.12.1 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) Content-Type: text/plain; charset="utf-8" ... into its own CU, for being unrelated to other things in common/lib.c. For now it gets compiled into built_in.o rather than lib.a, as it gets used unconditionally by Arm's as well as x86'es {,__}start_xen(). But this could be changed in principle, the more that there typically aren't any constructors anyway. Then again it's just __init code anyway. Signed-off-by: Jan Beulich --- xen/common/lib.c | 14 -------------- xen/lib/Makefile | 1 + xen/lib/ctors.c | 25 +++++++++++++++++++++++++ 3 files changed, 26 insertions(+), 14 deletions(-) create mode 100644 xen/lib/ctors.c diff --git a/xen/common/lib.c b/xen/common/lib.c index 6cfa332142a5..f5ca179a0af4 100644 --- a/xen/common/lib.c +++ b/xen/common/lib.c @@ -1,6 +1,5 @@ #include #include -#include #include =20 /* @@ -423,19 +422,6 @@ uint64_t muldiv64(uint64_t a, uint32_t b, uint32_t c) #endif } =20 -typedef void (*ctor_func_t)(void); -extern const ctor_func_t __ctors_start[], __ctors_end[]; - -void __init init_constructors(void) -{ - const ctor_func_t *f; - for ( f =3D __ctors_start; f < __ctors_end; ++f ) - (*f)(); - - /* Putting this here seems as good (or bad) as any other place. */ - BUILD_BUG_ON(sizeof(size_t) !=3D sizeof(ssize_t)); -} - /* * Local variables: * mode: C diff --git a/xen/lib/Makefile b/xen/lib/Makefile index 99f857540c99..ba1fb7bcdee2 100644 --- a/xen/lib/Makefile +++ b/xen/lib/Makefile @@ -1,3 +1,4 @@ +obj-y +=3D ctors.o obj-$(CONFIG_X86) +=3D x86/ =20 lib-y +=3D ctype.o diff --git a/xen/lib/ctors.c b/xen/lib/ctors.c new file mode 100644 index 000000000000..5bdc591cd50a --- /dev/null +++ b/xen/lib/ctors.c @@ -0,0 +1,25 @@ +#include +#include + +typedef void (*ctor_func_t)(void); +extern const ctor_func_t __ctors_start[], __ctors_end[]; + +void __init init_constructors(void) +{ + const ctor_func_t *f; + for ( f =3D __ctors_start; f < __ctors_end; ++f ) + (*f)(); + + /* Putting this here seems as good (or bad) as any other place. */ + BUILD_BUG_ON(sizeof(size_t) !=3D sizeof(ssize_t)); +} + +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 4 + * tab-width: 4 + * indent-tabs-mode: nil + * End: + */ --=20 2.22.0 From nobody Thu May 2 21:37:19 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1603448341; cv=none; d=zohomail.com; s=zohoarc; b=b3X2p7QhfJETS+0Oo4hZCPa/J7s7/DdersFOoXb6ojKR6hHFMqQF/px+VnK88DQEqBjITTph5sxgTSX3CVC5qa+axAsu9xwPNe+VCI0PVCD2u9S/N1YVifm2IHADgHSl0R/lJGFrw/BgPefnbSkVE5AtNszn+8RXO8LKu5qbZKA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603448341; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=jNlq7Fb23c+zpnGBIkWqGuhMfVaSAd3Up+ZrIih1Y4E=; b=M551Nzq3uLEIfLED+TvvbxIz1lgWrkZqQiXG2mr6Rfkh71SQIuMynwWosWdjChclCcWf6JtA9AYeuAbRw7IHtIUW0qfEHNVzhr2vtO96nMOMfgpHdgtZM6O+RyZKssVvT6900m+1+SilNm6AzMLxu5Rsa+Pl7xOXGOVsJJvrIrM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1603448341057138.28806169326867; Fri, 23 Oct 2020 03:19:01 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.10844.28967 (Exim 4.92) (envelope-from ) id 1kVu9l-0001Ex-9H; Fri, 23 Oct 2020 10:18:45 +0000 Received: by outflank-mailman (output) from mailman id 10844.28967; Fri, 23 Oct 2020 10:18:45 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kVu9l-0001Eo-5s; Fri, 23 Oct 2020 10:18:45 +0000 Received: by outflank-mailman (input) for mailman id 10844; Fri, 23 Oct 2020 10:18:43 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kVu9j-0001EP-C1 for xen-devel@lists.xenproject.org; Fri, 23 Oct 2020 10:18:43 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 473feced-7ce0-4248-b48d-f757c6930424; Fri, 23 Oct 2020 10:18:42 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id A9433AD04; Fri, 23 Oct 2020 10:18:41 +0000 (UTC) Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kVu9j-0001EP-C1 for xen-devel@lists.xenproject.org; Fri, 23 Oct 2020 10:18:43 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 473feced-7ce0-4248-b48d-f757c6930424; Fri, 23 Oct 2020 10:18:42 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id A9433AD04; Fri, 23 Oct 2020 10:18:41 +0000 (UTC) X-Outflank-Mailman: Message body and most headers restored to incoming version 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: 473feced-7ce0-4248-b48d-f757c6930424 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1603448321; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=jNlq7Fb23c+zpnGBIkWqGuhMfVaSAd3Up+ZrIih1Y4E=; b=qObMJquwH1Tb1DW/N461rruhf7lhaKuVIgOKvX0YkCBKrCg89wETxoBJIXsh8CU9dfyYZf Lsc7KBu33ppafNgYp5jTFF2w7R4gb5ymA9/+DbcZo1gPUUGnaUDyxdAOpvwpihQ3WNKUA2 miLupi02MxxkHsHzsB+6vmYKpUMoVYo= Subject: [PATCH v2 6/8] lib: move rbtree code From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , George Dunlap , Ian Jackson , Julien Grall , Wei Liu , Stefano Stabellini References: Message-ID: Date: Fri, 23 Oct 2020 12:18:43 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.12.1 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) Content-Type: text/plain; charset="utf-8" Build this code into an archive, which results in not linking it into x86 final binaries. This saves about 1.5k of dead code. While moving the source file, take the opportunity and drop the pointless EXPORT_SYMBOL(). Signed-off-by: Jan Beulich --- xen/common/Makefile | 1 - xen/lib/Makefile | 1 + xen/{common =3D> lib}/rbtree.c | 9 +-------- 3 files changed, 2 insertions(+), 9 deletions(-) rename xen/{common =3D> lib}/rbtree.c (98%) diff --git a/xen/common/Makefile b/xen/common/Makefile index 52d3c2aa9384..7bb779f780a1 100644 --- a/xen/common/Makefile +++ b/xen/common/Makefile @@ -33,7 +33,6 @@ obj-y +=3D preempt.o obj-y +=3D random.o obj-y +=3D rangeset.o obj-y +=3D radix-tree.o -obj-y +=3D rbtree.o obj-y +=3D rcupdate.o obj-y +=3D rwlock.o obj-y +=3D shutdown.o diff --git a/xen/lib/Makefile b/xen/lib/Makefile index ba1fb7bcdee2..b469d2dff7b8 100644 --- a/xen/lib/Makefile +++ b/xen/lib/Makefile @@ -4,3 +4,4 @@ obj-$(CONFIG_X86) +=3D x86/ lib-y +=3D ctype.o lib-y +=3D list-sort.o lib-y +=3D parse-size.o +lib-y +=3D rbtree.o diff --git a/xen/common/rbtree.c b/xen/lib/rbtree.c similarity index 98% rename from xen/common/rbtree.c rename to xen/lib/rbtree.c index 9f5498a89d4e..95e045d52461 100644 --- a/xen/common/rbtree.c +++ b/xen/lib/rbtree.c @@ -25,7 +25,7 @@ #include =20 /* - * red-black trees properties: http://en.wikipedia.org/wiki/Rbtree=20 + * red-black trees properties: http://en.wikipedia.org/wiki/Rbtree * * 1) A node is either red or black * 2) The root is black @@ -223,7 +223,6 @@ void rb_insert_color(struct rb_node *node, struct rb_ro= ot *root) } } } -EXPORT_SYMBOL(rb_insert_color); =20 static void __rb_erase_color(struct rb_node *parent, struct rb_root *root) { @@ -467,7 +466,6 @@ void rb_erase(struct rb_node *node, struct rb_root *roo= t) if (rebalance) __rb_erase_color(rebalance, root); } -EXPORT_SYMBOL(rb_erase); =20 /* * This function returns the first node (in sort order) of the tree. @@ -483,7 +481,6 @@ struct rb_node *rb_first(const struct rb_root *root) n =3D n->rb_left; return n; } -EXPORT_SYMBOL(rb_first); =20 struct rb_node *rb_last(const struct rb_root *root) { @@ -496,7 +493,6 @@ struct rb_node *rb_last(const struct rb_root *root) n =3D n->rb_right; return n; } -EXPORT_SYMBOL(rb_last); =20 struct rb_node *rb_next(const struct rb_node *node) { @@ -528,7 +524,6 @@ struct rb_node *rb_next(const struct rb_node *node) =20 return parent; } -EXPORT_SYMBOL(rb_next); =20 struct rb_node *rb_prev(const struct rb_node *node) { @@ -557,7 +552,6 @@ struct rb_node *rb_prev(const struct rb_node *node) =20 return parent; } -EXPORT_SYMBOL(rb_prev); =20 void rb_replace_node(struct rb_node *victim, struct rb_node *new, struct rb_root *root) @@ -574,4 +568,3 @@ void rb_replace_node(struct rb_node *victim, struct rb_= node *new, /* Copy the pointers/colour from the victim to the replacement */ *new =3D *victim; } -EXPORT_SYMBOL(rb_replace_node); --=20 2.22.0 From nobody Thu May 2 21:37:19 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1603448367; cv=none; d=zohomail.com; s=zohoarc; b=RivJiRzDk8yAQn1rnTl0A2E2OSAkJXc5r8AqiVKwRqcPdP0mxWoQtX8nWnGW0s1d10T+lc3ELSvs0GTUi9Ndcx7Es3ccu8ldUcjGV/DZLzodDY4737Qaw6R+zU3CUhw+AsdcuGslKgWYdy/CJsN6tjxhItCnZjvdDLoeMEWhP3s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603448367; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=7kZoCIqv4yQVugUvj1z6blQttzij9hYwlGKaJUnpBgI=; b=TfXl4jagp9D7L1D8KIbku3C8mfQAfEOg1AHuFz++vdq9N51oGJg/1XZ9Ox71cwuZ451bYOztv/TPDDTVAzrDH8mesPBrao2+EEr8o7LASjyTlKL0fqdQunZBKbcr48sEOMY0ZKtgO+8ddnbkeGudde3sWw61NsSyDEYMbqOg1XA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1603448367801578.7819362085335; Fri, 23 Oct 2020 03:19:27 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.10849.28979 (Exim 4.92) (envelope-from ) id 1kVuA9-0001Mj-Jy; Fri, 23 Oct 2020 10:19:09 +0000 Received: by outflank-mailman (output) from mailman id 10849.28979; Fri, 23 Oct 2020 10:19:09 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kVuA9-0001Mc-G7; Fri, 23 Oct 2020 10:19:09 +0000 Received: by outflank-mailman (input) for mailman id 10849; Fri, 23 Oct 2020 10:19:07 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kVuA7-0001ML-Ne for xen-devel@lists.xenproject.org; Fri, 23 Oct 2020 10:19:07 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 1014aeee-1e22-4d37-a6d0-95a688ff8cf7; Fri, 23 Oct 2020 10:19:06 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id D9A7CAD04; Fri, 23 Oct 2020 10:19:05 +0000 (UTC) Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kVuA7-0001ML-Ne for xen-devel@lists.xenproject.org; Fri, 23 Oct 2020 10:19:07 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 1014aeee-1e22-4d37-a6d0-95a688ff8cf7; Fri, 23 Oct 2020 10:19:06 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id D9A7CAD04; Fri, 23 Oct 2020 10:19:05 +0000 (UTC) X-Outflank-Mailman: Message body and most headers restored to incoming version 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: 1014aeee-1e22-4d37-a6d0-95a688ff8cf7 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1603448346; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7kZoCIqv4yQVugUvj1z6blQttzij9hYwlGKaJUnpBgI=; b=NWq48x/RySaomVo5kON84Ox76WEKa0qzw91tc1UM95npyomVIUXhXGr6U4Zw6tXnaQW+cC YT/aTY8Y+LTxeq0LmQWSwK5wgFsNRKBaV4rtGU78eL9ByJgrmvKl2D8bT/2TETc2Rn1MW3 X8JK1d/OE9HanmEibBWABAUXQJIUEQM= Subject: [PATCH v2 7/8] lib: move bsearch code From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , George Dunlap , Ian Jackson , Julien Grall , Wei Liu , Stefano Stabellini References: Message-ID: <87a20884-5a76-a664-dcc9-bd4becee40b3@suse.com> Date: Fri, 23 Oct 2020 12:19:08 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.12.1 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) Content-Type: text/plain; charset="utf-8" Convert this code to an inline function (backed by an instance in an archive in case the compiler decides against inlining), which results in not having it in x86 final binaries. This saves a little bit of dead code. Signed-off-by: Jan Beulich Reviewed-by: Bertrand Marquis --- v2: Make the function an extern inline in its header. --- xen/common/Makefile | 1 - xen/common/bsearch.c | 51 -------------------------------------- xen/include/xen/compiler.h | 1 + xen/include/xen/lib.h | 42 ++++++++++++++++++++++++++++++- xen/lib/Makefile | 1 + xen/lib/bsearch.c | 13 ++++++++++ 6 files changed, 56 insertions(+), 53 deletions(-) delete mode 100644 xen/common/bsearch.c create mode 100644 xen/lib/bsearch.c diff --git a/xen/common/Makefile b/xen/common/Makefile index 7bb779f780a1..d8519a2cc163 100644 --- a/xen/common/Makefile +++ b/xen/common/Makefile @@ -1,6 +1,5 @@ obj-$(CONFIG_ARGO) +=3D argo.o obj-y +=3D bitmap.o -obj-y +=3D bsearch.o obj-$(CONFIG_HYPFS_CONFIG) +=3D config_data.o obj-$(CONFIG_CORE_PARKING) +=3D core_parking.o obj-y +=3D cpu.o diff --git a/xen/common/bsearch.c b/xen/common/bsearch.c deleted file mode 100644 index 7090930aab5c..000000000000 --- a/xen/common/bsearch.c +++ /dev/null @@ -1,51 +0,0 @@ -/* - * A generic implementation of binary search for the Linux kernel - * - * Copyright (C) 2008-2009 Ksplice, Inc. - * Author: Tim Abbott - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; version 2. - */ - -#include - -/* - * bsearch - binary search an array of elements - * @key: pointer to item being searched for - * @base: pointer to first element to search - * @num: number of elements - * @size: size of each element - * @cmp: pointer to comparison function - * - * This function does a binary search on the given array. The - * contents of the array should already be in ascending sorted order - * under the provided comparison function. - * - * Note that the key need not have the same type as the elements in - * the array, e.g. key could be a string and the comparison function - * could compare the string with the struct's name field. However, if - * the key and elements in the array are of the same type, you can use - * the same comparison function for both sort() and bsearch(). - */ -void *bsearch(const void *key, const void *base, size_t num, size_t size, - int (*cmp)(const void *key, const void *elt)) -{ - size_t start =3D 0, end =3D num; - int result; - - while (start < end) { - size_t mid =3D start + (end - start) / 2; - - result =3D cmp(key, base + mid * size); - if (result < 0) - end =3D mid; - else if (result > 0) - start =3D mid + 1; - else - return (void *)base + mid * size; - } - - return NULL; -} diff --git a/xen/include/xen/compiler.h b/xen/include/xen/compiler.h index c0e0ee9f27be..2b7acdf3b188 100644 --- a/xen/include/xen/compiler.h +++ b/xen/include/xen/compiler.h @@ -12,6 +12,7 @@ =20 #define inline __inline__ #define always_inline __inline__ __attribute__ ((__always_inline__)) +#define gnu_inline __inline__ __attribute__ ((__gnu_inline__)) #define noinline __attribute__((__noinline__)) =20 #define noreturn __attribute__((__noreturn__)) diff --git a/xen/include/xen/lib.h b/xen/include/xen/lib.h index 076bcfb67dbb..940d23755661 100644 --- a/xen/include/xen/lib.h +++ b/xen/include/xen/lib.h @@ -192,8 +192,48 @@ void dump_execstate(struct cpu_user_regs *); =20 void init_constructors(void); =20 +/* + * bsearch - binary search an array of elements + * @key: pointer to item being searched for + * @base: pointer to first element to search + * @num: number of elements + * @size: size of each element + * @cmp: pointer to comparison function + * + * This function does a binary search on the given array. The + * contents of the array should already be in ascending sorted order + * under the provided comparison function. + * + * Note that the key need not have the same type as the elements in + * the array, e.g. key could be a string and the comparison function + * could compare the string with the struct's name field. However, if + * the key and elements in the array are of the same type, you can use + * the same comparison function for both sort() and bsearch(). + */ +#ifndef BSEARCH_IMPLEMENTATION +extern gnu_inline +#endif void *bsearch(const void *key, const void *base, size_t num, size_t size, - int (*cmp)(const void *key, const void *elt)); + int (*cmp)(const void *key, const void *elt)) +{ + size_t start =3D 0, end =3D num; + int result; + + while ( start < end ) + { + size_t mid =3D start + (end - start) / 2; + + result =3D cmp(key, base + mid * size); + if ( result < 0 ) + end =3D mid; + else if ( result > 0 ) + start =3D mid + 1; + else + return (void *)base + mid * size; + } + + return NULL; +} =20 #endif /* __ASSEMBLY__ */ =20 diff --git a/xen/lib/Makefile b/xen/lib/Makefile index b469d2dff7b8..122eeb3d327b 100644 --- a/xen/lib/Makefile +++ b/xen/lib/Makefile @@ -1,6 +1,7 @@ obj-y +=3D ctors.o obj-$(CONFIG_X86) +=3D x86/ =20 +lib-y +=3D bsearch.o lib-y +=3D ctype.o lib-y +=3D list-sort.o lib-y +=3D parse-size.o diff --git a/xen/lib/bsearch.c b/xen/lib/bsearch.c new file mode 100644 index 000000000000..149f7feafd1f --- /dev/null +++ b/xen/lib/bsearch.c @@ -0,0 +1,13 @@ +/* + * A generic implementation of binary search for the Linux kernel + * + * Copyright (C) 2008-2009 Ksplice, Inc. + * Author: Tim Abbott + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; version 2. + */ + +#define BSEARCH_IMPLEMENTATION +#include --=20 2.22.0 From nobody Thu May 2 21:37:19 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1603448386; cv=none; d=zohomail.com; s=zohoarc; b=n4Ctzj7HVAyiCkgJzCHiA96DCrDHp3tIj9sh/u1mIeyT3Z4IWsPkaphHfruO+kK8n3HVLTcj+h48dZFAXXHHFO+jOMpf9SrjaQvu/t7jzAz7GEVd9/s2+EUV1ULH6+LqOCuujJ2AjrLe2wEePYI0MsQC+cWMeVuvvMqxt10VKbo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603448386; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=fCENBea3g/sHEZshbnkZNqrNEizuK/QJ9N/S6MkmEq8=; b=ep6mFtiU3fLiILyCYJ0Xkr/NFGWa/o/aWQ5YBfL5U6XCLBjhr24ExtSQrOtkTOpZU85J3pV2nQlFhvPZF1iwJx5dCeOo59oORbEOQMvrPQjL6d6Z+KSCaYnfngH0LbSzMr1a0YrgIAdyVhQkxxnXgXJhnonvYnn2pTkq7pQm934= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1603448386012114.53320287685403; Fri, 23 Oct 2020 03:19:46 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.10853.28991 (Exim 4.92) (envelope-from ) id 1kVuAV-0001US-20; Fri, 23 Oct 2020 10:19:31 +0000 Received: by outflank-mailman (output) from mailman id 10853.28991; Fri, 23 Oct 2020 10:19:31 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kVuAU-0001UK-Tm; Fri, 23 Oct 2020 10:19:30 +0000 Received: by outflank-mailman (input) for mailman id 10853; Fri, 23 Oct 2020 10:19:30 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kVuAU-0001UA-AA for xen-devel@lists.xenproject.org; Fri, 23 Oct 2020 10:19:30 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 6efcfda2-f466-4fd9-9f2b-d863559826d4; Fri, 23 Oct 2020 10:19:29 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 67F9FABD1; Fri, 23 Oct 2020 10:19:28 +0000 (UTC) Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kVuAU-0001UA-AA for xen-devel@lists.xenproject.org; Fri, 23 Oct 2020 10:19:30 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 6efcfda2-f466-4fd9-9f2b-d863559826d4; Fri, 23 Oct 2020 10:19:29 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 67F9FABD1; Fri, 23 Oct 2020 10:19:28 +0000 (UTC) X-Outflank-Mailman: Message body and most headers restored to incoming version 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: 6efcfda2-f466-4fd9-9f2b-d863559826d4 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1603448368; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fCENBea3g/sHEZshbnkZNqrNEizuK/QJ9N/S6MkmEq8=; b=oIEzmmO3m16L6bX9CkxGbuw5XprILZWZyYFfix657HEk4sWWwuiCSFyRxGrbHpPD0prqxA UYKKEW8P3iZK5z6D6GcBlJRKroj0pIEHFZ208aj/bBn+Fvehfp+StKOCdbLkVX5Orn+4nc bXMW2Kdrs79PHkiYZ1pezYcyFhDcQDg= Subject: [PATCH v2 8/8] lib: move sort code From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , George Dunlap , Ian Jackson , Julien Grall , Wei Liu , Stefano Stabellini References: Message-ID: <293585a3-5475-0c02-19ce-c2080b2deab1@suse.com> Date: Fri, 23 Oct 2020 12:19:30 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.12.1 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) Content-Type: text/plain; charset="utf-8" Build this code into an archive, partly paralleling bsearch(). Signed-off-by: Jan Beulich Acked-by: Julien Grall --- xen/common/Makefile | 1 - xen/lib/Makefile | 1 + xen/{common =3D> lib}/sort.c | 0 3 files changed, 1 insertion(+), 1 deletion(-) rename xen/{common =3D> lib}/sort.c (100%) diff --git a/xen/common/Makefile b/xen/common/Makefile index d8519a2cc163..90c679958965 100644 --- a/xen/common/Makefile +++ b/xen/common/Makefile @@ -36,7 +36,6 @@ obj-y +=3D rcupdate.o obj-y +=3D rwlock.o obj-y +=3D shutdown.o obj-y +=3D softirq.o -obj-y +=3D sort.o obj-y +=3D smp.o obj-y +=3D spinlock.o obj-y +=3D stop_machine.o diff --git a/xen/lib/Makefile b/xen/lib/Makefile index 122eeb3d327b..33ff322b1655 100644 --- a/xen/lib/Makefile +++ b/xen/lib/Makefile @@ -6,3 +6,4 @@ lib-y +=3D ctype.o lib-y +=3D list-sort.o lib-y +=3D parse-size.o lib-y +=3D rbtree.o +lib-y +=3D sort.o diff --git a/xen/common/sort.c b/xen/lib/sort.c similarity index 100% rename from xen/common/sort.c rename to xen/lib/sort.c --=20 2.22.0