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
3333
3434 #else /* !BUILD_KLP */
3535
36−static inline void checksum_init(struct symbol *func) {}
37−static inline void checksum_update(struct symbol *func,
38− struct instruction *insn,
39− const void *data, size_t size) {}
40−static inline void checksum_finish(struct symbol *func) {}
36+static inline int calculate_checksums(struct objtool_file *file) { return -ENOSYS; }
4137
4238 #endif /* !BUILD_KLP */
4339