The invention belongs to the field of
software transplantation, and particularly relates to a dynamic and static fusion
binary translation method and
system based on a dynamic link
library. The methodincludes: dividing a program by taking a function as a unit, and if the function is a third-party
library function, executing the program in a local
library replacement mode; if the indirect jump
branch instruction exists in the function, placing the function in a dynamic translator part for translation execution, and if the indirect jump
branch instruction does not exist in the function, statically translating the function by taking a
basic block as a unit, recording
relocation information translated by the function, and generating a function
relocation information table; analyzing and optimizing the translated target code according to the
static analysis information and the
relocation information, and generating a dynamic link library for calling the target program in the dynamic execution process; and during dynamic execution, preferentially executing the optimized function according to the relocation information table and the dynamic link library. According to the method, the advantages of static
binary translation offline optimization are fully utilized, codes needing to be translated and optimized in the dynamic execution period are statically executed, translation expenditure is reduced, and execution efficiency is improved.