[PATCH 1/1] tools/objtools: tolerate mix of data in code section

From: Saeed Mirzamohammadi
Date: Fri Feb 09 2024 - 18:53:27 EST


Hand-written asm files might have data in the .text section and this
causes the objtools to not find the starting instruction. This avoids
this warning.

warning: objtool: n8_SafeDecrypt_RIJ128(): can't find starting instruction

Signed-off-by: Saeed Mirzamohammadi <saeed.mirzamohammadi@xxxxxxxxxx>
---
tools/objtool/check.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/tools/objtool/check.c b/tools/objtool/check.c
index e308d1ba664ef..9de4881f16984 100644
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -459,9 +459,11 @@ static int decode_instructions(struct objtool_file *file)
continue;

if (!find_insn(file, sec, func->offset)) {
- WARN("%s(): can't find starting instruction",
- func->name);
- return -1;
+ /*
+ * Can't find starting instruction likely due to data in
+ * beginning of the section
+ */
+ continue;
}

sym_for_each_insn(file, func, insn) {
--
2.42.0