History

objtool/klp: Extricate checksum calculation from validate_branch()

In preparation for porting the checksum code to other arches, make its functionality independent from the CFG reverse engineering code. Move it into a standalone calculate_checksums() function which iterates all functions and instructions directly, rather than being called inline from do_validate_branch(). Since checksum_update_insn() is no longer called during CFG traversal, it needs to manually iterate the alternatives.

Josh Poimboeuf committed 7 months ago

Commit 30cae581 parent 6282e9f2 files · +80 −32Browse files

Showing the changes to tools/objtool/include (1 of 2 files). Show all

Unified · Split

tools/objtool/include/objtool/checksum.h+1−5
@@ -33,11 +33,7 @@ static inline void checksum_finish(struct symbol *func) · 32 unmodified lines
33 33
34#else /* !BUILD_KLP */34#else /* !BUILD_KLP */
35 35
36static inline void checksum_init(struct symbol *func) {}36static inline int calculate_checksums(struct objtool_file *file) { return -ENOSYS; }
37static inline void checksum_update(struct symbol *func,
38 struct instruction *insn,
39 const void *data, size_t size) {}
40static inline void checksum_finish(struct symbol *func) {}
41 37
42#endif /* !BUILD_KLP */38#endif /* !BUILD_KLP */
43 39