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.
Showing the changes to tools/objtool/include (1 of 2 files). Show all
Unified · Split
| @@ -33,11 +33,7 @@ static inline void checksum_finish(struct symbol *func) · 32 unmodified lines | ||
| 33 | 33 | |
| 34 | 34 | #else /* !BUILD_KLP */ |
| 35 | 35 | |
| 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; } | |
| 41 | 37 | |
| 42 | 38 | #endif /* !BUILD_KLP */ |
| 43 | 39 | |