From patchwork Thu Aug 8 12:23:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wieczorkiewicz, Pawel" X-Patchwork-Id: 11084073 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8DED313B1 for ; Thu, 8 Aug 2019 12:25:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 74D0F28694 for ; Thu, 8 Aug 2019 12:25:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6268F2883A; Thu, 8 Aug 2019 12:25:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00,DKIM_ADSP_ALL, DKIM_INVALID,DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id F24D628694 for ; Thu, 8 Aug 2019 12:25:49 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hvhSQ-0003Xs-UB; Thu, 08 Aug 2019 12:23:50 +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.89) (envelope-from ) id 1hvhSP-0003Xm-To for xen-devel@lists.xen.org; Thu, 08 Aug 2019 12:23:50 +0000 X-Inumbo-ID: 5dfd7508-b9d7-11e9-bf43-ab86a4908789 Received: from smtp-fw-33001.amazon.com (unknown [207.171.190.10]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 5dfd7508-b9d7-11e9-bf43-ab86a4908789; Thu, 08 Aug 2019 12:23:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.de; i=@amazon.de; q=dns/txt; s=amazon201209; t=1565267026; x=1596803026; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=zfluy9OxooAdZWBZYasAC8ZsEchgo63lERiexEBAoHc=; b=wH/xm48zXCoEzWAIW9geqXm70iHaLXD6NFIEOR85xzsJvD0DrPRE2KpD ZICFLNiQLou9Uv77KqUaEMlx80oi/+KtI0vsyYTLnW/z2fEU5S53QHkAM uz4KSS2TyDiGkN25bUP4WtbuRhYff7aQhuBUBl2KcCjuoE+oTroE88n6Q M=; X-IronPort-AV: E=Sophos;i="5.64,361,1559520000"; d="scan'208";a="817918258" Received: from sea3-co-svc-lb6-vlan2.sea.amazon.com (HELO email-inbound-relay-2a-119b4f96.us-west-2.amazon.com) ([10.47.22.34]) by smtp-border-fw-out-33001.sea14.amazon.com with ESMTP; 08 Aug 2019 12:23:41 +0000 Received: from EX13MTAUEA001.ant.amazon.com (pdx4-ws-svc-p6-lb7-vlan2.pdx.amazon.com [10.170.41.162]) by email-inbound-relay-2a-119b4f96.us-west-2.amazon.com (Postfix) with ESMTPS id 6022D1A55E1; Thu, 8 Aug 2019 12:23:41 +0000 (UTC) Received: from EX13D03EUA001.ant.amazon.com (10.43.165.33) by EX13MTAUEA001.ant.amazon.com (10.43.61.243) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Thu, 8 Aug 2019 12:23:40 +0000 Received: from EX13MTAUEB001.ant.amazon.com (10.43.60.96) by EX13D03EUA001.ant.amazon.com (10.43.165.33) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Thu, 8 Aug 2019 12:23:40 +0000 Received: from dev-dsk-wipawel-1a-0c4e6d58.eu-west-1.amazon.com (10.4.134.33) by mail-relay.amazon.com (10.43.60.129) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Thu, 8 Aug 2019 12:23:38 +0000 From: Pawel Wieczorkiewicz To: Date: Thu, 8 Aug 2019 12:23:34 +0000 Message-ID: <20190808122334.6671-1-wipawel@amazon.de> X-Mailer: git-send-email 2.16.5 In-Reply-To: <20190416120716.26269-3-wipawel@amazon.de> References: <20190416120716.26269-3-wipawel@amazon.de> MIME-Version: 1.0 Precedence: Bulk Subject: [Xen-devel] [livepatch-build-tools part2 v2 3/6] create-diff-object: Add is_special_section() helper function function X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: mpohlack@amazon.de, ross.lagerwall@citrix.com, Pawel Wieczorkiewicz , konrad.wilk@oracle.com Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP This function determines, based on the given section name, if the sections belongs to the special sections category. Add more special sections to special_sections[] along with a new undefined_group_size() helper function returning 0 (undefined). New special sections are: .altinstr_replacement. Signed-off-by: Pawel Wieczorkiewicz Reviewed-by: Andra-Irina Paraschiv Reviewed-by: Bjoern Doebel Reviewed-by: Norbert Manthey Reviewed-by: Ross Lagerwall --- v2: * Applied suggestions from Ross: - const for the parameter - reusing special_sections array rather than duplicating it * moving the function from common.c to create-diff-object.c * strictly checking for full section names --- create-diff-object.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/create-diff-object.c b/create-diff-object.c index 4699ba0..0df3fea 100644 --- a/create-diff-object.c +++ b/create-diff-object.c @@ -1045,6 +1045,18 @@ static struct special_section special_sections[] = { {}, }; +static int is_special_section(const struct section *sec) +{ + struct special_section *special; + + for (special = special_sections; special->name; special++) { + if (!strcmp(sec->name, special->name)) + return true; + } + + return false; +} + static int should_keep_rela_group(struct section *sec, int start, int size) { struct rela *rela;