summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorPeter Zijlstra <peterz@infradead.org>2024-11-28 10:39:04 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-03-07 18:27:03 +0100
commitc304ca39e10c1b0c834d9b9ca0c7f33fd69cf8c5 (patch)
treef9de87e694464d9a12949c36bf049334344eef30 /tools
parent9d924a1d45ee487f1d0f98bdddc03ba79e1de893 (diff)
downloadlinux-c304ca39e10c1b0c834d9b9ca0c7f33fd69cf8c5.tar.gz
linux-c304ca39e10c1b0c834d9b9ca0c7f33fd69cf8c5.tar.bz2
linux-c304ca39e10c1b0c834d9b9ca0c7f33fd69cf8c5.zip
objtool: Remove annotate_{,un}reachable()
[ Upstream commit 06e24745985c8dd0da18337503afcf2f2fdbdff1 ] There are no users of annotate_reachable() left. And the annotate_unreachable() usage in unreachable() is plain wrong; it will hide dangerous fall-through code-gen. Remove both. Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Acked-by: Josh Poimboeuf <jpoimboe@kernel.org> Link: https://lore.kernel.org/r/20241128094312.235637588@infradead.org Stable-dep-of: 73cfc53cc3b6 ("objtool: Fix C jump table annotations for Clang") Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'tools')
-rw-r--r--tools/objtool/check.c43
1 files changed, 2 insertions, 41 deletions
diff --git a/tools/objtool/check.c b/tools/objtool/check.c
index e7ec29dfdff2..4d7d2c115cba 100644
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -639,47 +639,8 @@ static int add_dead_ends(struct objtool_file *file)
uint64_t offset;
/*
- * Check for manually annotated dead ends.
- */
- rsec = find_section_by_name(file->elf, ".rela.discard.unreachable");
- if (!rsec)
- goto reachable;
-
- for_each_reloc(rsec, reloc) {
- if (reloc->sym->type == STT_SECTION) {
- offset = reloc_addend(reloc);
- } else if (reloc->sym->local_label) {
- offset = reloc->sym->offset;
- } else {
- WARN("unexpected relocation symbol type in %s", rsec->name);
- return -1;
- }
-
- insn = find_insn(file, reloc->sym->sec, offset);
- if (insn)
- insn = prev_insn_same_sec(file, insn);
- else if (offset == reloc->sym->sec->sh.sh_size) {
- insn = find_last_insn(file, reloc->sym->sec);
- if (!insn) {
- WARN("can't find unreachable insn at %s+0x%" PRIx64,
- reloc->sym->sec->name, offset);
- return -1;
- }
- } else {
- WARN("can't find unreachable insn at %s+0x%" PRIx64,
- reloc->sym->sec->name, offset);
- return -1;
- }
-
- insn->dead_end = true;
- }
-
-reachable:
- /*
- * These manually annotated reachable checks are needed for GCC 4.4,
- * where the Linux unreachable() macro isn't supported. In that case
- * GCC doesn't know the "ud2" is fatal, so it generates code as if it's
- * not a dead end.
+ * UD2 defaults to being a dead-end, allow them to be annotated for
+ * non-fatal, eg WARN.
*/
rsec = find_section_by_name(file->elf, ".rela.discard.reachable");
if (!rsec)