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

Message ID 20240209235231.889839-2-saeed.mirzamohammadi@oracle.com
State New
Headers
Series tools/objtools: tolerate mix of data in code section |

Commit Message

Saeed Mirzamohammadi Feb. 9, 2024, 11:52 p.m. UTC
  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@oracle.com>
---
 tools/objtool/check.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
  

Patch

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) {