Binary file linking method and device, equipment, storage medium and program product
By forcibly ending the unfinished link command during the software compilation process, obtaining the file path, copying the file to a temporary folder, and performing link operations on the remote link server, the problem of high time consumption in the linking stage is solved, and the effect of improving compilation efficiency is achieved.
Patent Information
- Application Number
- CN202510216649.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-26
- Publication Date
- 2025-03-28
- Estimated Expiration
- 2045-02-26
AI Technical Summary
During the software compilation process, the resource and time consumed in the linking stage account for an increasing proportion, and how to reduce the time consumed in the linking stage has become an urgent problem.
By forcibly ending the unfinished link command, obtain the file path of the participating link, copy the file to the temporary folder, and modify the link command and file path in the remote link server environment to perform link operations, and finally receive the link results.
Linking operations through remote linking servers can greatly reduce the time consumed by linking and improve compilation efficiency.
Smart Images

Figure CN119718334A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of software compilation technology, and in particular to a binary file linking method, device, equipment, storage medium and program product. Background Art
[0002] Due to the rapid development of emerging instruction set architectures and the rapid evolution of instruction architectures themselves, instruction set standards often precede the launch of high-performance hardware. With the development of binary optimization technologies such as link-time optimization, the resources and time consumed by the link stage in the software compilation process account for an increasing proportion. How to reduce the time consumed in the link stage has become an urgent problem to be solved. Summary of the invention
[0003] The embodiments of the present invention provide a binary file linking method, apparatus, device, storage medium and program product, which are used to reduce the time consumed in the linking stage during the software compilation process and improve the linking efficiency.
[0004] In a first aspect, an embodiment of the present invention provides a method for linking binary files, comprising: if a link command is not completed within a time limit, forcibly ending the running of the link command, obtaining the respective paths of all files participating in the link; copying all the files participating in the link to a temporary folder according to their respective paths; based on the environment of a remote link server, modifying the link command, sending the modified link command and the temporary folder to the remote link server, so that the remote link server performs a link operation based on the modified link command and the temporary folder to obtain a link result; and receiving the link result sent by the remote link server.
[0005] In some embodiments, the link command uses a detailed output option; obtaining the paths of all files participating in the link includes: obtaining output content corresponding to the link command; and obtaining the paths of all files participating in the link based on the output content.
[0006] As a possible implementation manner, obtaining the respective paths of all the files participating in the linking based on the output content includes: obtaining the respective paths of all the linked files based on the output content; obtaining the paths of the files involved in the additional processing during the linking process based on the output content; and determining all the linked files and the files involved in the additional processing as all the files participating in the linking.
[0007] In some embodiments, before sending the modified link command and the temporary folder to the remote link server, it also includes: modifying the file path involved in the file content of the link script file in the temporary folder to the file path corresponding to the temporary folder.
[0008] In some embodiments, the link command is modified based on the environment of the remote link server, including: modifying the linker in the link command to the linker of the remote link server; modifying the paths of the input file and the output file in the link command to the file paths corresponding to the temporary folder.
[0009] In some embodiments, after receiving the link result sent by the remote link server, the method further includes: if the link result is a link failure, re-executing the link command.
[0010] In a second aspect, an embodiment of the present invention provides a binary file linking device, comprising: an acquisition module, used to force the end of the operation of the link command if the link command is not completed within a time limit, and obtain the respective paths of all files participating in the link; a copy module, used to copy all the files participating in the link to a temporary folder according to their respective paths; a sending module, used to modify the link command based on the environment of the remote link server, and send the modified link command and the temporary folder to the remote link server, so that the remote link server performs a link operation based on the modified link command and the temporary folder to obtain a link result; a receiving module, used to receive the link result sent by the remote link server.
[0011] In a third aspect, an embodiment of the present invention provides an electronic device, comprising a processor and a memory storing a computer program, wherein when the processor executes the program, the method for linking binary files described in the first aspect is implemented.
[0012] In a fourth aspect, an embodiment of the present invention provides a non-transitory computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the binary file linking method described in the first aspect.
[0013] In a fifth aspect, an embodiment of the present invention provides a computer program product, including a computer program, which, when executed by a processor, implements the binary file linking method described in the first aspect.
[0014] The link binary file method, device, equipment, storage medium and program product provided by the embodiment of the present invention, if the link command is not completed within the time limit, the operation of the link command is forcibly terminated, and the paths of all files participating in the link are obtained; all files participating in the link are copied to a temporary folder according to their respective paths; based on the environment of the remote link server, the link command is modified, and the modified link command and the temporary folder are sent to the remote link server, so that the remote link server performs a link operation based on the modified link command and the temporary folder to obtain a link result; and the link result sent by the remote link server is received. The present invention performs a link operation through the remote link server, which can greatly reduce the time consumed by the link and improve the compilation efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0016] Figure 1 One of the flowcharts of the binary file linking method provided by the embodiment of the present invention; Figure 2 A second flowchart of a method for linking binary files provided by an embodiment of the present invention; Figure 3 A schematic diagram of the structure of a binary file linking device provided by an embodiment of the present invention; Figure 4 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0017] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are 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 ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0018] It should be noted that the representative compilation process can be divided into four steps: preprocessing, compilation, assembly and linking. Existing distributed compilation systems such as distcc and sccache provide distributed support for the three stages of preprocessing, compilation and assembly. They can call remote compilers for compilation based on local code, which greatly improves the compilation speed. If the performance of the remote machine is better than that of the local machine, performance can be improved; if there are many tasks that need to be compiled, multiple machines can be called for compilation at the same time to improve the parallelism of software compilation.
[0019] However, existing distributed compilation systems such as distcc and sccache do not support distributed linking. However, with the widespread use of technologies such as link-time optimization, it is no longer enough to simply distribute the preprocessing, compilation, and assembly stages. The use of link-time optimization consumes a lot of memory. For machines with low configuration (such as memory less than 16G), there will be a problem of insufficient memory for link-time operations. In addition, the use of link-time optimization requires a lot of CPU (Central Processing Unit) computing power, which will take a lot of time for devices with insufficient single-core performance.
[0020] In order to solve the above problems, embodiments of the present invention provide a binary file linking method, apparatus, device, storage medium and program product.
[0021] Figure 1 The following is a flow chart of a method for linking binary files provided by an embodiment of the present invention. Figure 1 As shown, the method may include the following steps: Step 101: If the link command is not completed within the time limit, the link command is forced to end its execution, and the paths of all files involved in the link are obtained.
[0022] In some embodiments, the method can be performed by a computer device for compiling software, and in response to a link command, a local linker performs a link operation based on the link command. The link command includes relevant information such as linker information, input file path, output file path, etc. The link command can be input by a user or generated by a compiler in the computer device.
[0023] As a possible implementation, a time threshold can be set when executing a link command. If the link command is executed within the time threshold, the link result of the local linker is output. If the link command is not completed within the time threshold, the link command is forcibly terminated and the paths of all files involved in the link are obtained. The paths of all files involved in the link can be obtained based on the log data related to the files during the link process.
[0024] The time threshold may be preset or dynamically adjusted based on actual operation. As an example, the time threshold may be set to 10 seconds. As another example, the time threshold may be set to a specific time after the linker no longer outputs a log file. For example, the time threshold may be set to 1 second after the linker no longer outputs a log file.
[0025] All files involved in linking refer to all files involved in the linking operation based on linking instructions, which may include compiled target files, linking script files, dynamic library files, static library files, etc. It should be noted that all files involved in linking include not only the files involved in the linking instructions, but also the files that need to be determined by symbol resolution, relocation, etc. during the linking process.
[0026] Step 102, copy all files involved in the link to a temporary folder according to their respective paths.
[0027] That is to say, when copying all the files involved in the link to the temporary folder, you need to keep the original paths of all the files involved in the link.
[0028] As an example, create a temporary folder / tmp / tmp-dir. If the path of a file involved in the link is / tmp / build-xx / xx.o, the path after the file is copied to the temporary folder is / tmp / tmp-dir / / tmp / build-xx / xx.o.
[0029] Step 103, based on the environment of the remote link server, modify the link command, and send the modified link command and the temporary folder to the remote link server, so that the remote link server performs a link operation based on the modified link command and the temporary folder to obtain a link result.
[0030] In some embodiments of the present invention, for link commands that are not completed within the time limit, a link operation can be performed through a remote link server. The remote link server is equipped with a linker program, and the remote link server can be a computer device with larger memory, better single-core performance, and better input and output performance than a local computer device. By remotely calling the linker of the remote link server, the linker of the local computer device is replaced to accelerate the link operation, greatly reducing the time consumed in the link stage.
[0031] After receiving the modified link command and the temporary folder, the remote link server executes the modified link command based on the temporary folder to perform the link operation and returns the obtained link result. In some embodiments, the remote link server stores according to the path of the temporary folder. For example, the path of the temporary folder on the local computer device is / tmp / tmp-dir, and the path of the temporary folder of the remote link server is also / tmp / tmp-dir.
[0032] In order to make the link command sent to the remote link server conform to the environment of the remote link server, the link command needs to be modified. As a possible implementation method, based on the environment of the remote link server, modifying the link command includes: modifying the linker in the link command to the linker of the remote link server; modifying the paths of the input file and the output file in the link command to the file paths corresponding to the temporary folder.
[0033] It can be understood that since the remote link server performs link operations based on the files in the temporary folder, and the file path in the temporary folder is different from the initial file path, in order for the remote link server to execute the link command, the input file path and output file path in the link command need to be modified to the file path corresponding to the temporary folder.
[0034] As an example, modifying the linker in the link command to the linker of the remote link server includes: changing the path of the linker in the link command to the linker path on the remote link server; if the instruction set architecture of the local computer device is different from that of the remote link server, then changing the linker path in the link command to the cross-linker path on the remote link server, and adding architecture-related options; if the linker path in the link command is changed to the cross-linker path on the remote link server, the path of the linker plug-in in the link command can also be modified to the path of the cross-linker related plug-in. Among them, the linker path of the remote link server can be preset or obtained through communication with the remote link server.
[0035] In some embodiments, the link script file in the temporary folder will involve the paths of many referenced files. Since the path of each file has changed after the file is copied to the temporary folder, it is also necessary to modify the file path involved in the file content of the link script file. As a possible implementation method, before sending the modified link command and the temporary folder to the remote link server, it can also include: modifying the file path involved in the file content of the link script file in the temporary folder to the file path corresponding to the temporary folder. It should be noted that the file path involved in the link script will have an actual path and a relative path. During the modification process, it is only necessary to modify the actual path in the file content to the file path corresponding to the temporary folder, and there is no need to modify the relative path.
[0036] In some embodiments, the temporary folder can also be packaged and compressed according to an appropriate compression level, and the compressed package can be sent to the remote link server; after receiving the compressed package, the remote link server decompresses the compressed package to a temporary folder, and the path of the temporary folder is consistent with the path of the temporary folder of the local computer device; based on the obtained temporary folder, the modified link command is executed, if the link is successful, the executable file obtained by the link is returned to the local computer device, if the link fails, the output and error code of the linker can be returned to the local computer device.
[0037] It should be noted that when the modified link command and temporary folder are sent to the remote link server, the local working path will also be sent to the remote link server. After the remote link server decompresses the compressed package to the temporary file, it first switches the working path based on the received local working path, and then executes the modified link command. For example, if the local working path is tmp / build-xx and the temporary folder of the server is / tmp / tmp-dir, the remote link server will switch the working path to / tmp / tmp-dir / tmp / build-xx.
[0038] Step 104: Receive the link result sent by the remote link server.
[0039] In some embodiments, if the link result is an executable file obtained after the link is successful, the link result is directly output. If the link result is a link failure, the above link command can be re-executed.
[0040] In some embodiments, the temporary folder and the link command can also be directly sent to the remote link server, and the remote link server will execute the modification of the file path referenced by the file content of the link script file in the temporary folder, as well as the modification of the link command. As an example, the remote link server first decompresses the compressed package to a temporary folder, and modifies the actual file path involved in the file content of the link script file in the temporary folder of the remote link server to the file path corresponding to the temporary folder; modifies the linker in the link command to the linker of the remote link server, and modifies the paths of the input and output files in the link command to the file paths corresponding to the temporary folder.
[0041] According to the binary file linking method of the embodiment of the present invention, if the link command is not completed within the time limit, the link command is forced to end its operation, and the paths of all files participating in the link are obtained; all files participating in the link are copied to a temporary folder according to their respective paths; based on the environment of the remote link server, the link command is modified, and the modified link command and the temporary folder are sent to the remote link server, so that the remote link server performs a link operation based on the modified link command and the temporary folder to obtain a link result; and the link result sent by the remote link server is received. The present invention performs a link operation through a remote link server, which can greatly reduce the time consumed by the link and improve the efficiency of the link stage.
[0042] At present, mainstream linkers all provide a verbose option, which can list all files involved in the link at the initial stage of the link command execution. Therefore, the link command in the embodiment of the present invention can be a link command that has used the verbose option.
[0043] Figure 2 The second flowchart of the method for linking binary files provided by the embodiment of the present invention is as follows. Figure 2 As shown, based on the above embodiments, Figure 1 In step 101, the paths of all files involved in the link are obtained, including the following steps: Step 201, obtaining output content corresponding to the link command.
[0044] Step 202: Based on the output content, obtain the paths of all files involved in the link.
[0045] In the embodiment of the present invention, the linker has added a verbose option, so the output content corresponding to the link command will list all the files participating in the link. Therefore, the paths of all the files participating in the link can be obtained based on the output content.
[0046] The output content corresponding to the link command can include all target object files (usually .o files under Linux), link script files, system static library files, system dynamic library files, local static library files and local dynamic library files. It should be noted that during the link process, if the file is a soft link file, the file linked to by the soft link file is also a file participating in the link; if the file is a thin static library file, the target file referenced by the thin static library file is also a file participating in the link.
[0047] Specifically, based on the output content, the implementation process of obtaining the paths of all files involved in the link may include: based on the output content, obtaining the paths of all linked files; based on the output content, obtaining the paths of files involved in the additional processing during the link process; and determining all linked files and files involved in the additional processing as all files involved in the link. Among them, the additional processing during the link process may be relocation, symbol resolution, and the like, and the linked files may be files included in the link command, that is, files that do not require additional processing. For example, if a file is a soft link file, it is necessary to obtain the file it links to, and the file it links to is a file involved in the additional processing; if a file is a thin static library file, it is necessary to obtain the target file it references, and the target file is also a file involved in the additional processing.
[0048] According to the binary file linking method of an embodiment of the present invention, by adding a detailed output option, the paths of all files participating in the link can be efficiently obtained directly based on the output content corresponding to the link command, and file omissions can be avoided to ensure smooth remote link processing.
[0049] Next, the binary file linking method of this embodiment is verified by using the SSH (Secure Shell, a security protocol for network communication) protocol to transfer commands and files and link the cc1 file in GCC (a programming language compiler developed by the GNU project). During the compilation of the GCC software package of openEuler 24.03 LTS (an open source Linux operating system), it takes about 10 minutes to link the cc1 file if it is on SG2042; it takes about 3 minutes to transfer commands and files through the SSH protocol and use AMD Ryzen 9950X for remote linking; it takes about 1 minute to execute the link command on the server. The details are as follows: The link wrapper is written in Python 3.11 with subprocess, paramiko and other libraries. On the local side, add the verbose option and try to execute the link command with a time limit of 10 seconds. If the link command cannot be completed within 10 seconds, the link command will be forcibly stopped. The output content corresponding to the link command is as follows: "attempt to open / lib64 / .. / lib64 / crt1.o succeeded attempt to open c / c-lang.o succeeded attempt to open / lib64 / .. / lib64 / libc.so succeeded opened script file / lib64 / .. / lib64 / libc.so / lib64 / .. / lib64 / libc.so opened script file / lib64 / .. / lib64 / libc.so attempt to open / lib64 / lp64d / libc.so.6 succeeded attempt to open / lib64 / .. / lib64 / libm.so succeeded attempt to open / usr / lib / gcc / riscv64-openEuler-linux / 12 / libgcc.asucceeded / usr / lib / gcc / riscv64-openEuler-linux / 12 / libgcc.a ( / usr / lib / gcc / riscv64-openEuler-linux / 12 / libgcc.a)_ffssi2.o ( / usr / lib / gcc / riscv64-openEuler-linux / 12 / libgcc.a)_clz.o etc." Analyze the above output content and get the paths of all files involved in the link, including: / lib64 / .. / lib64 / crt1.o c / c-lang.o / lib64 / .. / lib64 / libc.so / lib64 / lp64d / libc.so.6 / lib64 / .. / lib64 / libm.so / usr / lib / gcc / riscv64-openEuler-linux / 12 / libgcc.a / usr / lib / gcc / riscv64-openEuler-linux / 12 / libgcc.a_ffssi2.o / usr / lib / gcc / riscv64-openEuler-linux / 12 / libgcc.a_clz.o.
[0050] Among them, / lib64 / .. / lib64 / libm.so is a soft link file, and its link target is / lib64 / .. / lib64 / libm.so.6. Therefore, / lib64 / .. / lib64 / libm.so.6 is also a file involved in the link.
[0051] Copy these files to a randomly generated temporary folder. Assume that the temporary folder is / tmp / tmp-dir. Modify the file paths involved in the file contents of the link script files in the temporary folder. For example, / lib64 / .. / lib64 / libc.so is a link script file, which contains / lib64 / lp64d / libc.so.6, / usr / lib64 / lp64d / libc_nonshared.a, / lib / ld-linux-riscv64-lp64d.so.1, etc. Then add / tmp / tmp-dir in front of these paths. The modified paths are as follows: / tmp / tmp-dir / lib64 / lp64d / libc.so.6 / tmp / tmp-dir / usr / lib64 / lp64d / libc_nonshared.a / tmp / tmp-dir / lib / ld-linux-riscv64-lp64d.so.1 The temporary folder / tmp / tmp-dir is packaged and compressed into / tmp / tmp-dir.tar.gz, and transferred to the / tmp folder of the remote link server. At the same time, the remote link server is informed that the local current working path is / root / rpmbuild / BUILD / gcc-12.3.0 / obj-riscv64-openEuler-linux / gcc. The remote link server unzips / tmp / tmp-dir.tar.gz to the folder / tmp / tmp-dir. The remote link server modifies the working path to / tmp / tmp-dir / root / rpmbuild / BUILD / gcc-12.3.0 / obj-riscv64-openEuler-linux / gcc.
[0052] Based on the environment of the remote link server, modify the link command locally, change the linker in the link command to the linker of the remote link server; change the input file path and output file path in the link command to the file path corresponding to the temporary folder. The remote link server executes the modified link command and returns the result after execution.
[0053] Next, the binary file linking device provided by the present invention will be introduced.
[0054] Figure 3 The structure diagram of the binary file linking device provided by the embodiment of the present invention is shown in FIG. Figure 3 As shown, the device includes: an acquisition module 310, a copy module 320, a sending module 330 and a receiving module 340. The acquisition module 310 is used to force the end of the link command if the link command is not completed within the time limit, and obtain the paths of all the files participating in the link; the copy module 320 is used to copy all the files participating in the link to a temporary folder according to their respective paths; the sending module 330 is used to modify the link command based on the environment of the remote link server, and send the modified link command and the temporary folder to the remote link server, so that the remote link server performs the link operation based on the modified link command and the temporary folder to obtain the link result; the receiving module 340 is used to receive the link result sent by the remote link server.
[0055] In some embodiments, the link command uses a detailed output option, and the acquisition module 310 is specifically used to: acquire the output content corresponding to the link command; and based on the output content, obtain the paths of all files participating in the link.
[0056] As a possible implementation method, the acquisition module 310 is also used to: obtain the respective paths of all linked files based on the output content; obtain the paths of files involved in additional processing during the linking process based on the output content; and determine all linked files and files involved in additional processing as all files participating in the linking.
[0057] In some embodiments, the sending module 330 is also used to modify the file path involved in the file content of the link script file in the temporary folder to the file path corresponding to the temporary folder before sending the modified link command and the temporary folder to the remote link server.
[0058] In some embodiments, the sending module 330 is further used to: modify the linker in the link command to the linker of the remote link server; modify the paths of the input file and the output file in the link command to the file paths corresponding to the temporary folder.
[0059] In some embodiments, the receiving module 340 is further used to: if the link result is link failure, re-execute the link command.
[0060] It should be noted that the explanation of the binary file linking method in the above embodiment is also applicable to the binary file linking device in the embodiment of the present invention, and will not be repeated here.
[0061] According to the binary file linking device of the embodiment of the present invention, the acquisition module is used to force the end of the link command if the link command is not completed within the time limit, and obtain the paths of all the files participating in the link; the copy module is used to copy all the files participating in the link to the temporary folder according to their respective paths; the sending module is used to modify the link command based on the environment of the remote link server, and send the modified link command and the temporary folder to the remote link server, so that the remote link server performs the link operation based on the modified link command and the temporary folder to obtain the link result; the receiving module is used to receive the link result sent by the remote link server. The present invention performs the link operation through the remote link server, which can greatly reduce the time consumed by the link and improve the compilation efficiency.
[0062] Figure 4 An example of a physical structure diagram of an electronic device is shown in FIG. Figure 4As shown, the electronic device may include: a processor 410, a communication interface 420, a memory 430 and a communication bus 440, wherein the processor 410, the communication interface 420 and the memory 430 communicate with each other through the communication bus 440. The processor 410 may call a computer program in the memory 430 to execute the steps of the binary file linking method provided in the above embodiments.
[0063] Specifically, it includes: if the link command is not completed within the time limit, forcibly end the running of the link command, obtain the respective paths of all files involved in the link; copy all files involved in the link to a temporary folder according to their respective paths; based on the environment of the remote link server, modify the link command, and send the modified link command and temporary folder to the remote link server, so that the remote link server performs a link operation based on the modified link command and temporary folder to obtain a link result; receive the link result sent by the remote link server.
[0064] In addition, the logic instructions in the above-mentioned memory 430 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.
[0065] On the other hand, the present invention also provides a computer program product, which includes a computer program. The computer program can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the binary file linking method provided by the above-mentioned embodiments, and the method includes: if the link command is not completed within the time limit, forcibly end the operation of the link command, and obtain the respective paths of all files participating in the link; copy all files participating in the link to a temporary folder according to their respective paths; based on the environment of the remote link server, modify the link command, and send the modified link command and the temporary folder to the remote link server, so that the remote link server performs a link operation based on the modified link command and the temporary folder to obtain a link result; receive the link result sent by the remote link server.
[0066] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, it is implemented to execute the binary file linking method provided by the above-mentioned methods. The method includes: if the link command is not completed within the time limit, forcibly ending the operation of the link command, and obtaining the respective paths of all files participating in the link; copying all files participating in the link to a temporary folder according to their respective paths; based on the environment of the remote link server, modifying the link command, and sending the modified link command and the temporary folder to the remote link server, so that the remote link server performs a link operation based on the modified link command and the temporary folder to obtain a link result; and receiving the link result sent by the remote link server.
[0067] The non-transitory computer-readable storage medium can be any available medium or data storage device that can be accessed by the processor, including but not limited to magnetic storage (such as floppy disks, hard disks, magnetic tapes, magneto-optical disks (MO), etc.), optical storage (such as CD, DVD, BD, HVD, etc.), and semiconductor storage (such as ROM, EPROM, EEPROM, NAND FLASH, solid-state drives (SSD)), etc.
[0068] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0069] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0070] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for linking binary files, characterized in that: include: If the link command is not completed within the time limit, the execution of the link command is forcibly terminated, and the paths of all files involved in the link are obtained; Copy all the files involved in the link to a temporary folder according to their respective paths; Based on the environment of the remote link server, modify the link command, and send the modified link command and the temporary folder to the remote link server, so that the remote link server performs a link operation based on the modified link command and the temporary folder to obtain a link result; Receive the link result sent by the remote link server.
2. The method according to claim 1, characterized in that The link command uses a detailed output option; the path of each file involved in the link is obtained, including: Obtain output content corresponding to the link command; Based on the output content, respective paths of all the files participating in the link are obtained.
3. The method according to claim 2, characterized in that The obtaining, based on the output content, respective paths of all files participating in the linking includes: Based on the output content, obtaining respective paths of all linked files; Based on the output content, obtaining the path of the file involved in the additional processing during the linking process; All the linked files and the files involved in the additional processing are determined as all the files participating in the linking.
4. The method according to claim 1, characterized in that: Before sending the modified link command and the temporary folder to the remote link server, the method further includes: The file path involved in the file content of the link script file in the temporary folder is modified to the file path corresponding to the temporary folder.
5. The method according to claim 1, characterized in that The modifying of the link command based on the environment of the remote link server includes: Modify the linker in the link command to the linker of the remote link server; The paths of the input file and the output file in the link command are modified to the file paths corresponding to the temporary folder.
6. The method according to any one of claims 1 to 5, characterized in that After receiving the link result sent by the remote link server, the method further includes: If the link result is link failure, re-execute the link command.
7. A binary file linking device, characterized in that: include: The acquisition module is used to force the execution of the link command to end if the link command is not completed within the time limit, and to acquire the paths of all files involved in the link; A copy module, used for copying all the files involved in the link to a temporary folder according to their respective paths; A sending module, used for modifying the link command based on the environment of the remote link server, and sending the modified link command and the temporary folder to the remote link server, so that the remote link server performs a link operation based on the modified link command and the temporary folder to obtain a link result; The receiving module is used to receive the link result sent by the remote link server.
8. An electronic device comprising a processor and a memory storing a computer program, characterized in that: When the processor executes the computer program, the method for linking binary files according to any one of claims 1 to 6 is implemented.
9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method for linking binary files according to any one of claims 1 to 6 is implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the method for linking binary files according to any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
QOS based binary translation and application streaming
CN104050007A
Asynchronous data uploading processing method and system
CN107071058A
Compiler-based data processing method and device and readable storage medium
CN114489653A
Limited system-oriented binary code translation service system and method based on client / server architecture
CN115718642A
Distributed compiling method and device, electronic equipment and storage medium
CN119473308A