[RFC 25/31] objtool: Fix interval tree insertion for zero-length symbols
From: Josh Poimboeuf
Date: Tue Sep 03 2024 - 00:05:08 EST
Zero-length symbols get inserted in the wrong spot. Fix that.
Signed-off-by: Josh Poimboeuf <jpoimboe@xxxxxxxxxx>
---
tools/objtool/elf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/objtool/elf.c b/tools/objtool/elf.c
index 49528e7835aa..42a657268306 100644
--- a/tools/objtool/elf.c
+++ b/tools/objtool/elf.c
@@ -94,7 +94,7 @@ static inline unsigned long __sym_start(struct symbol *s)
static inline unsigned long __sym_last(struct symbol *s)
{
- return s->offset + s->len - 1;
+ return s->offset + (s->len ? s->len - 1 : 0);
}
INTERVAL_TREE_DEFINE(struct symbol, node, unsigned long, __subtree_last,
--
2.45.2