[PATCH 14/22] objtool: Warn on zero-length functions

From: Josh Poimboeuf
Date: Sun Jul 14 2019 - 20:38:23 EST


All callable functions should have an ELF size.

Signed-off-by: Josh Poimboeuf <jpoimboe@xxxxxxxxxx>
---
tools/objtool/check.c | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/tools/objtool/check.c b/tools/objtool/check.c
index 9bf4844d9226..16454cbca679 100644
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -2357,6 +2357,12 @@ static int validate_functions(struct objtool_file *file)
if (func->type != STT_FUNC)
continue;

+ if (!func->len) {
+ WARN("%s() is missing an ELF size annotation",
+ func->name);
+ warnings++;
+ }
+
if (func->pfunc != func || func->alias != func)
continue;

--
2.20.1