From: "tip-bot2 for Josh Poimboeuf" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: Randy Dunlap <rdunlap@infradead.org>,
Josh Poimboeuf <jpoimboe@kernel.org>,
Ingo Molnar <mingo@kernel.org>,
Linus Torvalds <torvalds@linux-foundation.org>,
x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [tip: objtool/urgent] objtool: Ignore end-of-section jumps for KCOV/GCOV
Date: Tue, 01 Apr 2025 07:15:21 -0000 [thread overview]
Message-ID: <174349172118.14745.4583453326563185652.tip-bot2@tip-bot2> (raw)
In-Reply-To: <08fbe7d7e1e20612206f1df253077b94f178d93e.1743481539.git.jpoimboe@kernel.org>
The following commit has been merged into the objtool/urgent branch of tip:
Commit-ID: 0d7597749f5a3ac67851d3836635d084df15fb66
Gitweb: https://git.kernel.org/tip/0d7597749f5a3ac67851d3836635d084df15fb66
Author: Josh Poimboeuf <jpoimboe@kernel.org>
AuthorDate: Mon, 31 Mar 2025 21:26:37 -07:00
Committer: Ingo Molnar <mingo@kernel.org>
CommitterDate: Tue, 01 Apr 2025 09:07:12 +02:00
objtool: Ignore end-of-section jumps for KCOV/GCOV
When KCOV or GCOV is enabled, dead code can be left behind, in which
case objtool silences unreachable and undefined behavior (fallthrough)
warnings.
Fallthrough warnings, and their variant "end of section" warnings, were
silenced with the following commit:
6b023c784204 ("objtool: Silence more KCOV warnings")
Another variant of a fallthrough warning is a jump to the end of a
function. If that function happens to be at the end of a section, the
jump destination doesn't actually exist.
Normally that would be a fatal objtool error, but for KCOV/GCOV it's
just another undefined behavior fallthrough. Silence it like the
others.
Fixes the following warning:
drivers/iommu/dma-iommu.o: warning: objtool: iommu_dma_sw_msi+0x92: can't find jump dest instruction at .text+0x54d5
Fixes: 6b023c784204 ("objtool: Silence more KCOV warnings")
Reported-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Link: https://lore.kernel.org/r/08fbe7d7e1e20612206f1df253077b94f178d93e.1743481539.git.jpoimboe@kernel.org
Closes: https://lore.kernel.org/314f8809-cd59-479b-97d7-49356bf1c8d1@infradead.org/
---
tools/objtool/check.c | 22 ++++++++++++++++------
1 file changed, 16 insertions(+), 6 deletions(-)
diff --git a/tools/objtool/check.c b/tools/objtool/check.c
index fff9d7a..e6c4eef 100644
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -1488,6 +1488,8 @@ static int add_jump_destinations(struct objtool_file *file)
int ret;
for_each_insn(file, insn) {
+ struct symbol *func = insn_func(insn);
+
if (insn->jump_dest) {
/*
* handle_group_alt() may have previously set
@@ -1513,7 +1515,7 @@ static int add_jump_destinations(struct objtool_file *file)
} else if (reloc->sym->return_thunk) {
add_return_call(file, insn, true);
continue;
- } else if (insn_func(insn)) {
+ } else if (func) {
/*
* External sibling call or internal sibling call with
* STT_FUNC reloc.
@@ -1548,6 +1550,15 @@ static int add_jump_destinations(struct objtool_file *file)
continue;
}
+ /*
+ * GCOV/KCOV dead code can jump to the end of the
+ * function/section.
+ */
+ if (file->ignore_unreachables && func &&
+ dest_sec == insn->sec &&
+ dest_off == func->offset + func->len)
+ continue;
+
WARN_INSN(insn, "can't find jump dest instruction at %s+0x%lx",
dest_sec->name, dest_off);
return -1;
@@ -1574,8 +1585,7 @@ static int add_jump_destinations(struct objtool_file *file)
/*
* Cross-function jump.
*/
- if (insn_func(insn) && insn_func(jump_dest) &&
- insn_func(insn) != insn_func(jump_dest)) {
+ if (func && insn_func(jump_dest) && func != insn_func(jump_dest)) {
/*
* For GCC 8+, create parent/child links for any cold
@@ -1592,10 +1602,10 @@ static int add_jump_destinations(struct objtool_file *file)
* case where the parent function's only reference to a
* subfunction is through a jump table.
*/
- if (!strstr(insn_func(insn)->name, ".cold") &&
+ if (!strstr(func->name, ".cold") &&
strstr(insn_func(jump_dest)->name, ".cold")) {
- insn_func(insn)->cfunc = insn_func(jump_dest);
- insn_func(jump_dest)->pfunc = insn_func(insn);
+ func->cfunc = insn_func(jump_dest);
+ insn_func(jump_dest)->pfunc = func;
}
}
next prev parent reply other threads:[~2025-04-01 7:15 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-01 4:26 [PATCH 00/11] Yet more objtool fixes Josh Poimboeuf
2025-04-01 4:26 ` [PATCH 01/11] objtool: Silence more KCOV warnings, part 2 Josh Poimboeuf
2025-04-01 7:15 ` [tip: objtool/urgent] " tip-bot2 for Josh Poimboeuf
2025-04-01 4:26 ` [PATCH 02/11] objtool: Ignore end-of-section jumps for KCOV/GCOV Josh Poimboeuf
2025-04-01 7:15 ` tip-bot2 for Josh Poimboeuf [this message]
2025-04-01 4:26 ` [PATCH 03/11] objtool: Append "()" to function name in "unexpected end of section" warning Josh Poimboeuf
2025-04-01 7:15 ` [tip: objtool/urgent] " tip-bot2 for Josh Poimboeuf
2025-04-01 4:26 ` [PATCH 04/11] Revert "objtool: Increase per-function WARN_FUNC() rate limit" Josh Poimboeuf
2025-04-01 7:15 ` [tip: objtool/urgent] " tip-bot2 for Josh Poimboeuf
2025-04-01 4:26 ` [PATCH 05/11] objtool: Always fail on fatal errors Josh Poimboeuf
2025-04-01 7:15 ` [tip: objtool/urgent] " tip-bot2 for Josh Poimboeuf
2025-04-01 4:26 ` [PATCH 06/11] objtool: Change "warning:" to "error:" for " Josh Poimboeuf
2025-04-01 7:15 ` [tip: objtool/urgent] objtool: Change "warning:" to "error: " " tip-bot2 for Josh Poimboeuf
2025-04-01 4:26 ` [PATCH 07/11] objtool: Fix verbose disassembly if CROSS_COMPILE isn't set Josh Poimboeuf
2025-04-01 7:15 ` [tip: objtool/urgent] " tip-bot2 for David Laight
2025-04-01 4:26 ` [PATCH 08/11] objtool/loongarch: Add unwind hints in prepare_frametrace() Josh Poimboeuf
2025-04-01 7:08 ` Ingo Molnar
2025-04-01 7:45 ` Tiezhu Yang
2025-04-01 8:10 ` Ingo Molnar
2025-04-01 8:29 ` Tiezhu Yang
2025-04-01 8:17 ` [tip: objtool/urgent] " tip-bot2 for Josh Poimboeuf
2025-04-01 4:26 ` [PATCH 09/11] sched/smt: Always inline sched_smt_active() Josh Poimboeuf
2025-04-01 7:15 ` [tip: objtool/urgent] " tip-bot2 for Josh Poimboeuf
2025-04-01 4:26 ` [PATCH 10/11] context_tracking: Always inline ct_{nmi,irq}_{enter,exit}() Josh Poimboeuf
2025-04-01 7:15 ` [tip: objtool/urgent] " tip-bot2 for Josh Poimboeuf
2025-04-01 7:26 ` tip-bot2 for Josh Poimboeuf
2025-04-01 4:26 ` [PATCH 11/11] rcu-tasks: Always inline rcu_irq_work_resched() Josh Poimboeuf
2025-04-01 7:14 ` [tip: objtool/urgent] " tip-bot2 for Josh Poimboeuf
2025-04-01 7:26 ` tip-bot2 for Josh Poimboeuf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=174349172118.14745.4583453326563185652.tip-bot2@tip-bot2 \
--to=tip-bot2@linutronix.de \
--cc=jpoimboe@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=rdunlap@infradead.org \
--cc=torvalds@linux-foundation.org \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®