From nobody Sat Jun 13 22:03:23 2026 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 187A7426ECB; Tue, 5 May 2026 10:56:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777978571; cv=none; b=OxHQtWRatI72HTolFx0jAZO2XPMspI4ewrzWEqhKLMtUZEIVMAb1x+JHZfKY4lHdu/hwpwcJ+ourDFGtwcTEzQ5zMwNGsFMHw3HC9VlQ1nVXaOS4ze9ezo4nRcZfibq6NWu/G1eUuHIvtcCsvQifdec8lsOhAXwgHZq1ROoO2UM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777978571; c=relaxed/simple; bh=C2M4lE5i2EYobMBytD6Sw1Ic4NCmMYTSvMmGUJyP4eI=; h=Date:From:To:Subject:Cc:MIME-Version:Message-ID:Content-Type; b=oKR6rHl+FO14tqjJUYCKl+OFRo5GBdQmjRvO9QDSvgFKtF0GTokSNFSkQjMUOtz741pA5OZTK+b/YcTGSr5SFU8rzDRw95aESsYNDxjX6TKJOj+By4ggLHku3WyY0wjoDnaKFU6uHPuFtz5jMMP1LwvnICHhbQ4kwrMQ7sb/yuQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=qKBwUGru; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=RQFVI3kK; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="qKBwUGru"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="RQFVI3kK" Date: Tue, 05 May 2026 10:56:07 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1777978568; h=from:from:sender:sender:reply-to: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; bh=s/GgJVHT5+CM64LqM2Aml2zcPVoSmOLVfSfzeBKl9+k=; b=qKBwUGrurIaP2jkq6ufEqC547aJUtNA0Up4qVAVknxBO8Ty4wEarN5sY2Usef7A+Bg/T5I c3Np3ar5honacpuN/cl5polrSEn+54AwKwSjn01i05QffMkKAuydxTQm8IXI2dEPdQxtXH KCHP/4MrhnpLQaaQNGo3bBAHHXN4bEjVTTrVhFscpG2J86IYUcmZwH3lY1ff/GxdZtQEEv 8joNA6fx/xrmwz3tWJyAZars1P3TBXhUJst7H7HhaZ0Vz7jwt16oqlBb7PNnwyEdlRcqmE L58g7Dvpy84EkINIKObywytYl8H1BD1wB8G7hJZl5DgQnlJIfUobaWWeiK/eEg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1777978568; h=from:from:sender:sender:reply-to: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; bh=s/GgJVHT5+CM64LqM2Aml2zcPVoSmOLVfSfzeBKl9+k=; b=RQFVI3kKIOndKg/p0aQk8mC4r3HpklqJG0whjR7jCkx5qQ8LHRMPk1mik+LHqJMVy2YUME KkgKeQ4+HIAbTABw== From: "tip-bot2 for Josh Poimboeuf" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: objtool/core] objtool: Consolidate file decoding into decode_file() Cc: "Peter Zijlstra (Intel)" , Song Liu , Josh Poimboeuf , x86@kernel.org, linux-kernel@vger.kernel.org Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <177797856712.424702.6736331648810394267.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable The following commit has been merged into the objtool/core branch of tip: Commit-ID: a5b6612332622d809e5c0a4f5637eef92dc06c06 Gitweb: https://git.kernel.org/tip/a5b6612332622d809e5c0a4f5637eef92= dc06c06 Author: Josh Poimboeuf AuthorDate: Fri, 03 Apr 2026 13:04:28 -07:00 Committer: Josh Poimboeuf CommitterDate: Mon, 04 May 2026 21:16:05 -07:00 objtool: Consolidate file decoding into decode_file() decode_sections() relies on CFI and cfi_hash initialization done separately in check(), making it unusable outside of check(). Consolidate the initialization into decode_sections() and rename it to decode_file(), and make it global along with free_insns() and insn_reloc() for use by other objtool components -- namely, the checksum code which will be moving to another file. Acked-by: Peter Zijlstra (Intel) Acked-by: Song Liu Signed-off-by: Josh Poimboeuf --- tools/objtool/check.c | 36 ++++++++++++-------------- tools/objtool/include/objtool/check.h | 5 ++++- 2 files changed, 22 insertions(+), 19 deletions(-) diff --git a/tools/objtool/check.c b/tools/objtool/check.c index f019e1f..49171dd 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -1346,7 +1346,7 @@ __weak bool arch_is_embedded_insn(struct symbol *sym) return false; } =20 -static struct reloc *insn_reloc(struct objtool_file *file, struct instruct= ion *insn) +struct reloc *insn_reloc(struct objtool_file *file, struct instruction *in= sn) { struct reloc *reloc; =20 @@ -2633,8 +2633,21 @@ static bool alts_needed(void) opts.checksum; } =20 -static int decode_sections(struct objtool_file *file) +int decode_file(struct objtool_file *file) { + arch_initial_func_cfi_state(&initial_func_cfi); + init_cfi_state(&init_cfi); + init_cfi_state(&func_cfi); + set_func_state(&func_cfi); + init_cfi_state(&force_undefined_cfi); + force_undefined_cfi.force_undefined =3D true; + + if (!cfi_hash_alloc(1UL << (file->elf->symbol_bits - 3))) + return -1; + + cfi_hash_add(&init_cfi); + cfi_hash_add(&func_cfi); + file->klp =3D is_livepatch_module(file); =20 mark_rodata(file); @@ -4998,7 +5011,7 @@ struct insn_chunk { * which can trigger more allocations for .debug_* sections whose data has= n't * been read yet. */ -static void free_insns(struct objtool_file *file) +void free_insns(struct objtool_file *file) { struct instruction *insn; struct insn_chunk *chunks =3D NULL, *chunk; @@ -5045,22 +5058,7 @@ int check(struct objtool_file *file) objtool_disas_ctx =3D disas_ctx; } =20 - arch_initial_func_cfi_state(&initial_func_cfi); - init_cfi_state(&init_cfi); - init_cfi_state(&func_cfi); - set_func_state(&func_cfi); - init_cfi_state(&force_undefined_cfi); - force_undefined_cfi.force_undefined =3D true; - - if (!cfi_hash_alloc(1UL << (file->elf->symbol_bits - 3))) { - ret =3D -1; - goto out; - } - - cfi_hash_add(&init_cfi); - cfi_hash_add(&func_cfi); - - ret =3D decode_sections(file); + ret =3D decode_file(file); if (ret) goto out; =20 diff --git a/tools/objtool/include/objtool/check.h b/tools/objtool/include/= objtool/check.h index 5f2f77b..6489e52 100644 --- a/tools/objtool/include/objtool/check.h +++ b/tools/objtool/include/objtool/check.h @@ -155,6 +155,11 @@ struct instruction *next_insn_same_sec(struct objtool_= file *file, struct instruc insn && insn->offset < sym->offset + sym->len; \ insn =3D next_insn_same_sec(file, insn)) =20 +struct reloc *insn_reloc(struct objtool_file *file, struct instruction *in= sn); + +int decode_file(struct objtool_file *file); +void free_insns(struct objtool_file *file); + const char *objtool_disas_insn(struct instruction *insn); =20 extern size_t sym_name_max_len;