Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1648031ybt; Thu, 18 Jun 2020 13:49:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzypWhW220TzBlcJn5pkVDC6NBeUCKMK8kQe2Szh8pGfDQA4vFjIM2SpaZH7//E0Dpuj5is X-Received: by 2002:a17:907:369:: with SMTP id rs9mr499101ejb.187.1592513364020; Thu, 18 Jun 2020 13:49:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592513364; cv=none; d=google.com; s=arc-20160816; b=vNMizrrR1s26/55WbHZ5I9+GlYcsu5LROfHjIbjXIMhVFnB62z7fGdRjqbI58WkZI5 NQeHMYsJ4K8AMNv4AyosiYMQO6vwihwrXHQAVT/TtIFNJrybGTllAWwr0R3+4ansQ8vc mYZuf2NjZenLKp1NSg8SGSrxrvkKNfDAi8NQIh/NsQs0vyctXkC5yc1zA8GyxoMAUxkH jQaEzxRFR/cm7qTEPJtxwjZHsJM1AeUbgPgeHi30SLwnrJhSC1cybr5zgDCCxmj53h6h W/2bMEVM7rNoYthzRjbH5oay45OW8chvXKFtJrouUpwwwohDcNfjKCcMBTeGMSXkOtgU s0iA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=nS+NUWPcgO9Rcf/yf8yM26hq1D4XBpdoNTSt+lxV/5s=; b=l8GLFzRsuSPnQWWOvRCsBIq2Xu4ofLSRUyn1IuwCW4/C2wt06wWe7V/ILJK6FaWvBc fKL8/NWK0QVNqy2907usZnvLcawriaekjVGG70qWbUcaDEquM1DMfQX6Dnxn/nTVd92u 54BYiYKNoo6oZsrvZl4l3XBOeCVhnNZpSGuucX1sbOTLAO+drlfDAj9TSzfB/7HVXv2O KboPmYtwgvxEbm1CdhX5FnI3+yB94ct7mqODfTJhPZ5NgbYiqkOyDPQoCvLlFkG6Dx6j EcaHISYuYW9q0NvOHw/unJAeFNPBCXmnBWimKQt5fJhYuD30PVDXca15U99z9QVUj4pb DiPw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=vmware.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b10si2433574edw.184.2020.06.18.13.49.02; Thu, 18 Jun 2020 13:49:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=vmware.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732249AbgFRUko (ORCPT + 99 others); Thu, 18 Jun 2020 16:40:44 -0400 Received: from ex13-edg-ou-002.vmware.com ([208.91.0.190]:36734 "EHLO EX13-EDG-OU-002.vmware.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731419AbgFRUji (ORCPT ); Thu, 18 Jun 2020 16:39:38 -0400 Received: from sc9-mailhost2.vmware.com (10.113.161.72) by EX13-EDG-OU-002.vmware.com (10.113.208.156) with Microsoft SMTP Server id 15.0.1156.6; Thu, 18 Jun 2020 13:39:30 -0700 Received: from sc9-mailhost2.vmware.com (unknown [10.129.221.29]) by sc9-mailhost2.vmware.com (Postfix) with ESMTP id 22B7DB265A; Thu, 18 Jun 2020 16:39:32 -0400 (EDT) From: Matt Helsley To: CC: Josh Poimboeuf , Peter Zijlstra , Steven Rostedt , Julien Thierry , Kamalesh Babulal , Matt Helsley Subject: [RFC][PATCH v5 40/51] objtool: mcount: const-ify ARM instruction patterns Date: Thu, 18 Jun 2020 13:38:26 -0700 Message-ID: <97ecc9cc1a72e638ce9f370102777944a07a1037.1592510545.git.mhelsley@vmware.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII Received-SPF: None (EX13-EDG-OU-002.vmware.com: mhelsley@vmware.com does not designate permitted sender hosts) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Let the compiler know we won't be modifying the instruction patterns we use to determine how to turn ARM instruction(s) into nops, and the nop instruction(s) we'll put in their place. Also, while we're at it, convert to unsigned char because the next patch will need that as well. Signed-off-by: Matt Helsley --- tools/objtool/mcount.c | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/tools/objtool/mcount.c b/tools/objtool/mcount.c index 5c59df0df97b..629eb7222ef3 100644 --- a/tools/objtool/mcount.c +++ b/tools/objtool/mcount.c @@ -47,10 +47,10 @@ extern int warn_on_notrace_sect; /* warn when section has mcount not being recor static struct elf *lf; -static const unsigned char ip_relative_call_x86[5] = { 0xe8, 0x00, 0x00, 0x00, 0x00 }; -static const unsigned char ideal_nop5_x86_64[5] = { 0x0f, 0x1f, 0x44, 0x00, 0x00 }; -static const unsigned char ideal_nop5_x86_32[5] = { 0x3e, 0x8d, 0x74, 0x26, 0x00 }; -static const unsigned char *ideal_nop; +static const char ip_relative_call_x86[5] = { 0xe8, 0x00, 0x00, 0x00, 0x00 }; +static const char ideal_nop5_x86_64[5] = { 0x0f, 0x1f, 0x44, 0x00, 0x00 }; +static const char ideal_nop5_x86_32[5] = { 0x3e, 0x8d, 0x74, 0x26, 0x00 }; +static const char *ideal_nop; static char rel_type_nop; @@ -58,7 +58,7 @@ static int (*make_nop)(struct section *, size_t const offset); static int make_nop_x86(struct section *txts, size_t const offset) { - unsigned char *op = txts->data->d_buf + offset - 1; + char *op = txts->data->d_buf + offset - 1; if (offset < 1) return -1; @@ -71,25 +71,25 @@ static int make_nop_x86(struct section *txts, size_t const offset) return 0; } -static unsigned char ideal_nop4_arm_le[4] = { 0x00, 0x00, 0xa0, 0xe1 }; /* mov r0, r0 */ -static unsigned char ideal_nop4_arm_be[4] = { 0xe1, 0xa0, 0x00, 0x00 }; /* mov r0, r0 */ -static unsigned char *ideal_nop4_arm; +static const char ideal_nop4_arm_le[4] = { 0x00, 0x00, 0xa0, 0xe1 }; /* mov r0, r0 */ +static const char ideal_nop4_arm_be[4] = { 0xe1, 0xa0, 0x00, 0x00 }; /* mov r0, r0 */ +static const char *ideal_nop4_arm; -static unsigned char bl_mcount_arm_le[4] = { 0xfe, 0xff, 0xff, 0xeb }; /* bl */ -static unsigned char bl_mcount_arm_be[4] = { 0xeb, 0xff, 0xff, 0xfe }; /* bl */ -static unsigned char *bl_mcount_arm; +static const char bl_mcount_arm_le[4] = { 0xfe, 0xff, 0xff, 0xeb }; /* bl */ +static const char bl_mcount_arm_be[4] = { 0xeb, 0xff, 0xff, 0xfe }; /* bl */ +static const char *bl_mcount_arm; -static unsigned char push_arm_le[4] = { 0x04, 0xe0, 0x2d, 0xe5 }; /* push {lr} */ -static unsigned char push_arm_be[4] = { 0xe5, 0x2d, 0xe0, 0x04 }; /* push {lr} */ -static unsigned char *push_arm; +static const char push_arm_le[4] = { 0x04, 0xe0, 0x2d, 0xe5 }; /* push {lr} */ +static const char push_arm_be[4] = { 0xe5, 0x2d, 0xe0, 0x04 }; /* push {lr} */ +static const char *push_arm; -static unsigned char ideal_nop2_thumb_le[2] = { 0x00, 0xbf }; /* nop */ -static unsigned char ideal_nop2_thumb_be[2] = { 0xbf, 0x00 }; /* nop */ -static unsigned char *ideal_nop2_thumb; +static const char ideal_nop2_thumb_le[2] = { 0x00, 0xbf }; /* nop */ +static const char ideal_nop2_thumb_be[2] = { 0xbf, 0x00 }; /* nop */ +static const char *ideal_nop2_thumb; -static unsigned char push_bl_mcount_thumb_le[6] = { 0x00, 0xb5, 0xff, 0xf7, 0xfe, 0xff }; /* push {lr}, bl */ -static unsigned char push_bl_mcount_thumb_be[6] = { 0xb5, 0x00, 0xf7, 0xff, 0xff, 0xfe }; /* push {lr}, bl */ -static unsigned char *push_bl_mcount_thumb; +static const char push_bl_mcount_thumb_le[6] = { 0x00, 0xb5, 0xff, 0xf7, 0xfe, 0xff }; /* push {lr}, bl */ +static const char push_bl_mcount_thumb_be[6] = { 0xb5, 0x00, 0xf7, 0xff, 0xff, 0xfe }; /* push {lr}, bl */ +static const char *push_bl_mcount_thumb; static int make_nop_arm(struct section *txts, size_t const offset) { @@ -124,7 +124,7 @@ static int make_nop_arm(struct section *txts, size_t const offset) return 0; } -static unsigned char ideal_nop4_arm64[4] = {0x1f, 0x20, 0x03, 0xd5}; +static const char ideal_nop4_arm64[4] = {0x1f, 0x20, 0x03, 0xd5}; static int make_nop_arm64(struct section *txts, size_t const offset) { uint32_t *ptr; -- 2.20.1