From nobody Sat Jun 13 22:12:58 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 4EDBE480355; Tue, 5 May 2026 10:56:37 +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=1777978598; cv=none; b=PJ/7vW0vgvGKIQcSMAMOeXbHMurQcm0H64emkV4pCsYxU+evF377JsNyoVuRpV3GAv3Tq8OnIcVUXr47CNmMJS1ErXPSP7G+vzNp2wsE+vqDRXrr0eZCYr6Dwo6Njbb3H2cq+dZHpmcmBYQ/4EknrTfkQ3QVPZ1pRj/mlDc8h8U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777978598; c=relaxed/simple; bh=JApeYTfUaNx/Dcy1wg1GNQwyIY2W7elTazBNAa4BZLk=; h=Date:From:To:Subject:Cc:MIME-Version:Message-ID:Content-Type; b=VyhmeZY5Vw3m1uLxIYaXiqd9MUMT7luJD8ZYVvtTet9QRm/gkBmpmsTnVzmy0500e4nKhhR1QCUuRiSFABo7NOX+zyhvh1H2lFtWFayiacqi95cs7gzPZViXwpROo0rI4Hlnvtc1kkv9yAcPbHvHwFz7CvguOwUQ6v6v/FqnBXA= 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=elVa7i+h; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=sDlQ0DOU; 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="elVa7i+h"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="sDlQ0DOU" Date: Tue, 05 May 2026 10:56:34 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1777978595; 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=E439ne8mq3k1yUJOMORoUKrf8oiAY1kEQGjkCQOMx2U=; b=elVa7i+hanTbSuhSdu9comYOfmysf92eiIO99L6F14DOXw8ssdsLvOx/P0KziB2V2LRm1b OPwURrIwLoOSYSQ46O8fErqfM5HHEbYhJ0gJaZgUsIRuvgyvJit/ohEd1eqbnRsEH7H5fW SW57bEnLHzVulumQ3pawxWFs9uvf8eX+6jAQaR/bz12LsYsgUO1fRM4LTZbMhxzh3GuK6D tzmQGKJA/rfzjiHZbNQB1kEAoUaR4plgF6BKT6HSUoYNabRJsvlstSS4urTRolYfCid8eB 6lgv6UnSYHdeaCbzZVsvcNv+8Ak/EKVMy9RKFDCxXkQ0OaIfK/dThx7wDZ69vQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1777978595; 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=E439ne8mq3k1yUJOMORoUKrf8oiAY1kEQGjkCQOMx2U=; b=sDlQ0DOUKel4CZGImVJ1v8EKwhqWil32LyIWKCiXgaHqz6xYqCne4DNZ8f9OWKycdzhAcJ dKYXW9/p2DHTeUAg== 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: Move mark_rodata() to elf.c Cc: "Peter Zijlstra (Intel)" , Song Liu , Miroslav Benes , 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: <177797859463.424702.15341050872190740860.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: 3e01ab44af207a2d8c197653e7278083b039a274 Gitweb: https://git.kernel.org/tip/3e01ab44af207a2d8c197653e7278083b= 039a274 Author: Josh Poimboeuf AuthorDate: Sun, 12 Apr 2026 18:35:03 -07:00 Committer: Josh Poimboeuf CommitterDate: Mon, 04 May 2026 21:16:01 -07:00 objtool: Move mark_rodata() to elf.c Move the sec->rodata marking from check.c to elf.c so it's set during ELF reading rather than during the check pipeline. This makes the rodata flag available to all objtool users, including klp-diff which reads ELF files directly without running check(). Add an is_rodata_sec() helper to elf.h for consistency with is_text_sec() and is_string_sec(). Acked-by: Peter Zijlstra (Intel) Acked-by: Song Liu Reviewed-by: Miroslav Benes Signed-off-by: Josh Poimboeuf --- tools/objtool/check.c | 11 +++-------- tools/objtool/elf.c | 13 +++++++++++++ tools/objtool/include/objtool/elf.h | 5 +++++ 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/tools/objtool/check.c b/tools/objtool/check.c index e3604b1..e7579c4 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -2566,7 +2566,6 @@ static int classify_symbols(struct objtool_file *file) static void mark_rodata(struct objtool_file *file) { struct section *sec; - bool found =3D false; =20 /* * Search for the following rodata sections, each of which can @@ -2579,15 +2578,11 @@ static void mark_rodata(struct objtool_file *file) * .rodata.str1.* sections are ignored; they don't contain jump tables. */ for_each_sec(file->elf, sec) { - if ((!strncmp(sec->name, ".rodata", 7) && - !strstr(sec->name, ".str1.")) || - !strncmp(sec->name, ".data.rel.ro", 12)) { - sec->rodata =3D true; - found =3D true; + if (is_rodata_sec(sec)) { + file->rodata =3D true; + return; } } - - file->rodata =3D found; } =20 static void mark_holes(struct objtool_file *file) diff --git a/tools/objtool/elf.c b/tools/objtool/elf.c index dc39132..87c6e00 100644 --- a/tools/objtool/elf.c +++ b/tools/objtool/elf.c @@ -1138,6 +1138,17 @@ static int read_relocs(struct elf *elf) return 0; } =20 +static void mark_rodata(struct elf *elf) +{ + struct section *sec; + + for_each_sec(elf, sec) { + if ((strstarts(sec->name, ".rodata") && !strstr(sec->name, ".str1.")) || + strstarts(sec->name, ".data.rel.ro")) + sec->rodata =3D true; + } +} + struct elf *elf_open_read(const char *name, int flags) { struct elf *elf; @@ -1188,6 +1199,8 @@ struct elf *elf_open_read(const char *name, int flags) if (read_sections(elf)) goto err; =20 + mark_rodata(elf); + if (read_symbols(elf)) goto err; =20 diff --git a/tools/objtool/include/objtool/elf.h b/tools/objtool/include/ob= jtool/elf.h index 00b0402..ab5f701 100644 --- a/tools/objtool/include/objtool/elf.h +++ b/tools/objtool/include/objtool/elf.h @@ -317,6 +317,11 @@ static inline bool is_text_sec(struct section *sec) return sec->sh.sh_flags & SHF_EXECINSTR; } =20 +static inline bool is_rodata_sec(struct section *sec) +{ + return sec->rodata; +} + static inline bool sec_changed(struct section *sec) { return sec->_changed;