From nobody Mon Feb 9 09:34:07 2026 Received: from out198-19.us.a.mail.aliyun.com (out198-19.us.a.mail.aliyun.com [47.90.198.19]) (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 4FBF933970F for ; Mon, 26 Jan 2026 13:35:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=47.90.198.19 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769434544; cv=none; b=l8aMHf3czXfZOlamsFHD/wiayAp0ljD4hbPD07CK5hBgfmoswLYDqZ5d3R4s2wlTq1eNV19a8bxfGsKMRLsxYlxXj2bH5jhMgir0SxH3iOWwVKbgvDQQXwVIUi0B952DgC/2C7DJc1DwtgXTNYcuBWGhABWFSKDNgmbPiw85Nf8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769434544; c=relaxed/simple; bh=b+uDgD8XOMRLrEG7SadJgZY2gBH3dzW52pIhkArgozU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=f6JNPAflj0g9/5eon3B6dkunukWLwMnUpAxGk0HvfOG5THfulH2/YBZygduWUvpiITUfjOebrbGhdFpAzNvzfEVV4vryNsxHu4ImVMd3K83GEe7QRRLrXLpE1RyfxThDsBVuUOY5VPjq7Nvp1ZUf+Pi+a2+EB41eUKjrrTcJYH4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=antgroup.com; spf=pass smtp.mailfrom=antgroup.com; dkim=pass (1024-bit key) header.d=antgroup.com header.i=@antgroup.com header.b=YNy/C9df; arc=none smtp.client-ip=47.90.198.19 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=antgroup.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=antgroup.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=antgroup.com header.i=@antgroup.com header.b="YNy/C9df" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=antgroup.com; s=default; t=1769434525; h=From:To:Subject:Date:Message-Id:MIME-Version; bh=du9Zf8HObLpUkXiHCA2fdY4IhNvUREwnWUYyYyspdzg=; b=YNy/C9dfOAbwjX00cJmyqV0AzM9I/GviKETYN2jXWDTnzdWWLhWhLVQ9WUufl2F9wzTj3BdKb2LRq0sZgyucnTbGxOkdzrJKuLdvmjc1pw6gQSzIqZ0rH0N+0/0mbRa4ro2OohYAP0yBQbD0faVn5bCoQEbPnm1rZMpgVRDD5tU= Received: from localhost(mailfrom:houwenlong.hwl@antgroup.com fp:SMTPD_---.gGArkxM_1769434524 cluster:ay29) by smtp.aliyun-inc.com; Mon, 26 Jan 2026 21:35:25 +0800 From: Hou Wenlong To: linux-kernel@vger.kernel.org Cc: Lai Jiangshan , Hou Wenlong , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Ard Biesheuvel , Brian Gerst , Uros Bizjak Subject: [RFC PATCH 1/5] x86/relocs: Cleanup cmdline options Date: Mon, 26 Jan 2026 21:33:51 +0800 Message-Id: X-Mailer: git-send-email 2.31.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Move all cmdline options to global variables to make code cleaner and to facilitate the addition of new cmdline options. Signed-off-by: Hou Wenlong --- arch/x86/tools/relocs.c | 12 +++++------- arch/x86/tools/relocs.h | 14 ++++++++------ arch/x86/tools/relocs_common.c | 13 +++++-------- 3 files changed, 18 insertions(+), 21 deletions(-) diff --git a/arch/x86/tools/relocs.c b/arch/x86/tools/relocs.c index e5a2b9a912d1..945d78c368f7 100644 --- a/arch/x86/tools/relocs.c +++ b/arch/x86/tools/relocs.c @@ -127,7 +127,7 @@ static int is_reloc(enum symtype type, const char *sym_= name) return sym_regex[type] && !regexec(&sym_regex_c[type], sym_name, 0, NULL,= 0); } =20 -static void regex_init(int use_real_mode) +static void regex_init(void) { char errbuf[128]; int err; @@ -950,7 +950,7 @@ static int write32_as_text(uint32_t v, FILE *f) return fprintf(f, "\t.long 0x%08"PRIx32"\n", v) > 0 ? 0 : -1; } =20 -static void emit_relocs(int as_text, int use_real_mode) +static void emit_relocs(void) { int i; int (*write_reloc)(uint32_t, FILE *) =3D write32; @@ -1049,11 +1049,9 @@ static void print_reloc_info(void) # define process process_32 #endif =20 -void process(FILE *fp, int use_real_mode, int as_text, - int show_absolute_syms, int show_absolute_relocs, - int show_reloc_info) +void process(FILE *fp) { - regex_init(use_real_mode); + regex_init(); read_ehdr(fp); read_shdrs(fp); read_strtabs(fp); @@ -1075,5 +1073,5 @@ void process(FILE *fp, int use_real_mode, int as_text, return; } =20 - emit_relocs(as_text, use_real_mode); + emit_relocs(); } diff --git a/arch/x86/tools/relocs.h b/arch/x86/tools/relocs.h index 4c49c82446eb..5ade07ac2754 100644 --- a/arch/x86/tools/relocs.h +++ b/arch/x86/tools/relocs.h @@ -30,10 +30,12 @@ enum symtype { S_NSYMTYPES }; =20 -void process_32(FILE *fp, int use_real_mode, int as_text, - int show_absolute_syms, int show_absolute_relocs, - int show_reloc_info); -void process_64(FILE *fp, int use_real_mode, int as_text, - int show_absolute_syms, int show_absolute_relocs, - int show_reloc_info); +extern int show_absolute_syms; +extern int show_absolute_relocs; +extern int show_reloc_info; +extern int as_text; +extern int use_real_mode; + +void process_32(FILE *fp); +void process_64(FILE *fp); #endif /* RELOCS_H */ diff --git a/arch/x86/tools/relocs_common.c b/arch/x86/tools/relocs_common.c index 6634352a20bc..ee8a9fafcb11 100644 --- a/arch/x86/tools/relocs_common.c +++ b/arch/x86/tools/relocs_common.c @@ -1,6 +1,9 @@ // SPDX-License-Identifier: GPL-2.0 #include "relocs.h" =20 +int show_absolute_syms, show_absolute_relocs, show_reloc_info; +int as_text, use_real_mode; + void die(char *fmt, ...) { va_list ap; @@ -18,8 +21,6 @@ static void usage(void) =20 int main(int argc, char **argv) { - int show_absolute_syms, show_absolute_relocs, show_reloc_info; - int as_text, use_real_mode; const char *fname; FILE *fp; int i; @@ -73,13 +74,9 @@ int main(int argc, char **argv) } rewind(fp); if (e_ident[EI_CLASS] =3D=3D ELFCLASS64) - process_64(fp, use_real_mode, as_text, - show_absolute_syms, show_absolute_relocs, - show_reloc_info); + process_64(fp); else - process_32(fp, use_real_mode, as_text, - show_absolute_syms, show_absolute_relocs, - show_reloc_info); + process_32(fp); fclose(fp); return 0; } --=20 2.31.1