File processing method and system of application program, electronic equipment and storage medium
By obtaining and utilizing the compilation information generated by the compilation tool, identifying and building the control flow of the application, the inaccurate processing problem caused by information loss is solved, and more efficient program file adjustment and performance improvement is achieved.
Patent Information
- Application Number
- CN202410172509.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-02-06
- Publication Date
- 2025-08-08
AI Technical Summary
The prior art has lost information during the file processing of applications, resulting in inaccurate analysis and construction of control flows and the inability to effectively adjust program files to meet performance requirements.
By obtaining the compilation information generated by the compilation tool, identifying and building the application control flow, using the compilation information to adjust the program files, and making up for the information lost during the compilation process.
It realizes accurate identification and construction of control flows of application files, improves the efficiency and adjustment effect of post-binary processing, and improves the performance and stability of program files.
Smart Images

Figure CN120447902A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computers, and in particular to a method, system, electronic device, and storage medium for processing files of an application. Background Art
[0002] Currently, processing application program files requires steps such as compiling the program code to obtain the program code and adjusting the program files through post-binary adjustments. These steps inevitably lead to information loss. For example, during the analysis and construction of control flows, information loss can lead to inaccurate analysis and construction, as well as recognition failures. Consequently, during the subsequent post-binary adjustments, it's impossible to obtain adjusted program files that meet performance requirements. Therefore, the technical problem of effectively processing application files persists.
[0003] To address the above-mentioned problems, no effective solutions have been proposed so far. Summary of the Invention
[0004] The embodiments of the present application provide a method, system, electronic device, and storage medium for processing files of an application program, so as to at least solve the technical problem of being unable to effectively process files of the application program.
[0005] According to one aspect of an embodiment of the present application, a method for processing application files is provided. The method is applied to a file processing tool. The method may include: obtaining a program file of the application, wherein the program file is obtained by compiling the application's program code using a compilation tool; identifying compilation information of the application from the program file, wherein the compilation information at least records the compilation strategy of the application; using the compilation information, constructing a control flow of the application, wherein the control flow is used to represent the execution order of multiple execution instructions of the application during execution; and adjusting the program file using the control flow.
[0006] According to another aspect of an embodiment of the present application, another file processing method for an application is provided. The method is applied to a compilation tool. The method may include: compiling the program code of the application to obtain a program file, wherein the program file includes compilation information of the application, and the compilation information at least records the compilation strategy of the application; inputting the program file into a file processing tool, wherein the compilation information in the program file is recognized by the file processing tool, and the recognized compilation information is used to enable the file processing tool to construct a control flow of the application, and the control flow is used to represent the execution order of multiple execution instructions of the application during the execution process, and is used to enable the file processing tool to adjust the program file.
[0007] According to another aspect of an embodiment of the present application, a file processing system for an application is provided. The system may include: a compilation tool for compiling the program code of the application to obtain a program file, wherein the program file includes compilation information of the application, and the compilation information at least records the compilation strategy of the application; a file processing tool for identifying the compilation information from the program file; using the compilation information to construct a control flow of the application, wherein the control flow is used to represent the execution order of multiple execution instructions of the application during execution; and using the control flow to adjust the program file.
[0008] According to another aspect of an embodiment of the present application, an electronic device is provided. The electronic device may include a memory and a processor: the memory is configured to store computer-executable instructions, and the processor is configured to execute the computer-executable instructions. When the computer-executable instructions are executed by the processor, the file processing method of the application program of the embodiment of the present application is implemented.
[0009] According to another aspect of an embodiment of the present application, a processor is provided, which is used to run a program, wherein the file processing method of the application program of the embodiment of the present application is executed when the program is running.
[0010] According to another aspect of the present invention, a computer-readable storage medium is provided, which includes a stored program that controls a device containing the storage medium to execute the file processing method of the application program according to the present invention when the program is executed.
[0011] According to another aspect of the embodiments of the present application, a computer program product is provided, which includes a computer program that, when executed by a processor, implements the file processing method of the application program of the embodiments of the present application.
[0012] In an embodiment of the present application, if it is necessary to adjust the program files in the application, a file processing tool can be designed. In the file processing tool, the compiled file obtained by compiling the code of the application through the compilation tool can be obtained, and the compilation information that can explain the above-mentioned compilation strategy of the application can be obtained from the compiled file. The execution order of multiple execution instructions of the application during the execution process, that is, the control flow of the application, can be constructed using the compilation information, and the program file can be adjusted through the constructed control flow. In the above process, since the embodiment of the present application takes into account the many problems that will exist if the compilation information in the process of compilation and binary adjustment cannot be summarized, corresponding compilation information can be set for the program file to make up for the situation where information is lost in the process of compilation, etc., so that in the file processing tool, by identifying the compilation information of the program file, the purpose of more accurately identifying and constructing the control flow is achieved, thereby achieving the technical effect of effectively processing the files of the application, and solving the technical problem of not being able to effectively process the files of the application.
[0013] It is easy to notice that the above general description and the following detailed description are merely for the purpose of exemplifying and explaining the present application, and do not constitute a limitation of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0015] Figure 1 This is a hardware structure block diagram of a computer terminal (or mobile device) for implementing a file processing method for an application according to an embodiment of the present application;
[0016] Figure 2 is a structural block diagram of a computing environment of a file processing method of an application according to an embodiment of the present application;
[0017] Figure 3 is a flowchart of a file processing method of an application according to an embodiment of the present application;
[0018] Figure 4 is a flowchart of a file processing method of another application according to an embodiment of the present application;
[0019] Figure 5 is a flowchart of a file processing system of an application according to an embodiment of the present application;
[0020] Figure 6 It is a schematic diagram based on a post-binary adjustment system;
[0021] Figure 7 is a flowchart of a post-binary adjustment method based on compilation tool chain collaboration according to an embodiment of the present application;
[0022] Figure 8 is a schematic diagram of a file processing device for an application according to an embodiment of the present application;
[0023] Figure 9 is a schematic diagram of a file processing device of another application according to an embodiment of the present application;
[0024] Figure 10 is a structural block diagram of a computer terminal according to an embodiment of the present application;
[0025] Figure 11 The present invention is a block diagram of an electronic device according to a file processing method of an application program in an embodiment of the present application. DETAILED DESCRIPTION
[0026] In order to enable those skilled in the art to better understand the present invention, the following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work should fall within the scope of protection of the present invention.
[0027] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequential order. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in a sequence other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0028] First, some nouns or terms that appear in the description of the embodiments of the present application are subject to the following interpretations:
[0029] Post-binary tuning refers to the process of further improving and adjusting an application after it has been compiled into program code (binary code). This process is usually performed after the compiler has completed compilation and is used to improve program performance, reduce memory usage, and improve code readability. Post-binary tuning usually refers to adjusting the compiled program files instead of the source code. This process can be applied to various types of program code, including executable files, shared libraries, and even operating system kernels.
[0030] The Low Level Virtual Machine Binary Optimization and Layout Tool (LLVM BOLT) is a post-binary optimization tool based on the Low Level Virtual Machine (LLVM) compiler framework. It aims to improve program execution efficiency, especially for large applications or services.
[0031] A basic block is a code fragment consisting of a set of instructions executed sequentially, with no branch or jump statements and only one entry and one exit.
[0032] A section is a block of code and data divided by function in an Executable and Linkable Format (ELF) file. Each segment has its own name, type, size, and content, and is the smallest unit that the linker can operate on.
[0033] Control flow refers to the order in which instructions are executed during program execution. It describes the jump relationship between basic blocks in the program. Control flow is the basis of program logic and determines how the program executes different code paths based on different states.
[0034] Example 1
[0035] According to an embodiment of the present application, a file processing method of an application is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0036] The method embodiment provided in Example 1 of the present application can be executed in a mobile terminal, a computer terminal or a similar computing device. Figure 1This is a hardware structure block diagram of a computer terminal (or mobile device) for implementing a file processing method for an application according to an embodiment of the present application, such as Figure 1 As shown, the computer terminal 10 (or mobile device) may include one or more (illustrated as 102a, 102b, ..., 102n in the figure) processors 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor (Microcontroller Unit, abbreviated as MCU) or a programmable logic device (Field Programmable Gate Array, abbreviated as FPGA)), a memory 104 for storing data, and a transmission device 106 for communication functions. In addition, it may also include: a display, an input / output interface (I / O interface), a universal serial bus (Universal Serial Bus, abbreviated as USB) port (which may be included as one of the ports of the BUS bus), a network interface, a power supply and / or a camera. It will be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the above electronic device. Figure 1 More or fewer components than shown, or with Figure 1 Different configurations shown.
[0037] Figure 1 The hardware structure block diagram shown can be used not only as an exemplary block diagram of the computer terminal 10 (or mobile device), but also as an exemplary block diagram of the server. In an optional embodiment, Figure 2 The block diagram shows the use of the above Figure 1 The computer terminal 10 (or mobile device) is shown as an embodiment of a computing node in the computing environment 201 .
[0038] Figure 2 This is a structural block diagram of a computing environment of a file processing method of an application according to an embodiment of the present application, such as Figure 2 As shown, computing environment 201 includes multiple computing nodes (e.g., servers) (illustrated as 210-1, 210-2, ...) running on a distributed network. Each computing node includes local processing and memory resources, and end user 202 can remotely run applications or store data in computing environment 201. Applications can be provided as multiple services 220-1, 220-2, 220-3, and 220-4 in computing environment 201, representing services "A," "D," "E," and "H," respectively.
[0039] End user 202 can provide and access services through a web browser or other software application on a client. In some embodiments, the provisioning and / or request of end user 202 can be provided to the ingress gateway 230. The ingress gateway 230 may include a corresponding agent to handle the provisioning and / or request for services (one or more services provided in the computing environment 201).
[0040] Services are provided or deployed based on various virtualization technologies supported by the computing environment 201. In some embodiments, services can be provided based on virtual machine (VM)-based virtualization, container-based virtualization, and / or similar methods. Virtual machine-based virtualization can simulate a real computer by initializing a virtual machine, executing programs and applications without directly contacting any actual hardware resources. While virtual machines virtualize machines, according to container-based virtualization, containers can be started to virtualize the entire operating system so that multiple workloads can run on a single operating system instance.
[0041] In an embodiment based on container virtualization, several containers of a service can be assembled into a Pod (e.g., a Kubernetes Pod). Figure 2 As shown, service 220-2 can be equipped with one or more Pods 240-1, 240-2, ..., 240-N (collectively, Pods). A Pod can include a proxy 245 and one or more containers 242-1, 242-2, ..., 242-M (collectively, containers). One or more containers in a Pod handle requests related to one or more corresponding functions of the service. Proxy 245 typically controls network functions related to the service, such as routing and load balancing. Other services can also be equipped with Pods similar to Pods.
[0042] During operation, executing a user request from the end user 202 may require calling one or more services in the computing environment 201, and executing one or more functions of a service may require calling one or more functions of another service. Figure 2 As shown, service “A” 220 - 1 receives a user request from end user 202 from ingress gateway 230 , service “A” 220 - 1 may call service “D” 220 - 2 , and service “D” 220 - 2 may request service “E” 220 - 3 to perform one or more functions.
[0043] This computing environment can be a cloud computing environment, where resource allocation is managed by the cloud service provider, allowing for feature development without having to worry about implementing, adjusting, or scaling servers. This computing environment allows developers to execute code in response to events without building or maintaining complex infrastructure. Services can be partitioned to perform a set of functions that can scale independently and automatically, rather than scaling a single hardware device to handle the potential load.
[0044] Under the above operating environment, this application provides Figure 3 The file processing method of the application shown in the embodiment can be deployed in a file processing tool. It should be noted that the file processing method of the application of this embodiment can be implemented by Figure 1 The illustrated embodiment is executed by a mobile terminal. Figure 3 is a flowchart of a file processing method of an application according to an embodiment of the present application, such as Figure 3 As shown, the method may include the following steps:
[0045] Step S302 : obtaining a program file of the application, wherein the program file is obtained by compiling the program code of the application using a compilation tool.
[0046] In the technical solution provided in the above step S302 of the present application, the program file of the application can be obtained in the file processing tool, wherein the file processing tool can be a post-binary tool, which can also be called a post-binary adjustment tool. If the file processing tool is a post-binary tool, the application that can be processed is a binary program. The program file can be obtained by compiling the program code in the application by a compilation tool, and the program file can be a binary file corresponding to the binary program. The program code can be binary code. The compilation tool can include compilation tools such as a compiler, an assembler, and a linker to compile the program code of the application to obtain a program file.
[0047] Optionally, the input end of the file processing tool provided in the present application may be connected to the output end of the compilation tool.
[0048] For example, if the compilation tool includes a compiler, an assembler, and a linker, the three compilation tools can be connected in sequence, and the output of the linker can be connected to the input of the file processing tool. It should be noted that the above compilation tools are only examples and are not specifically limited here. As long as the compilation tool can compile the program code of the application into a program file, it is within the scope of protection of the embodiments of this application.
[0049] Optionally, after the file processing tool and the compilation tool are connected, the compilation tool can be used to compile the program code to obtain a corresponding program file, and the program file can be input into the file processing tool to perform post-binary adjustment on the program file.
[0050] Step S304: identifying compilation information of the application from the program file, wherein the compilation information at least records the compilation strategy of the application.
[0051] In the technical solution provided in the above step S304 of the present application, after obtaining the program file of the application, the program file can be identified by a file processing tool, and the compilation information of the current application can be identified from the program file, wherein the compilation information can at least record the compilation strategy of the application, and the compilation strategy can be control flow information. The control flow information can be the compilation process information for compiling the application, and can also be called the information of the compilation stage, that is, the information generated or related to the compilation process can be recorded. The compilation information can save the control flow information of the compilation process, for example, it can be the relevant information of the function control flow used to compile the application during the compilation process, such as the location where the jump relationship occurs, the jump end address, and the target basic block address. It should be noted that the content contained in the above compilation information is only for example illustration, and no specific limitation is made here. As long as it is information that can represent the process of compiling the program code in the application, it is within the protection scope of the embodiment of the present application.
[0052] Optionally, before processing the program file of the application, the compilation information of the application may be supplemented and added to the program file in advance during the process of compiling the program file by a compilation tool.
[0053] For example, before the application program code is compiled, corresponding compilation information can be added to the program code. For example, information related to compiler warnings and errors during the compilation process, as well as intermediate code generated by the compiler during the compilation process, can be added to the program code to provide various details of the program file compilation process. Information related to compiler warnings and errors can include error codes, file names, and other information related to errors that occurred during the compilation process. It should be noted that the above-mentioned compilation information is for illustrative purposes only and is not intended to be limiting.
[0054] Optionally, in a compilation tool, the compilation tool may be used to collect information related to the function control flow, and the collected information may be compiled into compilation information and filled into a program file.
[0055] For example, in the compiler in the compilation tool, information such as the basic block path relationship within the function and the location of the function call instruction can be identified and saved, and can be sent to the assembler in the form of assembly. In the assembler in the compilation tool, the received control flow related information can be converted into a data block containing matching and relocatable information, that is, the symbol and relocatable information corresponding to the position in a new data block can be determined, and the data block and relocatable information can be sent to the linker. In the linker in the compilation tool, the relocatable information can be written to the corresponding address in the data block, where the data block can be a section. In the linker, the section information can be used to determine the layout of the application in memory and the behavior during execution.
[0056] For another example, a compiler can store information such as the basic block path within a function and generate compiler annotations in the form of an assembly. In other words, the compilation information can be a compiler annotation that includes additional information such as the compilation process, compilation phase, and function control flow. It should be noted that the above-mentioned compilation information format and the specific information contained therein are merely illustrative and are not intended to be limiting.
[0057] Optionally, after the above steps, this embodiment can add corresponding compilation information to the program file, so that after the program file in the compilation tool is transferred to the file processing tool, the file processing tool can be used to identify those special sections filled with compilation information from the sections in the program file, and the corresponding compilation information can be identified from these sections.
[0058] Step S306 : constructing a control flow of the application program using the compilation information, wherein the control flow is used to represent the execution order of multiple execution instructions of the application program during the execution process.
[0059] In the technical solution provided in step S306 of the present application, after identifying the compilation information of the application from the program file, the compilation information can be used to construct the control flow of the application. The control flow can be used to represent the execution order of multiple execution instructions of the application during the execution process, and can refer to the flow and execution order of program code when the application is executed. In a computer program, the control flow determines the execution order of instructions in the program, such as conditional statements, loops, and jump statements. The control flow can also be called function control flow.
[0060] Optionally, in the file processing tool, the control flow within the function can be directly obtained from the obtained program file based on the compilation information identified therein.
[0061] Optionally, the compilation information can be analyzed to understand the structure of the application corresponding to the compilation information, such as function call relationships, variable application relationships, and control flow information. The above information can be used to identify unnecessary complex control flows or repeated code fragments in the application, and obtain analysis results of the compilation information.
[0062] Optionally, based on the analysis results obtained from analyzing the compilation information, the control flow directly obtained from the application's compilation information can be reconstructed. That is, the control flow can be reconstructed based on the analysis results. For example, conditional statements and loop statements in the control flow can be adjusted to obtain a reconstructed control flow, making the application clearer and easier to understand.
[0063] For example, if compilation analysis reveals conditional statements during compilation, you can split these conditional statements into two or more smaller functions during control flow refactoring. You can also use polymorphism to refactor the control flow, encapsulating the computational logic for different branches into separate classes. This clarifies the application's structure and improves its maintainability.
[0064] For another example, if compilation information analysis reveals that there is a loop statement (for example, a for loop) in the compilation process that sums the elements in an integer array, in the process of reconstructing the control flow, the integer array in the above loop statement can be converted into a stream. The for loop can be reconstructed through streaming operations, and the elements in the above stream can be summed through the summation method (for example, sum). This can achieve the summation of array elements more concisely, improve the readability of the application's program files, and improve the structure and quality of the program files.
[0065] It should be noted that the above-mentioned method for reconstructing the control flow and the objects that need to be adjusted through reconstruction are only examples and are not specifically limited here. As long as the process and method can reconstruct the control flow through compilation information, they are within the scope of protection of the embodiments of this application.
[0066] For example, a file processing tool can read compiler annotation information in a program file and use this information to reconstruct the obtained function control flow.
[0067] Considering the inevitable existence of information loss and other problems in related technologies, in the process of reconstructing the function control flow, it is necessary to infer the control flow through decompilation, which makes the process of determining the control flow highly complicated. Therefore, there is still a technical problem of low efficiency in determining the control flow of the application.
[0068] However, in an embodiment of the present application, taking the above-mentioned problems into consideration, additionally written compilation information can be used, and by parsing the compilation information, control flow information can be obtained therefrom, and the control flow can be reconstructed through the compilation information, thereby achieving the purpose of being able to quickly reconstruct the control flow, and achieving the purpose of reducing the complexity of determining the control flow, thereby achieving the technical effect of improving the efficiency of determining the control flow of the application.
[0069] Step S308: Adjust the program file using the control flow.
[0070] In the technical solution provided in the above step S308 of the present application, after constructing the control flow of the application using the compilation information, the control flow can be used to adjust the program file, wherein the performance index of the adjusted program file during execution is higher than the performance index of the program file before the adjustment. The performance index can be the stability, performance, memory usage and readability of the entire program file. It should be noted that the above performance index is only for illustration and is not specifically limited here. As long as it can indicate that the performance index of the adjusted program file is better than that of the program file before the adjustment, it is within the protection scope of the embodiment of the present application.
[0071] Optionally, the reconstructed control flow can be used to adjust the program file. For example, the program file can be post-binary adjusted to improve the performance, stability, and readability of the program file, and to reduce the memory usage of the program file.
[0072] Optionally, after the control flow is reconstructed, the program file may be recompiled using the reconstructed control flow to ensure that the application program obtained after the reconstructed process can still run correctly.
[0073] For example, according to the reconstructed control flow, the program files of the application can be updated. For example, the conditional statements in the program files can be modified, or repeated codes in the program files can be merged, or common code fragments can be extracted.
[0074] For another example, based on the reconstructed control flow, the data in the program file can be arranged in a specific alignment in the memory to reduce the overhead of memory access, that is, the program file can be adjusted by data alignment. The size and complexity of the program can also be reduced by identifying and removing useless instructions and data in the program, that is, the program file can be adjusted by removing useless instructions. Multiple iterations in the loop in the program file can also be merged into a larger iteration to reduce loop overhead and branch overhead, that is, the program file can be adjusted by loop expansion. By reorganizing the instruction sequence of the program file, the application can more efficiently utilize the instruction-level parallelism of the processor during execution, that is, the program file can be adjusted by code rearrangement. The above-mentioned operation of adjusting the program file can improve the performance of the application.
[0075] It should be noted that the above-mentioned method and process of adjusting a program file using control flow to improve the performance and stability of the program file are examples and are not specifically limited here. As long as the process and method of updating the program file based on the control flow reconstructed by the compilation information to improve the performance and stability of the program file are within the scope of protection of the embodiments of this application.
[0076] Optionally, control flow helps file processing tools understand the logical structure of the application during post-binary tuning, and use this information to tune the application to improve its performance and efficiency. Given the important role that control flow plays in the post-binary tuning process, it is important to consider how to improve the efficiency of determining control flow.
[0077] Considering that in the related art, during the compilation process, from program code to assembly, and then to post-binary adjustment, there is inevitably information loss, which makes the determined control flow inaccurate or fails to identify the control flow. Therefore, there is still a technical problem of low efficiency in post-binary processing of program files. However, in an embodiment of the present application, by adopting the collaboration of a compilation tool chain, compilation information can be recorded in the program file to make up for the information lost during the compilation process. In this way, the file processing tool can recognize the compilation information in the program file and more accurately identify and reconstruct the control flow based on the compilation information, thereby achieving a technical effect that can improve the efficiency of post-binary processing of program files.
[0078] Through the above steps S302 to S308 of the present application, if it is necessary to adjust the program files in the application, a file processing tool can be designed. In the file processing tool, the compiled file obtained by compiling the code of the application through the compilation tool can be obtained, and the compilation information that can explain the above compilation strategy of the application can be obtained from the compiled file. The execution order of multiple execution instructions of the application during the execution process, that is, the control flow of the application, can be constructed using the compilation information, and the program file can be adjusted through the constructed control flow. In the above process, since the embodiment of the present application takes into account the many problems that will exist if the compilation information in the process of compilation and binary adjustment cannot be summarized, the corresponding compilation information can be set for the program file to make up for the situation where information is lost in the process of compilation, etc., so that in the file processing tool, by identifying the compilation information of the program file, the purpose of more accurately identifying and constructing the control flow is achieved, thereby achieving the technical effect of effectively processing the files of the application, and solving the technical problem of not being able to effectively process the files of the application.
[0079] The above method of this embodiment is further introduced below.
[0080] As an optional implementation, step S304, identifying the compilation information of the application from the program file, includes: determining a target section in the program file, wherein the target section is used to represent data in the application divided according to the functional type of the execution instruction; based on the target section, identifying the compilation information of the application in the program file.
[0081] In this embodiment, during the process of identifying the compilation information of an application from a program file, a target section may be determined in the program file, and based on the target section, the compilation information pre-stored in the application may be identified in the program file. The target section may be a special section in the program file that stores the compilation information of the application. The target section may be used to represent data in the application divided according to the functional type of the executed instruction. The functional type may be a loop, a jump, a conditional selection, or the like.
[0082] It should be noted that the above-mentioned function types are only examples and are not specifically limited here. As long as the function types can execute the corresponding execution instructions to be executed in the application, they are within the protection scope of the embodiments of this application.
[0083] Optionally, since there are a large number of sections in the program file of the application, and various information is stored in the sections, when the program code is compiled using a compilation tool to obtain the program file, the compilation information can be analyzed from the program code, such as the basic block path relationship within the function and the location of the function call instruction, etc., and some sections can be selected from a large number of sections to store the above-mentioned special compilation information.
[0084] Optionally, after the compilation information is determined from the program code by the compilation tool and stored in some special sections, after the file processing tool obtains the above program code, those feature sections that store the compilation information can be screened out from a large number of sections, and the control flow can be reconstructed using the compilation information stored in these special sections.
[0085] As an optional implementation, based on the target section, the compilation information of the application is identified in the program file, including: in the program file, determining at least one target address in the target section, wherein the target address is used to represent the associated address of the function of the application; based on the target address, determining the compilation information.
[0086] In this embodiment, in the process of identifying the compilation information of the application in the program file based on the target section, in the program file, the target address storing the compilation information can be determined from the target section, and the corresponding compilation information can be determined based on the target address, wherein the target section can include a large number of addresses, and the large number of addresses can include at least one target address. The target address can be used to represent the associated address of the function of the application during the compilation process, for example, it can be the final address in the target section, or the location of the function call instruction in the section, or the basic block location, or the jump occurrence location, jump end address, etc. It should be noted that the above-mentioned target address is only for illustration, and no specific limitation is made here. As long as it is an address that can store the compilation information of the function of the application during the compilation process, it is within the protection scope of the embodiment of the present application.
[0087] Optionally, since there are a large number of addresses where information is stored in the target section, but the functions stored in these addresses and the execution instructions corresponding to the functions may be different, if it is necessary to determine the compilation information, it is necessary to distinguish them through the instructions to be executed or the functions used in the compilation process, that is, it is necessary to distinguish the compilation information corresponding to different functions and the corresponding execution instructions.
[0088] As an optional implementation, determining the compilation information based on the target address includes: determining an execution instruction of a function corresponding to the target address; and determining the target address and the execution instruction of the function as the compilation information.
[0089] In this embodiment, in the process of determining the compilation information based on the target address, the execution instructions of the function corresponding to the target address can be determined, and the target address and the execution instructions of the corresponding function can be determined as the corresponding compilation information, where the execution instructions can also be called function call instructions, which can include jump instructions and sequential execution instructions, etc. This is only for illustration and no specific limitation is made.
[0090] Optionally, in order to ensure the accuracy of the determined compilation information and thus accurately reconstruct the control flow of the application, it is necessary to distinguish the target addresses from the large number of target addresses storing the compilation information in the target section according to the execution instructions of different functions, and determine the compilation information by using different execution instructions and the corresponding target addresses.
[0091] For example, when the compilation tool compiles the program code, different function control flow related information, such as the location of the function call instruction, the jump relationship and the target basic block address, is stored in the corresponding target address in the target section, and the compilation information is used as compiler comments.
[0092] Optionally, in the file processing tool, the compiler comment stored in the target address of the target section in the acquired program file may be read to obtain the compilation information.
[0093] As an optional implementation, the target address is written to the initial program file by the linker in the compilation tool based on the function attribute information in the target section to obtain the program file, and the function attribute information is used to call the function of the application.
[0094] In this embodiment, the target address can be written to the initial program file by the linker in the compilation tool based on the function attribute information in the target section to obtain the program file, wherein the compilation tool may include a compiler, an assembler and a linker. The function attribute information can be used to call the function of the application, for example, it can be the relocatable information, relocation file and corresponding symbols of the function. It should be noted that the above-mentioned function attribute information is only for illustration and is not specifically limited here. As long as the position of each function in the application can be determined, the function attribute information that can be used to call the corresponding function is within the protection scope of the embodiment of the present application.
[0095] Optionally, in the compiler in the compilation tool, the basic block path relationship within the function, the location of the function call instruction, etc. can be saved and emitted to a new section compiler annotation in assembly form, that is, the control flow information can be saved and emitted in assembly form.
[0096] Alternatively, in the assembler following the compiler, the assembler can be used to create symbols and relocatable information corresponding to the locations in the section compiler annotation. In other words, the assembler can be used to convert the addresses of the corresponding control flow information records into sections containing symbols and relocatable information.
[0097] Alternatively, in a linker following the assembler, the linker can write function attribute information such as symbols and relocatable information into a section in the initial program file for which compilation information has not yet been determined, thereby obtaining a successfully written program file containing the compilation information. In other words, the linker can write the relocatable information into the target address (final address) within the section in the initial program file, thereby obtaining a successfully compiled program file.
[0098] As an optional implementation, step S302, obtaining the program file of the application, includes: reading the program file from a linker.
[0099] In this embodiment, in the process of acquiring the program file of the application, the program file may be read from the linker.
[0100] Optionally, after the linker in the compilation tool compiles information such as symbols and relocatable information to obtain a program file containing compilation information, the program file can be transferred to the file processing tool.
[0101] As an optional implementation, step S306 uses compilation information to construct the control flow of the application, including: using the compilation information to determine the execution order of the function's execution instructions during the execution process; and determining the execution order of the function's execution instructions during the execution process as the function control flow corresponding to the function.
[0102] In this embodiment, in the process of using compilation information to construct the control flow of the application, the compilation information can be used to determine the corresponding execution order of the function's execution instructions during the execution process, and the function control flow corresponding to the function can be determined through the execution order.
[0103] Optionally, after determining the compilation information of each function through the execution instructions of the corresponding function in the target address in the target section, the execution order of the functions can be determined by parsing the compilation information. The execution process of the functions can be sorted according to the order of execution to obtain the corresponding function control flow.
[0104] As an optional implementation, after determining at least one target address in the target section, the method further includes: removing the target section from the program file.
[0105] In this embodiment, after determining at least one target address in the target section, the target section may be removed from the program file.
[0106] In an embodiment of the present application, in order to ensure the memory usage of the program file, after determining the target section storing the compilation information from the program file, the target section and the data contained in the target section can be removed. Since the compilation information has been obtained at this time, it is only necessary to use the obtained compilation information to reconstruct the control flow. The target section in the program file has no effect and can be removed to reduce the memory usage of the program file, thereby achieving the technical effect of reducing the memory usage of the program file.
[0107] Optionally, in order to ensure that the file processing program is not invaded, the target section will not be loaded into the memory of the file processing tool, will not affect the execution process of the original program code, and can be removed by a post-binary adjustment tool. The program file after removing the target section can be post-binary adjusted to achieve the technical effect of achieving the non-invasiveness of the file processing tool.
[0108] As an optional implementation, the program file is a binary file.
[0109] In this embodiment, the program file may be a binary file.
[0110] In an embodiment of the present application, taking into account the problems of inaccuracy and recognition failure in analyzing and reconstructing function control flows when using post-binary adjustment tools, the tool chain collaboration method proposed in this application can record information during the compilation process without affecting the behavior of the application. The above-mentioned collaboration mechanism can assist the post-binary adjustment tool to more accurately identify and reconstruct function control flows, thereby achieving a more significant adjustment effect and higher stability, and further realizing the technical effect of effectively processing application files.
[0111] Optionally, based on the issues considered in this application, a post-binary adjustment tool and a compilation tool connected to the post-binary adjustment tool are provided. The compilation tool can be used to compile a binary file containing compilation information. The post-binary adjustment tool can then analyze the binary file containing compilation information to obtain the compilation information, reconstruct the control flow, and perform post-binary adjustments on the binary file.
[0112] The present application embodiment also provides a file processing method for an application from the compilation tool side. Figure 4 is a flowchart of a file processing method of an application according to an embodiment of the present application, such as Figure 4 As shown, the method is applied to a compilation tool and may include the following steps:
[0113] Step S402 : compile the program code of the application to obtain a program file, wherein the program file includes compilation information of the application, and the compilation information at least records the compilation strategy of the application.
[0114] In the technical solution provided in step S402 of the present application, a compilation tool can be used to compile the program code of the application to obtain a compiled file, wherein the program file can include compilation information of the application. The compilation information can at least record the compilation strategy of the application.
[0115] Considering that in the related art, during the compilation process, from program code to assembly, and then to post-binary adjustment, there is inevitably information loss, which makes the determined control flow inaccurate or fails to identify the control flow. Therefore, there is still a technical problem of low efficiency in post-binary processing of program files. However, in the embodiment of the present application, by collaborating with a compilation tool, compilation information can be supplemented in the program file to make up for the information lost during the compilation process. In this way, the file processing tool can recognize the compilation information in the program file and more accurately identify and reconstruct the control flow based on the compilation information, thereby achieving a technical effect that can improve the efficiency of post-binary processing of program files.
[0116] Step S404: input the program file into a file processing tool, wherein the compilation information in the program file is recognized by the file processing tool, and the recognized compilation information is used to enable the file processing tool to construct a control flow of the application, and the control flow is used to represent the execution order of multiple execution instructions of the application during the execution process, and is used to enable the file processing tool to adjust the program file, and the performance index of the adjusted program file during the execution process is higher than the performance index before the adjustment.
[0117] In the technical solution provided in step S404 above of the present application, a program file supplemented with compilation information can be input into a file processing tool, and post-binary adjustments can be performed on the program file in the file processing tool, wherein the compilation information in the program file can be identified by the file processing tool, and the identified compilation information can be used to enable the file processing tool to reconstruct the control flow of the application. The control flow can be used to represent the execution order of multiple execution instructions of the application during execution, and is used to enable the file processing tool to adjust the program file so that the performance indicators of the adjusted program file during execution are higher than the performance indicators of the program file before adjustment.
[0118] Optionally, the input terminal of the file processing tool may be connected to the output terminal of the compilation tool.
[0119] Optionally, after the file processing tool and the compilation tool are connected, the compilation tool can be used to compile the program code to obtain a corresponding program file, and the program file can be input into the file processing tool to perform post-binary adjustment on the program file.
[0120] Optionally, corresponding compilation information is added to the program file. After the program file in the compilation tool is transferred to the file processing tool, the file processing tool can be used to identify special sections filled with compilation information from the sections in the program file, and the corresponding compilation information can be identified from these sections.
[0121] Optionally, in the file processing tool, the control flow within the function can be directly obtained from the obtained program file based on the compilation information identified therein.
[0122] For example, a file processing tool can read compiler annotation information in a program file and use this information to reconstruct the function control flow.
[0123] Optionally, the reconstructed control flow can be used to adjust the program file. For example, the program file can be post-binary adjusted to improve the performance, stability, and readability of the program file, and to reduce the memory usage of the program file.
[0124] Through the above steps S402 to S404 of the present application, the program code of the application is compiled to obtain a program file, wherein the program file includes compilation information of the application, and the compilation information at least records the compilation strategy of the application; the program file is input into a file processing tool, wherein the compilation information in the program file is identified by the file processing tool, and the identified compilation information is used to enable the file processing tool to construct a control flow of the application, and the control flow is used to represent the execution order of multiple execution instructions of the application during the execution process, and is used to enable the file processing tool to adjust the program file, thereby achieving the technical effect of being able to effectively process the files of the application, and solving the technical problem of being unable to effectively process the files of the application.
[0125] The above method of this embodiment is further introduced below.
[0126] As an optional implementation, step S404, the compilation tool includes: a compiler, an assembler and a linker, wherein the program code of the application is compiled to obtain a program file, including: controlling the compiler to compile the program code of the application to obtain compilation information; controlling the assembler to convert the compilation information to obtain a target section, wherein the target section is used to represent data in the application divided according to the functional type of the execution instruction.
[0127] In this embodiment, during the process of compiling the program code of an application to obtain a program file, a compiler in a compilation tool can be controlled to compile the program code of the application to obtain compilation information. An assembler in the compilation tool can be controlled to convert the compilation information to obtain a target section, wherein the compilation tool may include a compiler, an assembler, and a linker. The target section can be used to represent data in the application divided according to the functional type of the executed instructions.
[0128] Optionally, since there are a large number of sections in the program file of the application, which store various information, when using the compilation tool to compile the program code to obtain the program file, the compilation information can be analyzed from the program code, such as the basic block path relationship within the function and the location of the function call instruction, etc., and some sections can be selected from the large number of sections to store the above-mentioned special compilation information.
[0129] Optionally, during the process of compiling the program code by the compilation tool, different function control flow related information, such as the location of the function call instruction, the jump relationship and the target basic block address, is stored in the corresponding target address in the target section, and the compilation information is used as compiler comments.
[0130] As an optional implementation, controlling the assembler to convert the compilation information to obtain a target section includes: controlling the assembler to convert at least one target address in the compilation information to obtain a target section including the target address and function attribute information, wherein the target address is used to represent the associated address of the application's function, and the function attribute information is used to call the application's function.
[0131] In this embodiment, when controlling an assembler in a compilation tool to convert compilation information to obtain a target section, the assembler can be controlled to convert a target address in the compilation information to obtain target information including the target address and function attribute information. The target address can be used to indicate the associated address of a function of an application during the compilation process. The function attribute information can be used to call a function of the application.
[0132] Optionally, in the compiler in the compilation tool, the basic block path relationship within the function, the location of the function call instruction, etc. can be saved and emitted to a new section compiler annotation in assembly form, that is, the control flow information can be saved and emitted in assembly form.
[0133] Alternatively, in the assembler following the compiler, the assembler can be used to create symbols and relocatable information corresponding to the locations in the section compiler annotation. In other words, the assembler can be used to convert the addresses of the corresponding control flow information records into sections containing symbols and relocatable information.
[0134] Alternatively, in a linker following the assembler, the linker can write function attribute information such as symbols and relocatable information into a section in the initial program file where the compilation information has not been determined, thereby obtaining a successfully written program file containing the compilation information. In other words, the linker can write the relocatable information into the final address (target address) within the section in the initial program file, thereby obtaining a successfully compiled program file.
[0135] As an optional implementation, controlling the linker to write the target section into the initial program file to obtain the program file includes: controlling the linker to write the target address in the target section into the initial program file based on the function attribute information in the target section to obtain the program file.
[0136] In this embodiment, in the process of controlling the linker to write the target section into the initial program file to obtain the program file, the linker can be controlled to write the target address in the target section into the initial program file based on the function attribute information in the target section to obtain a program file filled with compilation information.
[0137] Optionally, a linker in the compilation tool compiles information such as symbols and relocatable information to obtain a program file having compilation information.
[0138] Optionally, after the program file containing the compilation information is compiled, the program file at this time may be transferred to a file processing tool.
[0139] In an embodiment of the present application, the program code of an application is compiled to obtain a program file, wherein the program file includes compilation information of the application, and the compilation information at least records the compilation process of the application; the program file is input into a file processing tool, wherein the compilation information in the program file is identified by the file processing tool, and the identified compilation information is used to enable the file processing tool to construct a control flow of the application, and the control flow is used to represent the execution order of multiple execution instructions of the application during the execution process, and is used to enable the file processing tool to adjust the program file, and the performance index of the adjusted program file during the execution process is higher than the performance index before the adjustment. Since the embodiment of the present application takes into account the many problems that may exist if the compilation information in the compilation and binary adjustment processes cannot be summarized, corresponding compilation information can be set for the program file to make up for the situation where information is lost in the compilation process, so that in the file processing tool, by identifying the compilation information of the program file, the purpose of more accurately identifying and constructing the control flow is achieved, thereby achieving the technical effect of effectively processing the application files and solving the technical problem of not being able to effectively process the application files.
[0140] Example 2
[0141] According to an embodiment of the present application, an embodiment of a file processing system for an application is also provided. Figure 5 is a schematic diagram of a file processing system of an application according to an embodiment of the present application, such as Figure 5 As shown, the file processing system 500 of an application may include: a compilation tool 501 and a file processing tool 502 .
[0142] The compilation tool 501 is used to compile the program code of the application to obtain a program file, wherein the program file includes compilation information of the application, and the compilation information at least records the compilation strategy of the application.
[0143] In this embodiment, the program code of the application can be compiled in the compilation tool 501 to obtain a compiled program file, wherein the program file can include compilation information of the application. The compilation information can at least record the compilation process of the application.
[0144] Optionally, the program code is compiled by the compilation tool 501 to obtain a corresponding program file, and the program file can be input into the file processing tool 502 to perform post-binary adjustment on the program file.
[0145] Considering the inevitable information loss and other issues in the related art, in the process of constructing the function control flow, it is necessary to infer the control flow through decompilation, which makes the process of determining the control flow highly complex. Therefore, there is still a technical problem of low efficiency in determining the control flow of the application. However, in the embodiment of the present application, considering the above-mentioned problem, in the compilation tool 501, additional compilation information can be written during the compilation of the program file, so that the control flow information can be obtained from the compilation information by parsing the compilation information, and the control flow is constructed based on the compilation information, thereby achieving the purpose of being able to quickly construct the control flow, and achieving the purpose of reducing the complexity of determining the control flow, thereby achieving the technical effect of improving the efficiency of determining the control flow of the application.
[0146] The file processing tool 502 is used to identify compilation information from the program file; use the compilation information to construct the control flow of the application, wherein the control flow is used to represent the execution order of multiple execution instructions of the application during the execution process; and use the control flow to adjust the program file.
[0147] In this embodiment, the file processing tool 502 can identify the received program file and identify the corresponding compilation information from the program file. The identified compilation information can be used to construct the control flow of the application program and perform post-binary adjustments on the program file using the program flow. The control flow can be used to represent the execution sequence of multiple execution instructions of the application program during execution. The performance index of the adjusted program file during execution is higher than that of the program file before the adjustment.
[0148] Optionally, the program file is input from the compilation tool 501 to the file processing tool 502. A target section containing compilation information can be identified from a large number of sections contained in the program file, and corresponding compilation information can be identified from the target section. Function control flow is constructed based on the compilation information, and the obtained function control flow is used to perform post-binary adjustment on the program file.
[0149] In this embodiment, a file processing system for an application is provided. The program code of the application is compiled using a compilation tool to obtain a program file, wherein the program file includes compilation information of the application, which at least records the compilation strategy of the application. The compilation information is identified from the program file using the file processing tool. The compilation information is used to construct a control flow of the application, wherein the control flow is used to represent the execution order of multiple execution instructions of the application during execution. The program file is adjusted using the control flow, thereby achieving the technical effect of effectively processing the application file and solving the technical problem of being unable to effectively process the application file.
[0150] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application, such as the data for verification, are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0151] Example 3
[0152] Currently, there is still a technical problem of being unable to effectively process application files due to inaccuracies and recognition failures in analyzing and reconstructing function control flows using post-binary adjustment tools.
[0153] Furthermore, the present application provides a post-binary adjustment method based on the collaboration of a compilation tool chain. This method realizes data sharing and communication between the post-binary adjustment tool and the compiler by introducing a collaboration mechanism during the compilation process. During the compilation process, accurate information about the function control flow is recorded, including jump relationships, basic block addresses, etc. This information is very important for subsequent adjustment tools. By collaborating with the compiler, more comprehensive and accurate control flow information can be obtained, thereby helping the adjustment tool to better understand the execution logic of the program. This collaborative method not only improves the accuracy of the post-binary adjustment tool, but also improves the stability and reliability of the adjustment, thereby solving the technical problem of being unable to effectively process the application's files. This is different from the traditional solution in which the accuracy of analysis and reconstruction and recognition failures occur due to information loss, solving the technical problem of being unable to effectively process the application's files.
[0154] In an embodiment of the present application, a collaborative mechanism is provided so that the post-binary adjustment tool can collaborate with the compiler to achieve the recording and sharing of compilation process information. During the compilation process, accurate information about the function control flow, including jump relations, basic block addresses, etc., can be recorded, and this information is very critical for subsequent adjustment tools. By collaborating with the compiler and obtaining more accurate and comprehensive control flow information, the post-binary adjustment tool can be assisted to more accurately identify and reconstruct the function control flow, thereby achieving a more significant adjustment effect and improving stability. It can help the adjustment tool to perform more accurate analysis and reconstruction of the control flow, thereby effectively improving the performance and stability of the program, and bringing significant improvement to the adjustment effect and stability of the program. Since the embodiment of the present application takes into account the many problems that may exist if the compilation information in the process of compilation and binary adjustment cannot be summarized, corresponding compilation information can be set for the program file to make up for the situation where information is lost in the process of compilation, etc., so that in the file processing tool, by identifying the compilation information of the program file, the purpose of more accurately identifying and reconstructing the control flow is achieved, thereby achieving the technical effect of effectively processing the files of the application program, and solving the technical problem that the files of the application program cannot be effectively processed.
[0155] The above method of this embodiment is further introduced below.
[0156] In this embodiment, the code size of large-scale applications is usually very large, reaching tens or even hundreds of megabytes. This makes it difficult for the program to effectively utilize the cache mechanism during operation, resulting in a large amount of processing time being consumed in the data transmission between the central processing unit (CPU) and the memory. If the functions with higher execution frequency are layout adjusted, the CPU cache can be used more efficiently, thereby bringing significant performance improvement. Compilation technology means to solve this problem include adjustment tools based on performance analysis (Profile-Guided Optimization, referred to as PGO) and post-binary adjustment. Both methods involve collecting information when the program is running, such as code jumps, call relationships and function execution frequency. Using these collected performance analysis data, some adjustment strategies of the program can be effectively guided, such as determining whether to adjust the function inline, and how to layout code blocks and functions to improve the performance of the program in certain specific usage scenarios.
[0157] Optionally, post-binary adjustments are independent of the compilation toolchain and directly parse and modify the executable file / dynamic library ELF file. During the compilation process, from program source code to assembly and then to the final binary, there is inevitable loss of information, which will cause two problems. Misidentification of the control flow of the function leads to abnormal program behavior. A common situation is that the post-binary tool fails to recognize that basic block A will jump to basic block B. When the post-binary tool inserts or deletes instructions between the two basic blocks, it will cause basic block A to jump to an unexpected location. The function control flow cannot be reconstructed, resulting in the inability of post-binary adjustments. Since the binary lacks information from the compilation stage, the post-binary tool will be unable to parse indirect jumps within the function and some indirect tail calls.
[0158] In this embodiment, Figure 6 is a diagram based on a post-binary adjustment system, such as Figure 6 As shown, the adjustment system may include a programming language 601, a front-end programming component (Frontend) 602, a low-level virtual machine intermediate representation (LLVM IR) 603, an LLVM backend (Backend) 604, an assembler 605, a linker 606, and a binary adjustment tool 607. The programming languages 601 may be divided into four types: the first type may include C, C++, and Cbjc; the second type may be Swift; the third type may be Fortran; and the fourth type may be Haskell. The front-end programming component 602 may be used to perform syntax analysis, semantic analysis, and IR generation on the programming language, and may include compilation components corresponding to different programming languages. For example, the first programming language may correspond to the ClangC / C++ / Cbjc frontend, the second programming language may correspond to the SwiftCFrontend, the third programming language may correspond to the LLVM-GCC frontend, and the fourth programming language may correspond to the GHCFrontend. LLVM IR 603 may include an LLVM optimizer. LLVM backend 604 may include LLVM X86 Backend, LLVM PowerPC Backend, and LLVM ARM Backend. Binary optimization tool 607 may be a Bolt application.
[0159] Alternatively, the Advanced RISC Machine (ARM) 64-bit instruction set architecture, AArch64, can be used in Bolt applications. However, due to the limitations of the Reduced Instruction Set Architecture (ISA), it is more difficult to reconstruct the original control flow of a program through binary disassembly than on X86, resulting in more serious performance and stability issues.
[0160] Optionally, the LLVM framework currently supports writing the addresses of basic blocks into the final binary, but there is currently no clear adjustment solution that uses this feature. This solution is also a tool chain collaborative method. Post-binary tools can use this method to distinguish basic blocks from consecutive instructions, but the lack of the specific control flow of basic blocks still cannot solve the problems encountered by post-binary tools. After using PGO adjustment, the compiler will emit a special section to the relocatable file to record the call relationship and number of functions, and the linker will decide how to arrange the sections based on this information. This solution is also a tool chain collaborative adjustment solution, but the target object is not the post-binary adjustment tool, and it cannot solve the control flow identification and reconstruction problems encountered by the post-binary adjustment tool.
[0161] In the embodiments of the present application, through the collaborative work of the tool chain, information related to the function control flow, including jump relationships and target basic block addresses, is written into the final binary file. When the post-binary tool reads the binary file, it can reconstruct the function control flow based on the additional information written, effectively compensating for the problem of information loss during the compilation process.
[0162] In this embodiment, Figure 7 This is a flowchart of a post-binary adjustment method based on compilation tool chain collaboration according to an embodiment of the present application. Figure 7 As shown, the method may include the following steps:
[0163] Step S702: Save the control flow information through the compiler and emit it in assembly form.
[0164] In this embodiment, the compiler saves the basic block path relationship within the function and the location of the function call instruction, and emits them to a new section compilation in the form of assembly.
[0165] Optionally, additional information is written to record the basic block location, jump location, and jump destination address, which, combined with other information about the binary program, can construct a complete control flow.
[0166] Step S704: Convert the address of the corresponding control flow information record into a section containing symbols and relocatable information through the assembler.
[0167] In this embodiment, the symbols corresponding to the positions in the section compiler annotation and the corresponding relocatable information are created by the assembler.
[0168] Step S706: The linker writes the final address of the corresponding section into the binary according to the relocatable information.
[0169] In this embodiment, the linker writes the final address via the relocatable information.
[0170] Step S708: Using a post-binary adjustment tool, the control flow within the function is directly identified based on the special sections in the binary.
[0171] In this embodiment, the post-binary adjustment tool reads the compilation annotation information and uses it to reconstruct the function control flow.
[0172] Optionally, the control flow information from the compilation process can be saved in the binary. When reconstructing the function control flow, the control flow can be no longer inferred through decompilation. Instead, this additional information can be used for parsing and reconstruction, which can achieve more accurate results.
[0173] In embodiments of the present application, a toolchain can be leveraged for collaboration, improving the success rate and accuracy of post-binary tools for reconstructing function control flows. Recording control flow information through a toolchain link ensures accuracy, meaning the compiler, assembler, and linker collaborate to ensure the accuracy of address-related information in complex build scenarios. It also ensures non-intrusiveness, meaning extra sections are not loaded into memory, impacting the original code execution flow, and can be removed using post-binary tweaking tools.
[0174] In an embodiment of the present application, if it is necessary to adjust the program files in the application, a file processing tool can be designed. In the file processing tool, the compiled file obtained by compiling the code of the application through the compilation tool can be obtained, and the compilation information that can explain the above-mentioned compilation strategy of the application can be obtained from the compiled file. The execution order of multiple execution instructions of the application during the execution process, that is, the control flow of the application, can be constructed using the compilation information, and the program file can be adjusted through the constructed control flow. In the above process, since the embodiment of the present application takes into account the many problems that will exist if the compilation information in the process of compilation and binary adjustment cannot be summarized, corresponding compilation information can be set for the program file to make up for the situation where information is lost in the process of compilation, etc., so that in the file processing tool, by identifying the compilation information of the program file, the purpose of more accurately identifying and constructing the control flow is achieved, thereby achieving the technical effect of effectively processing the files of the application, and solving the technical problem of not being able to effectively process the files of the application.
[0175] Example 4
[0176] According to an embodiment of the present application, there is also provided a method for implementing the above Figure 3 The application file processing method shown is an application file processing device.
[0177] Figure 8 is a schematic diagram of a file processing device of an application according to an embodiment of the present application, such as Figure 8 As shown, the file processing device 800 of the application may include: an acquisition unit 802 , an identification unit 804 , a construction unit 806 and an adjustment unit 808 .
[0178] The acquiring unit 802 is configured to acquire a program file of the application, wherein the program file is obtained by compiling the program code of the application using a compiling tool.
[0179] The identification unit 804 is configured to identify the compilation information of the application from the program file, wherein the compilation information at least records the compilation strategy of the application.
[0180] The construction unit 806 is used to construct the control flow of the application program using the compilation information, wherein the control flow is used to represent the execution order of multiple execution instructions of the application program during the execution process.
[0181] The adjustment unit 808 is used to adjust the program file using the control flow.
[0182] Here, the acquisition unit 802, identification unit 804, construction unit 806, and adjustment unit 808 correspond to steps S302 to S308 in Example 1. The examples and application scenarios implemented by the four units and the corresponding steps are the same, but are not limited to the contents disclosed in the above-mentioned Example 1. It should be noted that the above-mentioned units can be hardware components or software components stored in a memory (e.g., memory 104) and processed by one or more processors (e.g., processors 102a, 102b..., 102n). The above-mentioned units can also be part of the device and can be run in the computer terminal 10 provided in Example 1.
[0183] According to an embodiment of the present application, there is also provided a method for implementing the above Figure 4 The application file processing method shown is an application file processing device.
[0184] Figure 9 is a schematic diagram of a file processing device of an application according to an embodiment of the present application, such as Figure 9 As shown, the file processing device 900 of the application may include: a compiling unit 902 and an input unit 904 .
[0185] The compiling unit 902 is configured to compile the program code of the application to obtain a program file, wherein the program file includes compilation information of the application, and the compilation information at least records the compilation strategy of the application.
[0186] Input unit 904 is used to input the program file into the file processing tool, wherein the compilation information in the program file is recognized by the file processing tool, and the recognized compilation information is used to enable the file processing tool to construct the control flow of the application. The control flow is used to represent the execution order of multiple execution instructions of the application during the execution process, and is used to enable the file processing tool to adjust the program file.
[0187] It should be noted that the compilation unit 902 and the input unit 904 correspond to steps S402 to S404 in Example 1. The examples and application scenarios implemented by the two units and the corresponding steps are the same, but are not limited to the contents disclosed in Example 1. It should be noted that the above-mentioned units can be hardware components or software components stored in a memory (e.g., memory 104) and processed by one or more processors (e.g., processors 102a, 102b..., 102n). The above-mentioned units can also be part of the device and can be run in the computer terminal 10 provided in Example 1.
[0188] In the file processing device of the application, if it is necessary to adjust the program files in the application, a file processing tool can be designed. In the file processing tool, the compiled file obtained by compiling the code of the application through the compilation tool can be obtained, and the compilation information that can explain the above-mentioned compilation strategy of the application can be obtained from the compiled file. The execution order of multiple execution instructions of the application during the execution process, that is, the control flow of the application, can be constructed using the compilation information, and the program file can be adjusted through the constructed control flow. In the above process, since the embodiment of the present application takes into account the many problems that will exist if the compilation information in the process of compilation and binary adjustment cannot be summarized, corresponding compilation information can be set for the program file to make up for the situation where information is lost in the process of compilation, etc., so that in the file processing tool, by identifying the compilation information of the program file, the purpose of more accurately identifying and constructing the control flow is achieved, thereby achieving the technical effect of effectively processing the files of the application, and solving the technical problem of not being able to effectively process the files of the application.
[0189] Example 5
[0190] The embodiment of the present application can provide a computer terminal, which can be any computer terminal device in a computer terminal group. Optionally, in this embodiment, the computer terminal can also be replaced by a terminal device such as a mobile terminal.
[0191] Optionally, in this embodiment, the computer terminal may be located in at least one network device among a plurality of network devices of a computer network.
[0192] In this embodiment, the above-mentioned computer terminal can execute the program code of the following steps in the file processing method of the application: obtaining the program file of the application, wherein the program file is obtained by compiling the program code of the application by a compilation tool; identifying the compilation information of the application from the program file, wherein the compilation information at least records the compilation strategy of the application; using the compilation information, constructing the control flow of the application, wherein the control flow is used to represent the execution order of multiple execution instructions of the application during the execution process; and adjusting the program file using the control flow.
[0193] Optionally, Figure 10 This is a structural block diagram of a computer terminal according to an embodiment of the present application. Figure 10 As shown, the computer terminal A may include: one or more (only one is shown in the figure) processors 1002 , a memory 1004 and a transmission device 1006 .
[0194] Among them, the memory can be used to store software programs and modules, such as the program instructions / modules corresponding to the file processing method and device of the application in the embodiment of the present application. The processor executes various functional applications and data processing by running the software programs and modules stored in the memory, that is, realizing the file processing method of the above-mentioned application. The memory may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory may further include a memory remotely arranged relative to the processor, and these remote memories may be connected to the terminal A via a network. Examples of the above-mentioned network include but are not limited to the Internet, an intranet, a local area network, a mobile communication network and a combination thereof.
[0195] The processor can call the information and application stored in the memory through the transmission device to perform the following steps: determine the target section in the program file, where the target section is used to represent the data in the application divided according to the functional type of the execution instruction; based on the target section, identify the compilation information of the application in the program file.
[0196] Optionally, the processor may further execute program code of the following steps: determining at least one target address in a target section in a program file, wherein the target address is used to represent an associated address of a function of the application; and determining compilation information based on the target address.
[0197] Optionally, the processor may further execute program code of the following steps: determining an execution instruction of a function corresponding to the target address; and determining the target address and the execution instruction of the function as compilation information.
[0198] Optionally, the processor may also execute the following program code: the target address is written to the initial program file by the linker in the compilation tool based on the function attribute information in the target section to obtain the program file, and the function attribute information is used to call the function of the application.
[0199] Optionally, the processor may also execute the following program code: using compilation information to determine the execution order of the function's execution instructions during the execution process; and determining the execution order of the function's execution instructions during the execution process as the function control flow corresponding to the function.
[0200] The processor may call the information and application program stored in the memory through the transmission device to perform the following steps: removing the target section in the program file.
[0201] The processor can call the information and application stored in the memory through the transmission device to perform the following steps: compile the program code of the application to obtain a program file, wherein the program file includes compilation information of the application, and the compilation information at least records the compilation strategy of the application; input the program file into a file processing tool, wherein the compilation information in the program file is recognized by the file processing tool, and the recognized compilation information is used to enable the file processing tool to construct the control flow of the application, and the control flow is used to represent the execution order of multiple execution instructions of the application during the execution process, and is used to enable the file processing tool to adjust the program file.
[0202] The processor can call the information and application stored in the memory through the transmission device to perform the following steps: control the compiler to compile the program code of the application to obtain compilation information; control the assembler to convert the compilation information to obtain the target section, wherein the target section is used to represent the data in the application divided according to the functional type of the execution instruction. The compilation tools include: a compiler, an assembler and a linker.
[0203] The processor can call the information and application stored in the memory through the transmission device to perform the following steps: control the assembler to convert at least one target address in the compilation information to obtain a target section including the target address and function attribute information, wherein the target address is used to represent the associated address of the function of the application, and the function attribute information is used to call the function of the application.
[0204] The processor can call the information and application stored in the memory through the transmission device to perform the following steps: control the linker to write the target address in the target section into the initial program file based on the function attribute information in the target section to obtain the program file.
[0205] Using the embodiment of the present application, a file processing method for an application is provided. In the embodiment of the present application, if it is necessary to adjust the program file in the application, a file processing tool can be designed. In the file processing tool, the compiled file obtained by compiling the code of the application through the compilation tool can be obtained, and the compilation information that can explain the above-mentioned compilation process of the application can be obtained from the compiled file. The execution order of multiple execution instructions of the application during the execution process, that is, the control flow of the application, can be constructed using the compilation information, and the program file is processed through the constructed control flow. In the above process, since the embodiment of the present application takes into account the many problems that will exist if the compilation information in the process of compilation and binary adjustment cannot be summarized, corresponding compilation information can be set for the program file to make up for the situation where information is lost in the process of compilation, etc., so that in the file processing tool, by identifying the compilation information of the program file, the purpose of more accurately identifying and constructing the control flow is achieved, thereby achieving the technical effect of effectively processing the files of the application, and solving the technical problem of not being able to effectively process the files of the application.
[0206] It can be understood by those skilled in the art that Figure 10 The structure shown is for illustration only, and the computer terminal A may also be a smart phone (such as an Android phone, an iOS phone, etc.), a tablet computer, a PDA, a mobile Internet device (Mobile Internet Devices, abbreviated as MID), a PAD, or other terminal devices. Figure 10 It does not limit the structure of the above-mentioned computer terminal A. For example, the computer terminal A may also include Figure 10 More or fewer components (such as network interfaces, display devices, etc.) shown in, or with Figure 10 Different configurations shown.
[0207] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing the hardware related to the terminal device through a program, and the program can be stored in a computer-readable storage medium, which may include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0208] Example 6
[0209] The embodiment of the present application further provides a computer-readable storage medium. Optionally, in this embodiment, the computer-readable storage medium can be used to store the program code executed by the file processing method of the application provided in the first embodiment.
[0210] Optionally, in this embodiment, the computer-readable storage medium may be located in any computer terminal in a computer terminal group in a computer network, or in any mobile terminal in a mobile terminal group.
[0211] Optionally, in this embodiment, the computer-readable storage medium is configured to store program code for performing the following steps: obtaining a program file of an application, wherein the program file is obtained by compiling the program code of the application by a compilation tool; identifying compilation information of the application from the program file, wherein the compilation information at least records the compilation strategy of the application; using the compilation information, constructing a control flow of the application, wherein the control flow is used to represent the execution order of multiple execution instructions of the application during the execution process; and adjusting the program file using the control flow.
[0212] Optionally, the above-mentioned computer-readable storage medium can also execute the program code of the following steps: determining a target section in a program file, wherein the target section is used to represent data in an application divided according to the functional type of execution instructions; based on the target section, identifying the compilation information of the application in the program file.
[0213] Optionally, the computer-readable storage medium may further execute program code of the following steps: determining at least one target address in a target section in a program file, wherein the target address is used to represent an associated address of a function of an application; and determining compilation information based on the target address.
[0214] Optionally, the computer-readable storage medium may further execute program code for the following steps: determining an execution instruction of a function corresponding to the target address; and determining the target address and the execution instruction of the function as compilation information.
[0215] Optionally, the computer-readable storage medium can also execute the following program code: the target address is written to the initial program file by the linker in the compilation tool based on the function attribute information in the target section to obtain the program file, and the function attribute information is used to call the function of the application.
[0216] Optionally, the computer-readable storage medium may also execute the program code of the following steps: using compilation information to determine the execution order of the function's execution instructions during the execution process; and determining the execution order of the function's execution instructions during the execution process as the function control flow corresponding to the function.
[0217] As an optional example, the computer-readable storage medium is configured to store program code for executing the following steps: removing a target section in a program file.
[0218] As an optional example, a computer-readable storage medium is configured to store program code for performing the following steps: compiling the program code of an application to obtain a program file, wherein the program file includes compilation information of the application, and the compilation information at least records the compilation strategy of the application; inputting the program file into a file processing tool, wherein the compilation information in the program file is recognized by the file processing tool, and the recognized compilation information is used to enable the file processing tool to construct a control flow of the application, and the control flow is used to represent the execution order of multiple execution instructions of the application during the execution process, and is used to enable the file processing tool to adjust the program file.
[0219] As an optional example, a computer-readable storage medium is configured to store program code for performing the following steps: controlling a compiler to compile the program code of an application to obtain compilation information; controlling an assembler to convert the compilation information to obtain a target section, wherein the target section is used to represent data in the application divided according to the functional type of execution instructions, and the compilation tools include: a compiler, an assembler, and a linker.
[0220] As an optional example, a computer-readable storage medium is configured to store program code for performing the following steps: controlling an assembler to convert at least one target address in the compilation information to obtain a target section including a target address and function attribute information, wherein the target address is used to represent an associated address of a function of an application, and the function attribute information is used to call the function of the application.
[0221] As an optional example, the computer-readable storage medium is configured to store program code for executing the following steps: controlling the linker to write the target address in the target section into the initial program file based on the function attribute information in the target section to obtain the program file.
[0222] Example 7
[0223] An embodiment of the present application may provide an electronic device, which may include a memory and a processor.
[0224] Figure 11 1 is a block diagram of an electronic device according to a file processing method of an application program according to an embodiment of the present application. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present application described and / or claimed herein.
[0225] like Figure 11 As shown, the device 1100 includes a computing unit 1101, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 1102 or a computer program loaded from a storage unit 1108 into a random access memory (RAM) 1103. Various programs and data required for the operation of the device 1100 can also be stored in the RAM 1103. The computing unit 1101, the ROM 1102, and the RAM 1103 are connected to each other via a bus 1104. An input / output (I / O) interface 1105 is also connected to the bus 1104.
[0226] Various components in device 1100 are connected to I / O interface 1105, including: an input unit 1106, such as a keyboard, mouse, etc.; an output unit 1104, such as various types of displays, speakers, etc.; a storage unit 1108, such as a magnetic disk, optical disk, etc.; and a communication unit 1109, such as a network card, modem, wireless communication transceiver, etc. The communication unit 1109 allows device 1100 to exchange information / data with other devices via a computer network such as the Internet and / or various telecommunication networks.
[0227] The computing unit 1101 can be a variety of general-purpose and / or specialized processing components with processing and computing capabilities. Some examples of the computing unit 1101 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units that run machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The computing unit 1101 performs the various methods and processes described above, such as the file processing method of the application. For example, in some embodiments, the file processing method of the application can be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as the storage unit 1108. In some embodiments, part or all of the computer program can be loaded and / or installed on the device 1100 via the ROM 1102 and / or the communication unit 1109. When the computer program is loaded into the RAM 1103 and executed by the computing unit 1101, one or more steps of the file processing method of the application described above can be performed. Alternatively, in other embodiments, the computing unit 1101 may be configured to execute the file processing method of the application program in any other appropriate manner (for example, by means of firmware).
[0228] Example 8
[0229] The embodiment of the present application further provides a computer program product. Optionally, in this embodiment, the computer program product may include a computer program, which, when executed by a processor, implements the file processing method of the application program of the embodiment of the present application.
[0230] Various embodiments of the systems and techniques described herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard parts (ASSPs), system-on-a-chip (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include being implemented in one or more computer programs that are executable and / or interpreted on a programmable system that includes at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0231] The program code for implementing the methods of the present application can be written in any combination of one or more programming languages. Such program code can be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device so that when the program code is executed by the processor or controller, the functions / operations specified in the flow charts and / or block diagrams are implemented. The program code can be executed entirely on the machine, partially on the machine, as a stand-alone software package, partially on the machine and partially on a remote machine, or entirely on a remote machine or server.
[0232] Various embodiments of the systems and techniques described above can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), system-on-chip systems (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include being implemented in one or more computer programs that are executable and / or interpreted on a programmable system that includes at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0233] The program code for implementing the methods of the present application can be written in any combination of one or more programming languages. Such program code can be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device so that when the program code is executed by the processor or controller, the functions / operations specified in the flow charts and / or block diagrams are implemented. The program code can be executed entirely on the machine, partially on the machine, as a stand-alone software package, partially on the machine and partially on a remote machine, or entirely on a remote machine or server.
[0234] In the context of the present application, a machine-readable medium can be a tangible medium that can contain or store a program for use by or in conjunction with an instruction execution system, device or equipment. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium can include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0235] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a cathode ray tube (CRT) or a liquid crystal display (LCD)) for displaying information to the user, a monitor; and a keyboard and pointing device (e.g., a mouse or a trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0236] The systems and techniques described herein can be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network (LAN), a wide area network (WAN), and the Internet.
[0237] A computer system may include a client and a server. The client and server are generally remote from each other and typically interact through a communication network. The client-server relationship arises through computer programs running on the respective computers and having a client-server relationship with each other. The server may be a cloud server, a server in a distributed system, or a server integrated with a blockchain.
[0238] It should be noted that the serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0239] In the above embodiments of the present application, the description of each embodiment has its own focus. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.
[0240] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.
[0241] Units described as separate components may or may not be physically separate, and components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.
[0242] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.
[0243] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, server or network device, etc.) to execute all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes various media that can store program codes, such as a USB flash drive, a read-only memory, a random access memory, a mobile hard disk, a magnetic disk or an optical disk.
[0244] The above is only a preferred embodiment of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.
Claims
1. A file processing method for an application, characterized in that: Applicable to file processing tools, including: Obtaining a program file of an application, wherein the program file is obtained by compiling a program code of the application using a compilation tool; Identifying compilation information of the application from the program file, wherein the compilation information at least records a compilation strategy of the application; Using the compilation information, constructing a control flow of the application, wherein the control flow is used to represent the execution order of multiple execution instructions of the application during execution; The program file is adjusted using the control flow.
2. The method according to claim 1, characterized in that Identifying compilation information of the application from the program file includes: Determining a target section in the program file, wherein the target section is used to represent data in the application program divided according to the functional type of the execution instruction; The compilation information of the application is identified in the program file based on the target section.
3. The method according to claim 2, characterized in that Based on the target section, identifying the compilation information of the application in the program file includes: In the program file, determining at least one target address in the target section, wherein the target address is used to represent an associated address of a function of the application program; The compilation information is determined based on the target address.
4. The method according to claim 3, characterized in that Determining the compilation information based on the target address includes: Determining the execution instruction of the function corresponding to the target address; The target address and the execution instruction of the function are determined as the compilation information.
5. The method according to claim 3, characterized in that The target address is written into the initial program file by the linker in the compilation tool based on the function attribute information in the target section to obtain the program file, and the function attribute information is used to call the function of the application.
6. The method according to claim 3, characterized in that Using the compilation information, constructing the control flow of the application program includes: Determining, by using the compilation information, an execution order of the execution instructions of the function during the execution process; The execution order of the execution instructions of the function in the execution process is determined as the function control flow corresponding to the function.
7. The method according to claim 2, characterized in that After determining at least one target address in the target section, the method further includes: Remove the target section in the program file.
8. A file processing method for an application, characterized in that: Applicable to compilation tools, including: Compiling the program code of the application to obtain a program file, wherein the program file includes compilation information of the application, and the compilation information at least records a compilation strategy of the application; The program file is input into a file processing tool, wherein the compilation information in the program file is recognized by the file processing tool, and the recognized compilation information is used to enable the file processing tool to construct a control flow of the application, and the control flow is used to represent the execution order of multiple execution instructions of the application during the execution process, and is used to enable the file processing tool to adjust the program file.
9. The method according to claim 8, characterized in that The compilation tool includes: a compiler, an assembler and a linker, wherein the program code of the application is compiled to obtain a program file, including: Controlling the compiler to compile the program code of the application to obtain the compilation information; controlling the assembler to convert the compilation information to obtain a target section, wherein the target section is used to represent data in the application program divided according to the functional type of the execution instruction; The linker is controlled to write the target section into an initial program file to obtain the program file.
10. The method according to claim 9, characterized in that Controlling the assembler to convert the compilation information to obtain a target section includes: The assembler is controlled to convert at least one target address in the compilation information to obtain the target section including the target address and function attribute information, wherein the target address is used to represent the associated address of the function of the application, and the function attribute information is used to call the function of the application.
11. The method according to claim 10, characterized in that Controlling the linker to write the target section into an initial program file to obtain the program file includes: The linker is controlled to write the target address in the target section into the initial program file based on the function attribute information in the target section to obtain the program file.
12. A file processing system for an application, characterized in that: include: A compilation tool, configured to compile the program code of the application to obtain a program file, wherein the program file includes compilation information of the application, and the compilation information at least records a compilation strategy of the application; A file processing tool is used to identify the compilation information from the program file; use the compilation information to construct the control flow of the application, wherein the control flow is used to represent the execution order of multiple execution instructions of the application during the execution process; and use the control flow to adjust the program file.
13. The system according to claim 12, wherein: The compilation tool includes: A compiler, configured to compile the program code of the application to obtain the compilation information; An assembler, configured to convert the compilation information to obtain a target section, wherein the target section is used to represent data in the application program divided according to the functional type of the execution instruction; A linker is used for writing the target section into an initial program file to obtain the program file.
14. An electronic device, characterized in that: include: a memory storing an executable program; A processor, configured to run the program, wherein the program executes the method according to any one of claims 1 to 11 when running.
15. A computer-readable storage medium, characterized in that The computer-readable storage medium includes a stored program, wherein when the program is executed, the device where the storage medium is located is controlled to execute the method according to any one of claims 1 to 11.
16. A computer program product, characterized in that The method comprises computer instructions, which implement the method according to any one of claims 1 to 11 when executed by a processor.