objtool: Avoid iterating !text section symbols
authorPeter Zijlstra <peterz@infradead.org>
Mon, 23 Mar 2020 20:11:14 +0000 (21:11 +0100)
committerIngo Molnar <mingo@kernel.org>
Wed, 22 Apr 2020 08:53:51 +0000 (10:53 +0200)
validate_functions() iterates all sections their symbols; this is
pointless to do for !text sections as they won't have instructions
anyway.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Miroslav Benes <mbenes@suse.cz>
Reviewed-by: Alexandre Chartre <alexandre.chartre@oracle.com>
Acked-by: Josh Poimboeuf <jpoimboe@redhat.com>
Link: https://lkml.kernel.org/r/20200416115119.346582716@infradead.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
tools/objtool/check.c

index 923652b..e201aa1 100644 (file)
@@ -2551,8 +2551,12 @@ static int validate_functions(struct objtool_file *file)
        struct section *sec;
        int warnings = 0;
 
-       for_each_sec(file, sec)
+       for_each_sec(file, sec) {
+               if (!(sec->sh.sh_flags & SHF_EXECINSTR))
+                       continue;
+
                warnings += validate_section(file, sec);
+       }
 
        return warnings;
 }