From patchwork Sat Sep 7 08:53:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 13795165 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E4A361BC23; Sat, 7 Sep 2024 08:53:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725699214; cv=none; b=AcHHzMokWmuNGQmr1q6T7KaUZvm/Z9rWobsaEi2VknvxT9QALvA3z6QDIkPoIlac9xmgWJJC9DC/kkHJTBJEZRqUHsR6WlKmBaqvh1YTOdz3Dm5sIxfWOW74iK3EqmXncR4S4S47KiFoPs/EklsKKFxJE2ntue6IK/RDAyssHrg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725699214; c=relaxed/simple; bh=/DNGuzdxEIN4OIYC8u0bRlwlNUKKmsWXBrkwNV4Ey24=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=Zi+eiVa9fbDe4qJ2G7DMaaozGSgOUrlGXWQ3PRkrbcaH8fZl2F885LZbFYGyN0/59MKCP6nl3sYLzZ0Sdh2fDOuvQzsPy4BI7JnfhGqn8XD74UUHCVLqp6GBhyC1kZ4QvVAcivaIMqF4kXBxzjMRhctsjWhu8pg6gJNv9+Ldjlg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=PZP2qio4; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="PZP2qio4" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9ADDAC4CEC2; Sat, 7 Sep 2024 08:53:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1725699213; bh=/DNGuzdxEIN4OIYC8u0bRlwlNUKKmsWXBrkwNV4Ey24=; h=From:To:Cc:Subject:Date:From; b=PZP2qio4ID3wtcyixkHzrUfW00t2Wak1lPVcAiDM8QWp+G0hOiP8wndu57N+xb8+C Uom777Kz4D7Vi1MQPIIwh/UlQBfo5xyVFyUDseXCE1Lt2lgjPHbXDiNGsA5mlpCWQs Z4mUl7MNVk7rw4RfukbhHt6Fj/8u/UKh0Ui+e9cWkUQ1cogOrue7hqKsdA1NDMXQgH f0mMhnoI2MrPXnR6kN8Nyo2/NLLKHc3kWelmoEbANX1vlQeJZn4nfTNcJ11qdGDxs0 Obt1/tH4nOuhW5sAfwRBj51RMvJsoU3XSJKb6ek6vxSS0VT05jfx5S87u1EylFbApE 02wxyndPgBqsA== From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Masahiro Yamada Subject: [PATCH 1/2] kallsyms: squash output_address() Date: Sat, 7 Sep 2024 17:53:22 +0900 Message-ID: <20240907085328.1374086-1-masahiroy@kernel.org> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kbuild@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 After commit 64e166099b69 ("kallsyms: get rid of code for absolute, kallsyms"), there is only one call site for output_address(). Squash it. Signed-off-by: Masahiro Yamada --- scripts/kallsyms.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c index c70458e68ece..f6bb7fb2536b 100644 --- a/scripts/kallsyms.c +++ b/scripts/kallsyms.c @@ -292,15 +292,6 @@ static void output_label(const char *label) printf("%s:\n", label); } -/* Provide proper symbols relocatability by their '_text' relativeness. */ -static void output_address(unsigned long long addr) -{ - if (_text <= addr) - printf("\tPTR\t_text + %#llx\n", addr - _text); - else - printf("\tPTR\t_text - %#llx\n", _text - addr); -} - /* uncompress a compressed symbol. When this function is called, the best table * might still be compressed itself, so the function needs to be recursive */ static int expand_symbol(const unsigned char *data, int len, char *result) @@ -488,7 +479,11 @@ static void write_src(void) printf("\n"); output_label("kallsyms_relative_base"); - output_address(relative_base); + /* Provide proper symbols relocatability by their '_text' relativeness. */ + if (_text <= relative_base) + printf("\tPTR\t_text + %#llx\n", relative_base - _text); + else + printf("\tPTR\t_text - %#llx\n", _text - relative_base); printf("\n"); sort_symbols_by_name(); From patchwork Sat Sep 7 08:53:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 13795166 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6AFD71547F5; Sat, 7 Sep 2024 08:53:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725699215; cv=none; b=deMNxlfrkZ/Gqqs3N5d7OIJjJBIoPX04c36uxkStetbbNmD4FmTa+reBFLF2kFhQVlWcLNOMc3F3JL166/0S9HjZeD1RIIYu6CUgZjZwIEKp5CLWVBvA0j3CdaYxobE+EKyuIMDiceUEZG+0i7y2QfKnzGYiLpHOQBaY8N1HPVI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725699215; c=relaxed/simple; bh=s+4kwcMdfrz+gOW0SVoEv7g6su2b8HF4jqTIvhtCsnA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gtEWDr9aKGBo4FsAc/2cXhovCvUoE82ZRmUt7wvctAfHJsFRE5Ol5m28D6tYdZOBhwVU9oFZ9USQn1NszxjTZFtOVP9zkzjlHVVliNurX2VBUnYCP1TDjEkSf5o2KQSyqv6B0o9zTsqQLhrxxaQf+gcXrvksE0N08NsZsMT28+c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=KrrVVKPa; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="KrrVVKPa" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 04B55C4CEC8; Sat, 7 Sep 2024 08:53:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1725699214; bh=s+4kwcMdfrz+gOW0SVoEv7g6su2b8HF4jqTIvhtCsnA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KrrVVKPa5ljLuQPSiTXajE+Dqd8mNfnHPJqVlhoLIyAkXtx1nKg4gTv565jJcCOlF 8RElTVGepJ0PZgnuy1DiCL8DnyBStUMnTiXFBmeeqhHJ5JZgNtdZqJUls6JxWXcNmv vDTW6uQj4cYQTWWZe5ifAF6nBGrUxdMugegS1JPaURZElf1WhPKczei9d3lC2QUwyG Lm9yjoKsnJqFXSTgahXZDK6VYrnbIWECJsyYgtFTFO+i45UaCA0Z0R8WjewSNMrTCX 8dYfH1SLm3owd4ZyCdX8q8nJtmJYJzWZHUGKs9o05XDfLp4Di1yEaggK5vXoLcj1HR EEjipxYN/0XfQ== From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Masahiro Yamada Subject: [PATCH 2/2] kallsyms: change overflow variable to bool type Date: Sat, 7 Sep 2024 17:53:23 +0900 Message-ID: <20240907085328.1374086-2-masahiroy@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240907085328.1374086-1-masahiroy@kernel.org> References: <20240907085328.1374086-1-masahiroy@kernel.org> Precedence: bulk X-Mailing-List: linux-kbuild@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Change the 'overflow' variable to bool. Also, remove unnecessary parentheses. Signed-off-by: Masahiro Yamada --- scripts/kallsyms.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c index f6bb7fb2536b..03852da3d249 100644 --- a/scripts/kallsyms.c +++ b/scripts/kallsyms.c @@ -455,17 +455,17 @@ static void write_src(void) */ long long offset; - int overflow; + bool overflow; if (!absolute_percpu) { offset = table[i]->addr - relative_base; - overflow = (offset < 0 || offset > UINT_MAX); + overflow = offset < 0 || offset > UINT_MAX; } else if (symbol_absolute(table[i])) { offset = table[i]->addr; - overflow = (offset < 0 || offset > INT_MAX); + overflow = offset < 0 || offset > INT_MAX; } else { offset = relative_base - table[i]->addr - 1; - overflow = (offset < INT_MIN || offset >= 0); + overflow = offset < INT_MIN || offset >= 0; } if (overflow) { fprintf(stderr, "kallsyms failure: "