Dynamic library layout adjustment method and related equipment

By determining the first symbol and its reference relationship used by the executable files in the dynamic library and configuring the layout adjustment strategy, the problem of redundant symbols in the dynamic library miniaturization process is solved, and more efficient software miniaturization is achieved.

CN119536735APending Publication Date: 2025-02-28HUAWEI TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311134310.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-08-31
Publication Date
2025-02-28

AI Technical Summary

Technical Problem

When performing miniaturization of dynamic libraries in the prior art, although useless code can be deleted through the gc-sections function, redundant symbols still exist, resulting in low returns on miniaturization of software.

Method used

By determining the first symbol used by the executable of the software package in the dynamic library and its reference relationship, configuring the layout adjustment strategy of the dynamic library, deleting or splitting unnecessary symbols in the dynamic library, to achieve miniaturization.

Benefits of technology

Accurately identify the symbol usage of executable files on dynamic libraries, avoid redundant symbols, improve the benefits of software miniaturization, and will not affect the normal operation of executable files.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 00000000_0000_ABST
    Figure 00000000_0000_ABST
Patent Text Reader

Abstract

The invention discloses a dynamic library layout adjustment method and related equipment, which are applied to a miniaturized processing scene of a dynamic library. The method comprises the steps that a first symbol used by an executable file of a software package in a dynamic library is determined, a reference relation of the first symbol is obtained, and the reference relation indicates a second symbol which needs to be used in association with the first symbol in the dynamic library; and configuring a layout adjustment strategy of the dynamic library based on the reference relationship, wherein the layout adjustment strategy is used for performing miniaturization processing on the dynamic library, and performing link operation on the dynamic library again based on the layout adjustment strategy. According to the method and the device, the symbols required by the executable file during operation can be accurately identified through the reference relationship of the first symbols, so that the dynamic library can be miniaturized on the basis of the unrequired symbols of the executable file, redundant symbols in the dynamic library are avoided, the software volume can be reduced as much as possible, and the optimization benefit can be improved as much as possible.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a dynamic library layout adjustment method and related equipment. Background Art

[0002] At present, software development widely adopts the mode of combining executable files with dynamic libraries. With the rapid development of software applications, dynamic libraries need to support more and more applications, which rapidly expands in complexity and program size. However, for some specific software packages, only a small part of the symbolic interface provided by the dynamic library is often needed, and unused symbols cause a waste of storage resources. In this case, the dynamic library can be miniaturized.

[0003] One of the current technologies for software miniaturization is to optimize the compilation and linking process. For example, in the linking stage, the gc-sections function is used to delete useless code. Specifically, the global symbols and the specified entry symbols in the dynamic library are first used as entry symbols, and then according to the reference relationship between the symbols, the symbols that cannot be reached through the entry symbols are regarded as useless symbols, and the useless symbols are deleted, thereby reducing the software size and saving storage resources.

[0004] Although optimization through the gc-sections function can achieve software miniaturization, the global symbols of the dynamic library are retained as entry symbols during the optimization process, and some of the global symbols are still not needed. In other words, the code in the dynamic library is still redundant, the reduction in software size is limited, and the benefits of software miniaturization are low. Summary of the invention

[0005] The present application provides a dynamic library layout adjustment method and related equipment, which can improve the benefits of miniaturizing the dynamic library.

[0006] A first aspect of the present application provides a dynamic library layout adjustment method, which can be applied to a dynamic library layout adjustment device, the method comprising: determining a first symbol used by an executable file of a software package in a dynamic library; obtaining a reference relationship of the first symbol, the reference relationship indicating a second symbol associated with the first symbol in the dynamic library; configuring a layout adjustment strategy of the dynamic library based on the reference relationship, the layout adjustment strategy being used to miniaturize the dynamic library; and re-linking the dynamic library based on the layout adjustment strategy.

[0007] The software package includes an executable file and a dynamic library, wherein both the executable file and the dynamic library can be multiple. The executable file can call the corresponding relocatable target file through the symbol in the dynamic library. The dynamic library layout adjustment device scans the software package to confirm which symbols in the dynamic library are used by each executable file in the software package, thereby determining the first symbol used by the entire executable file in the dynamic library.

[0008] The dynamic library layout adjustment device obtains the mutual reference relationship between all symbols in the dynamic library, and then confirms the reference relationship of the first symbol based on the mutual reference relationship between all symbols in the dynamic library. The reference relationship of the first symbol indicates the second symbol that needs to be used in association with the first symbol. Specifically, based on the symbols used by a single executable file and the mutual reference relationship between the symbols, the symbol reference relationship of a single executable file is obtained. The symbol reference relationship of each executable file is obtained in turn, thereby obtaining the reference relationship of the first symbol used by the entire executable file. The first symbol and the second symbol that has a reference relationship with the first symbol are the symbols required by the executable file in the dynamic library.

[0009] It is understandable that the mutual reference relationship between all symbols in the dynamic library may be obtained before determining the first symbol used by the executable file, or after determining the first symbol, which is not specifically limited here.

[0010] After obtaining the reference relationship of the first symbol, a layout adjustment strategy of the dynamic library is configured based on the reference relationship, and the layout adjustment strategy is used to miniaturize the dynamic library. After configuring the layout adjustment strategy, the dynamic library is relinked based on the layout adjustment strategy. When relinking, the reference relationship of the first symbol is used as the link input, and the symbols in the dynamic library are adjusted accordingly according to the layout adjustment strategy, and finally a dynamic library after miniaturization is obtained.

[0011] In the first aspect of the present application, by confirming the first symbol used by the executable file in the dynamic library and obtaining the reference relationship of the first symbol, the usage of the symbols in the dynamic library by the executable file can be accurately identified, and then the layout adjustment strategy for software miniaturization processing can be configured, thereby avoiding the existence of redundant symbols in the dynamic library as much as possible and improving the benefits of software miniaturization processing.

[0012] In a possible implementation manner of the first aspect, the layout adjustment strategy is to delete symbols other than the first symbol and the second symbol in the dynamic library.

[0013] The first symbol is a symbol directly used by the executable file in the dynamic library, and the second symbol is a symbol that needs to be used in association with the first symbol. In other words, the symbols in the dynamic library except the first symbol and the second symbol are symbols that are not needed by the executable file. Therefore, the layout adjustment strategy can be configured to delete the symbols in the dynamic library except the first symbol and the second symbol to achieve the purpose of miniaturization of the dynamic library. Moreover, the deleted symbols are not needed by the executable file, so there will be no redundant symbols in the dynamic library, thereby improving the benefits of miniaturization. In addition, since the deleted symbols are not needed by the executable file, they will not affect the normal operation of the executable file.

[0014] In a possible implementation manner of the first aspect, the reference relationship further indicates a calling frequency of the first symbol and the second symbol, and the layout adjustment strategy is to split the dynamic library based on the calling frequency.

[0015] The reference relationship of the first symbol indicates the calling frequency of the first symbol and the second symbol, so the dynamic library can be hierarchically split according to the calling frequency of the symbol to obtain multiple miniaturized dynamic libraries. Each dynamic library generated after the split can independently provide its own function interface function. Loading all the dynamic libraries generated after the split together can provide the same complete functions as the overall dynamic library before the split.

[0016] Exemplarily, the symbols that are frequently called from the first symbol and the second symbol are separated to form a high-frequency symbol dynamic library, and the symbols that are less frequently called from the first symbol and the second symbol are separated to form a low-frequency symbol dynamic library. The executable file only depends on the first symbol and the second symbol that has a reference relationship with the first symbol in the dynamic library, so the symbols other than the first symbol and the second symbol in the dynamic library are separated to form an unused symbol dynamic library.

[0017] After the dynamic library is hierarchically split, multiple dynamic libraries can be stored differentially according to the frequency of use of each dynamic library. For example, for unused symbol dynamic libraries, they are not stored in the device, or they are stored in a remote network server, which can save software volume. In addition, different storage media have different values. Low-frequency symbol dynamic libraries and unused symbol dynamic libraries can be placed in storage media with lower values, and high-frequency symbol dynamic libraries can be stored in storage media with higher values, so that the storage structure can be optimized to the maximum extent and the optimization benefits can be improved. For example, in embedded devices, storage media generally include NOR flash, NAND flash, and disks. NOR flash has a small storage capacity and is expensive, but has a fast read and write speed. Therefore, only high-frequency symbol dynamic libraries can be stored in NOR flash, and low-frequency symbol dynamic libraries and unused symbol dynamic libraries can be stored in NAND flash or even disks.

[0018] In this possible implementation, multiple dynamic libraries with different usage frequencies can be obtained by hierarchically splitting the dynamic library, and then the dynamic libraries are stored differentially according to the usage frequency, so as to optimize the storage structure and improve the benefits of software miniaturization.

[0019] The dynamic library can be miniaturized, and unused symbols are linked into a dynamic library separately, so that there are no redundant symbols in the remaining dynamic libraries generated by splitting, thereby improving the volume gain obtained by miniaturization.

[0020] In a possible implementation of the first aspect, before the above step of: relinking the dynamic library based on the layout adjustment strategy, the method further includes: obtaining link information, the link information including a relocatable target file in the dynamic library and a link command. The above step of: relinking the dynamic library based on the layout adjustment strategy includes: relinking the dynamic library based on the layout adjustment strategy and the link information.

[0021] First, obtain the link information, which includes the relocatable target files and link commands in the dynamic library. The relocatable target files and link commands are used to link and generate executable files. When linking, the relocatable target files are used as input of the link command.

[0022] Acquiring the relocatable target file may be acquiring all the relocatable target files in the dynamic library. Alternatively, when the calling situation of the relocatable target file is known, for example, there is a list describing the calling situation of the relocatable target file, it is also possible to acquire it according to the calling situation of the relocatable target file. Exemplarily, when the unused symbol dynamic library is generated by linking the symbols not needed by the executable file, the relocatable target files not needed by the executable file can be acquired separately according to the list, thereby improving efficiency. The acquired link command includes all link options, and the link options are used to provide corresponding functions in the link process, for example, debugging information can be added through the "-g" option.

[0023] When relinking the dynamic library, the layout adjustment strategy configured based on the reference relationship of the first symbol is used as the link input, and the corresponding symbol is selected in combination with the relocatable target file included in the link information, and then the relink operation is performed through the corresponding link command in the link information.

[0024] In this possible implementation, the original link information is used to perform the relink operation, which is more convenient and quick.

[0025] In a possible implementation manner of the first aspect, the step of re-linking the dynamic library based on the layout adjustment strategy includes: compiling the source code of the dynamic library based on the layout adjustment strategy to re-link the dynamic library.

[0026] When relinking the dynamic library, the layout adjustment strategy configured based on the reference relationship of the first symbol is used as the link input, and the link is recompiled based on the source code, thereby realizing the relinking operation of the dynamic library. In this possible implementation, the relinking method is based on source code compilation and linking, which expands the application scenarios of the solution and improves the feasibility of the solution.

[0027] In a possible implementation manner of the first aspect, the method further includes: saving the reference relationship and the link information as a section of the dynamic library.

[0028] After obtaining the reference relationship and link information, the reference relationship and link information can be saved, and the saving method is not limited to the form. For example, the reference relationship and link information can be saved as a section in a dynamic library, or the reference relationship and link information can be saved as a separate file. In this possible implementation, the reference relationship and link information are saved to facilitate subsequent use.

[0029] In a possible implementation of the first aspect, the software package is a root file system rootfs image software package, a container image software package, and a Red Hat package manager RPM software package. Of course, the software package may also be other software packages, and the specific form of the software package is not limited here.

[0030] In this possible implementation, the specific form of the software package is limited, which improves the feasibility of the solution.

[0031] The second aspect of the present application provides a dynamic library layout adjustment device, including a determination unit, an acquisition unit, a configuration unit, and a link unit. The determination unit is used to determine a first symbol used by an executable file of a software package in a dynamic library; the acquisition unit is used to obtain a reference relationship of the first symbol, the reference relationship indicating a second symbol associated with the first symbol in the dynamic library; the configuration unit is used to configure a layout adjustment strategy of the dynamic library based on the reference relationship, the layout adjustment strategy is used to miniaturize the dynamic library; the link unit is used to re-link the dynamic library based on the layout adjustment strategy.

[0032] In a possible implementation manner of the second aspect, the layout adjustment strategy is to delete symbols other than the first symbol and the second symbol in the dynamic library.

[0033] In a possible implementation manner of the second aspect, the reference relationship further indicates a calling frequency of the first symbol and the second symbol, and the layout adjustment strategy is to split the dynamic library based on the calling frequency.

[0034] In a possible implementation of the second aspect, the acquisition unit is further used to acquire link information, which includes a relocatable target file in the dynamic library and a link command; the link unit is specifically used to re-link the dynamic library based on the layout adjustment strategy and the link information.

[0035] In a possible implementation manner of the second aspect, the linking unit is specifically configured to compile the source code of the dynamic library based on the layout adjustment strategy to re-link the dynamic library.

[0036] In a possible implementation manner of the second aspect, the device further includes a storage unit, configured to store the reference relationship and the link information as a section of the dynamic library.

[0037] In a possible implementation manner of the second aspect, the software package is a root file system rootfs image software package, a container image software package, and a Red Hat Package Manager RPM software package.

[0038] The dynamic library layout adjustment device provided in the second aspect of the present application is used to execute the method described in the first aspect or any possible implementation manner of the first aspect.

[0039] The third aspect of the present application provides a dynamic library layout adjustment device, comprising a processor and a memory, wherein the memory is used to store instructions, and the processor is used to obtain the instructions stored in the memory to execute the method described in the first aspect or any possible implementation of the first aspect.

[0040] The fourth aspect of the present application provides a dynamic library layout adjustment device, wherein the computer-readable storage medium includes instructions, and when the instructions are executed on a computer, the computer executes the method described in the first aspect or any possible implementation of the first aspect.

[0041] A fifth aspect of the present application provides a computer program product comprising instructions, which, when executed on a computer, enables the computer to execute the method described in the first aspect or any possible implementation of the first aspect.

[0042] In a sixth aspect, the present application provides a chip system, which includes at least one processor and a communication interface, wherein the communication interface and the at least one processor are interconnected via lines, and the at least one processor is used to run computer programs or instructions to execute the method described in the first aspect or any possible implementation of the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] Figure 1 A schematic diagram of an application scenario of the dynamic library layout adjustment method provided in an embodiment of the present application;

[0044] Figure 2 A schematic diagram of an embodiment of a dynamic library layout adjustment method provided in an embodiment of the present application;

[0045] Figure 3 A schematic diagram of another embodiment of the dynamic library layout adjustment method provided in an embodiment of the present application;

[0046] Figure 4 A schematic diagram of another embodiment of the dynamic library layout adjustment method provided in an embodiment of the present application;

[0047] Figure 5 A schematic diagram of a flow chart of the compiling and linking stage in an embodiment of the present application;

[0048] Figure 6 A schematic diagram of a process flow of the software package optimization stage in the embodiment of the present application;

[0049] Figure 7 A schematic diagram of a flow chart of the relinking stage in an embodiment of the present application;

[0050] Figure 8 Another schematic diagram of the process of the relinking stage in the embodiment of the present application;

[0051] Fig. 9 A schematic diagram of another embodiment of the dynamic library layout adjustment method provided in an embodiment of the present application;

[0052] Fig.10 Another flowchart of the compile and link phase in the embodiment of the present application;

[0053] Fig.11 Another schematic diagram of the process of the relinking stage in the embodiment of the present application;

[0054] Fig.12 A schematic diagram of another embodiment of the dynamic library layout adjustment method provided in an embodiment of the present application;

[0055] Fig.13 A structural schematic diagram of a dynamic library layout adjustment device provided in an embodiment of the present application;

[0056] Fig.14 Another structural schematic diagram of the dynamic library layout adjustment device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0057] The following describes the embodiments of the present application in conjunction with the accompanying drawings. Obviously, the described embodiments are only embodiments of a part of the present application, rather than all embodiments. It is known to those skilled in the art that with the development of technology and the emergence of new scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.

[0058] The terms "system" and "network" in the specification and claims of the present application and the above-mentioned drawings can be used interchangeably. Unless otherwise specified, ordinal numbers such as "first" and "second" are used to distinguish multiple objects and are not used to limit the order, timing, priority or importance of multiple objects. It should be understood that the terms used in this way can be interchangeable where appropriate, so that the embodiments described here can be implemented in an order other than the content illustrated or described here. 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.

[0059] To facilitate understanding, the relevant terms and concepts mainly involved in the embodiments of the present application are first introduced below.

[0060] 1. Relocatable target files

[0061] The file generated by the compiler after compiling the source code is called a relocatable file, which can be used to link to generate executable files or dynamic libraries.

[0062] 2. Executable files

[0063] A program file generated by linking relocatable files through a linker, which can be loaded into memory and executed by the operating system, such as files with the .exe suffix on the Windows platform, or files with execution attributes on the Linux platform.

[0064] 3. Static Library

[0065] The relocatable target file is packaged into a separate file in a specific way, and when linking to generate an executable file, the content it needs is "copied" from this separate file to the final executable file. This separate file is called a static library.

[0066] 4. Shared object files (dynamic libraries)

[0067] A special type of relocatable object file, similar to a static library, but it does not "copy" all the required binary code into the executable file at link time, but only "copies" some relocation and symbol table information, which are dynamically loaded into memory by the loader when the program is running to complete the link process. Dynamic libraries provide as rich an interface function as possible for multiple executable files to use.

[0068] 5. Executable and Linkable Format (ELF)

[0069] A common file format for organizing target files. Target files are organized in the form of sections. For example, code segments and data segments are organized into separate sections in ELF format files.

[0070] 6.section

[0071] The executable files and dynamic library files of the Linux platform use the ELF file format. In the ELF format, the target files are organized in the form of sections. For example, the code segment, data segment, etc. are organized into separate sections in the ELF format file.

[0072] 7.rootfs image

[0073] The root file system is the first file system mounted by the operating system. It contains the initialization scripts, basic commands, libraries, and configuration files required for system startup.

[0074] 8. Container images

[0075] A special file system that provides the programs, libraries, resources, configurations, and other files required for the container to run, as well as some configuration parameters (such as environment variables) at run time.

[0076] The embodiment of the present application provides a method for adjusting the layout of a dynamic library, which can improve the benefits of miniaturizing the dynamic library. The embodiment of the present application also provides a corresponding device, a computer-readable storage medium, and a computer program product, etc. The following are respectively described.

[0077] See below Figure 1 , Figure 1 A schematic diagram of an application scenario of the dynamic library layout adjustment method provided in an embodiment of the present application.

[0078] like Figure 1As shown, the software package includes executable files 1s, cp, xx1.app, xx.app and dynamic library 1 and dynamic library 2. Dynamic library 1 and dynamic library 2 include several symbols, and the corresponding relocatable target files can be called through the symbols. The dynamic library loads the symbols into the memory when running. When the executable file wants to call the relocatable target file, it accesses the memory and jumps to the dynamic library through the corresponding symbols in the memory for execution. It should be understood that Figure 1 The numbers of executable files, dynamic libraries, and symbols in dynamic libraries shown are only examples, and the specific numbers are not limited here.

[0079] With the development of software applications, dynamic libraries need to support more and more applications, and the number of symbols they provide is also growing rapidly. However, for executable files in some specific software packages, only a small number of symbols provided by the dynamic library are often needed. Figure 1 The executable file of the software package shown here depends only on the black symbols in dynamic library 1 and dynamic library 2 ( Figure 1 The remaining symbols are not used, which results in a waste of storage resources. In addition, the more symbols there are, the larger the software size is, and the greater the risk of software attacks is, which affects the security of the system.

[0080] To address the above issues, the software package can be miniaturized. One current method is to optimize the compilation and linking process, which specifically includes four processes: preprocessing, compilation, assembly, and linking. In the compilation phase, optimization operations can be performed in the process from intermediate code to target code, and the optimization methods include merging similar code blocks, reverse inlining, and deleting redundant instructions. Optimization operations can also be performed in the linking phase, such as deleting useless symbols through the gc-sections function.

[0081] Although the above methods can achieve software miniaturization, when optimizing the compilation stage, the size is reduced while some performance is often lost. For example, the reverse inline method is to cancel the function inline, which will result in additional function jump steps at runtime, causing performance degradation and may affect maintenance and testing functions. When optimizing at the link stage, there are still redundant symbols in the deleted symbols, and the optimization benefits are low.

[0082] In view of this, the embodiment of the present application provides a dynamic library layout adjustment method, which performs miniaturization processing on the dynamic library based on the symbols not required by the executable file in the dynamic library, so as to reduce the software volume as much as possible and improve the optimization benefits. In addition, since the unused symbols are processed, the normal operation of the executable file will not be affected, and no function loss or performance degradation will be caused.

[0083] The dynamic library layout adjustment method provided in the embodiment of the present application is mainly used to optimize specific software packages, such as root file system rootfs image software packages, container image software packages, and Red Hat Package Manager (RPM) software packages. Of course, it can also be used to optimize other software packages, which are not specifically limited here.

[0084] The dynamic library layout adjustment method provided in the embodiment of the present application can be applied to a dynamic library layout adjustment device, which includes an enhanced linker and a software package optimization tool. Figure 2 A description is given of a dynamic library layout adjustment device.

[0085] like Figure 2 As shown, the dynamic library layout adjustment method includes processes such as software development, compilation and linking, software package optimization, relinking and re-layout, and software deployment. In the software development stage, the source code (i.e., source code) of the software package is written, and then the enhanced linker (hereinafter referred to as the linker) performs the process of compiling and linking. The linker includes a native link function module for linking and generating software, such as linking the relocatable target files in the dynamic library to generate executable files. The linker also includes a symbol reference relationship acquisition module for obtaining the mutual reference relationship between the symbols provided by the dynamic library. In addition, the linker can also include a link information acquisition module for obtaining link information, and the link information includes the relocatable target files (i.e., relocatable target files related to the executable file) participating in the link operation, and the corresponding link command. Wherein, the link command contains all link options.

[0086] After compiling and linking, the software package optimization tool performs the software package optimization process, and the software package optimization process is executed in the packaging process of the software package. The software package optimization tool includes a symbol dependency identification module, a symbol reference relationship parsing module, and a global reference relationship construction module. Among them, the symbol dependency identification module is used to scan the executable files in the software package to confirm which symbols in the dynamic library are used by the executable files. The symbol reference relationship parsing module is used to read the mutual reference relationship between symbols in the dynamic library obtained during the compilation and linking process. The global reference relationship construction module first constructs the symbol reference relationship of a single executable file based on the symbols used by a single executable file and the mutual reference relationship between the symbols, and then constructs the symbol reference relationship of the entire software package based on the reference relationship of each executable file in the software package. When the linker includes a link information acquisition module, the software package optimization tool also includes a link information parsing module, which is used to read the link information obtained during the compilation and linking process, and is used to support subsequent relinking operations.

[0087] After the software package optimization process, the dynamic library is relinked and re-layouted. The relinking of the dynamic library is performed in the packaging process of the software package, and the re-layout is performed together with the relinking. The symbolic reference relationship of the software package obtained in the previous process is used as the input for relinking, and the dynamic library is relinked through the native link function module of the linker. The relinking method can be based on source code recompilation and linking, or it can be based on the obtained link information. The linker also includes a split link function module and / or a symbol clipping function module. During the re-layout, the dynamic library is split into multiple independent dynamic libraries through the split link module, or the unused symbols of the executable file in the dynamic library are clipped through the symbol clipping function module, so as to achieve the purpose of software miniaturization.

[0088] After the relinking and re-layout processes are completed, the miniaturized software package is deployed in a storage medium such as a flash memory or a memory.

[0089] based on Figure 2 The process described above is combined with Figure 3 The dynamic library layout adjustment method provided in the embodiment of the present application is described. Figure 3 A schematic diagram of an embodiment of a dynamic library layout adjustment method provided in an embodiment of the present application, the embodiment includes steps 301 to 304.

[0090] 301. Determine a first symbol used by an executable file of a software package in a dynamic library.

[0091] The software package includes executable files and dynamic libraries, wherein both executable files and dynamic libraries can be multiple. The dynamic library layout adjustment device scans the software package to confirm which symbols in the dynamic library are used by each executable file in the software package, thereby determining the first symbol used by the entire executable file in the dynamic library.

[0092] 302. Obtain a reference relationship of the first symbol, where the reference relationship indicates a second symbol associated with the first symbol in the dynamic library.

[0093] The dynamic library layout adjustment device obtains and saves the mutual reference relationship between all symbols in the dynamic library. The saving method is not limited to the form. Exemplarily, the mutual reference relationship can be saved as a section in the dynamic library, or the mutual reference relationship can be saved as a separate file. It is understandable that the mutual reference relationship between all symbols in the dynamic library can be obtained before determining the first symbol used by the executable file, or it can be obtained after determining the first symbol, which is not specifically limited here.

[0094] According to the mutual reference relationship between all symbols in the dynamic library, the reference relationship of the first symbol can be confirmed, and the reference relationship of the first symbol indicates the second symbol that needs to be used in association with the first symbol. Specifically, according to the symbols used by a single executable file, combined with the mutual reference relationship between the symbols, the symbol reference relationship of a single executable file is obtained. The symbol reference relationship of each executable file is obtained in turn, so as to obtain the reference relationship of the first symbol used by the entire executable file. The first symbol and the second symbol that has a reference relationship with the first symbol are the symbols required by the executable file in the dynamic library. Similarly, after obtaining the reference relationship of the first symbol, the reference relationship can also be saved, and the saving method is similar to the saving method of the above-mentioned mutual reference relationship, and the details will not be repeated here.

[0095] 303. Configure a layout adjustment strategy for the dynamic library based on the reference relationship, where the layout adjustment strategy is used to miniaturize the dynamic library.

[0096] After obtaining the reference relationship of the first symbol, a layout adjustment strategy of the dynamic library is configured based on the reference relationship, and the layout adjustment strategy is used to miniaturize the dynamic library.

[0097] In one possible solution, the layout adjustment strategy is to delete symbols in the dynamic library that are not needed by the executable file. Specifically, after confirming the first symbol, the second symbol that needs to be used in association with the first symbol can be confirmed based on the reference relationship of the first symbol. The symbols other than the first symbol and the second symbol in the dynamic library are symbols that are not needed by the executable file. The dynamic library layout adjustment device deletes the symbols other than the first symbol and the second symbol in the dynamic library through the symbol clipping function module, thereby achieving the purpose of software miniaturization, and the deleted symbols are not needed by the executable file, so there will be no redundant symbols in the dynamic library, thereby improving the volume benefits of miniaturization processing. In addition, since the deleted symbols are not needed by the executable file, they will not affect the normal operation of the executable file.

[0098] In another possible solution, the layout adjustment strategy is to split the dynamic library in a hierarchical manner to generate multiple independent miniaturized dynamic libraries. In this possible solution, the reference relationship of the first symbol also indicates the calling frequency of the first symbol and the second symbol, and the dynamic library is split according to the calling frequency. For example, the symbols that are frequently called in the first symbol and the second symbol are split to form a high-frequency symbol dynamic library, and the symbols that are less frequently called in the first symbol and the second symbol are split to form a low-frequency symbol dynamic library. The executable file only depends on the first symbol and the second symbol that has a reference relationship with the first symbol in the dynamic library, so the symbols other than the first symbol and the second symbol in the dynamic library are split to form an unused symbol dynamic library. Each dynamic library generated after the split can independently provide its own function interface function. Loading all the dynamic libraries generated after the split together can provide the same complete functions as the overall dynamic library before the split.

[0099] After the dynamic library is divided into levels, multiple dynamic libraries are stored differently according to the frequency of use of each dynamic library. For example, for unused symbol dynamic libraries, they are not stored in the device, or they are stored in a remote network server, which can save software volume. In addition, different storage media have different values. Low-frequency symbol dynamic libraries and unused symbol dynamic libraries can be placed in storage media with lower values, and high-frequency symbol dynamic libraries can be stored in storage media with higher values, so that the storage structure can be optimized to the maximum extent and the optimization benefits can be improved. For example, in embedded devices, storage media generally include NOR flash, NAND flash, and disks. NOR flash has a small storage capacity and is expensive, but has a fast read and write speed. Therefore, only high-frequency symbol dynamic libraries can be stored in NOR flash, and low-frequency symbol dynamic libraries and unused symbol dynamic libraries can be stored in NAND flash or even disks.

[0100] 304. Relink the dynamic library based on the layout adjustment strategy.

[0101] After the layout adjustment strategy is configured, the dynamic library is relinked based on the layout adjustment strategy. During the relinking, the reference relationship of the first symbol is used as the link input, and the symbols in the dynamic library are adjusted accordingly according to the layout adjustment strategy, and finally miniaturized software is generated and deployed in storage media such as memory or flash.

[0102] In this embodiment, by confirming the first symbol used by the executable file in the dynamic library and obtaining the reference relationship of the first symbol, the symbols required by the executable file during operation can be accurately identified, so that the symbols not required by the executable file in the dynamic library can be determined, and then the dynamic library is miniaturized based on the symbols not required by the executable file, thereby avoiding the existence of redundant symbols in the dynamic library, reducing the software volume as much as possible, and improving the optimization benefits. In addition, since unused symbols are processed, the miniaturization process will not affect the normal operation of the executable file, and will not cause functional loss and performance degradation.

[0103] In the embodiments of the present application, there are multiple ways to relink the dynamic library, which are described below. It should be understood that the following is only an exemplary description. Figure 4 as well as Fig. 9 In addition to the re-linking method described in the illustrated embodiment, there may be other various linking methods, which are not specifically limited here.

[0104] See also Figure 4 , is a schematic diagram of another embodiment of the data integrity verification method provided in an embodiment of the present application. Figure 4 In the embodiment shown, the dynamic library layout adjustment device first obtains the link information through the linker, and then relinks the dynamic library based on the link information. Figure 4 Provide explanation.

[0105] 401. Software development.

[0106] During the software development phase, the source code of the software package is written.

[0107] 402. Compile and link.

[0108] The linker includes a native link function module, a symbol reference relationship acquisition module, and a link information acquisition module. The specific process of the compilation and linking stage can be combined with Figure 5 Understand. Figure 5 As shown, the compile and link stage includes steps S501 to S504.

[0109] S501. Compile the source code to generate a single function segment.

[0110] S502: Obtain and save relevant reference relationships between symbols in the dynamic library.

[0111] The symbol reference relationship acquisition module of the linker is used to obtain the mutual reference relationship between all symbols in the dynamic library and save them. The saving method is the same as Figure 3 The description of step 302 in the illustrated embodiment is similar and will not be repeated here.

[0112] S503: Acquire and save link information.

[0113] The link information is obtained through the link information acquisition module of the linker. The link information is the relevant information in the dynamic library link operation. The link information includes the relocatable target file and the link command in the dynamic library. The relocatable target file and the link command are used to link and generate an executable file. When linking, the relocatable target file is used as the input of the link command.

[0114] Acquiring the relocatable target file may be acquiring all the relocatable target files in the dynamic library. Alternatively, when the calling situation of the relocatable target file is known, for example, there is a list describing the calling situation of the relocatable target file, it is also possible to acquire it according to the calling situation of the relocatable target file. Exemplarily, when the unused symbol dynamic library is generated by linking the symbols not needed by the executable file, the relocatable target files not needed by the executable file can be acquired separately according to the list, thereby improving efficiency. The acquired link command includes all link options, and the link options are used to provide corresponding functions in the link process, for example, debugging information can be added through the "-g" option.

[0115] After obtaining the link information, save it. The saving method is similar to the mutual reference relationship of symbols, and the details will not be repeated here.

[0116] S504: Generate a final dynamic library.

[0117] 403. Software package optimization.

[0118] This phase is carried out through the software package optimization tool, which includes a symbol dependency identification module, a symbol reference relationship resolution module, and a global reference relationship construction module. The specific process of software package optimization can be combined with Figure 6 Understand. Figure 6 As shown, the software package optimization process includes steps S601 to S604.

[0119] S601: Determine a first symbol used by an executable file of a software package in a dynamic library.

[0120] The first symbol used by the executable file of the software package in the dynamic library is determined by the symbol dependency identification module.

[0121] S602: Read and parse the mutual reference relationship between symbols.

[0122] The mutual reference relationship between the symbols saved in step S502 is read and analyzed by the symbol reference relationship analysis module.

[0123] S603: Obtain a reference relationship of the first symbol.

[0124] The symbol reference relationship of the single executable file is constructed based on the symbols used by the single executable file and the mutual reference relationship between the symbols parsed in step S602. The symbol reference relationship of each executable file is obtained in turn, thereby obtaining the reference relationship of the first symbol used by the entire executable file.

[0125] Steps S601 to S603 and Figure 3 In the illustrated embodiment, step 301 is similar to step 302, and the details are not repeated here. It should be understood that step S601 determining the first symbol may occur before step S502 obtaining the mutual reference relationship between symbols, that is, the order of steps is S601 followed by S502, and then S603. Alternatively, step S601 may also be after step S502, and the order of steps S601 and S502 is not limited here.

[0126] S604: Obtain the calling frequency and calling relationship of the symbol.

[0127] The reference relationship of the first symbol indicates the second symbol that needs to be used in association with the first symbol, and the reference relationship of the first symbol can also indicate the calling frequency of the first symbol and the second symbol. According to the reference relationship of the first symbol, the calling relationship between the first symbol and the second symbol and the calling frequency of the first symbol and the second symbol can be obtained.

[0128] 404, relink and re-layout.

[0129] After obtaining the reference relationship of the first symbol, a layout adjustment strategy of the dynamic library is configured based on the reference relationship. The layout adjustment strategy can be to cut the symbol, or to hierarchically split the dynamic library and link to generate multiple dynamic libraries. Figure 3 This has been described in detail in step 303 of the illustrated embodiment and will not be repeated here.

[0130] After configuring the layout adjustment strategy, relink the dynamic library based on the layout adjustment strategy. The relink operation can be combined with Figure 7 Understand. Figure 7 As shown, the relinking operation includes steps S701 to S702.

[0131] S701, read and parse link information.

[0132] The software package optimization tool further includes a link information parsing module, through which the link information saved in step S503 is read and parsed. The link information includes the relocatable target files involved in the link operation and the corresponding link commands.

[0133] S702: Relink the dynamic library.

[0134] The reference relationship of the first symbol is used as a link input, a layout adjustment strategy of the dynamic library is configured, and then a link operation is performed on the dynamic library based on the link information. Specifically, based on the layout adjustment strategy and the relocatable target file included in the link information, a required symbol is selected, and then a link operation is performed on it through a corresponding link command in the link information.

[0135] Exemplarily, the layout adjustment strategy is to split the dynamic library, then select the symbols that are called frequently and the corresponding link commands for linking operations during relinking to generate a high-frequency symbol dynamic library. Then select the symbols that are called infrequently and the corresponding link commands for linking operations to generate a low-frequency symbol dynamic library. Symbols that are not needed by the executable file are linked to generate an unused symbol dynamic library, thereby obtaining multiple miniaturized dynamic libraries. The above method generates multiple dynamic libraries through multiple linking operations. In addition, it can also be achieved by using an enhanced linker to generate multiple dynamic libraries in one linking operation, that is, the dynamic library is relinked into a high-frequency symbol dynamic library, a low-frequency symbol dynamic library, and an unused symbol dynamic library through one linking operation.

[0136] Alternatively, the layout adjustment strategy is to trim the symbols in the dynamic library, then the first symbol and the second symbol are selected during relinking, the remaining symbols are deleted, and then the linking operation is performed through the corresponding linking command, thereby obtaining a miniaturized dynamic library.

[0137] The overall process of step 404 can be combined with Figure 8 Understand. Figure 8 As shown, the reference relationship of the first symbol in the software package is used as the link input, the layout adjustment strategy of the dynamic library is configured, and the linker provides a strategic link operation during the relinking process to complete the layout optimization. The strategic link operation is to parse the input layout adjustment strategy, cut the redundant symbols in the dynamic library according to the layout adjustment strategy, or split the dynamic library into multiple dynamic libraries, and finally obtain a dynamic library after miniaturization.

[0138] 405. Software deployment: deploying the miniaturized software in a storage medium such as Flash or in memory.

[0139] In this embodiment, the link information is saved during the compilation and linking, and when the dynamic library is subsequently re-linked, the re-linking process can be completed based on the original link information, which is relatively convenient and quick.

[0140] See below Fig. 9 , is a schematic diagram of another embodiment of the data integrity verification method provided in an embodiment of the present application. Fig. 9In the embodiment shown, the dynamic library layout adjustment device recompiles and links the source code of the software package to complete the relinking operation of the dynamic library. Fig. 9 Provide explanation.

[0141] 901. Software development.

[0142] During the software development phase, the source code of the software package is written.

[0143] 902. Compile and link.

[0144] The linker includes a native link function module and a symbol reference relationship acquisition module. Figure 4 Compared with step 402 in the embodiment shown, the linker does not need a link information acquisition module. Fig.10 Understand. Fig.10 As shown, the compile and link stage includes steps S1001 to S1004.

[0145] S1001. Compile the source code to generate a single function segment.

[0146] S1002: Obtain and save relevant reference relationships between symbols in the dynamic library.

[0147] S1003, generate the final dynamic library.

[0148] In this embodiment, steps S1001 to S1003 are Figure 4 In the illustrated embodiment, steps S501, S502 and S504 are similar and will not be described in detail herein. Figure 4 Compared with the embodiment shown, in this embodiment, there is no need to obtain link information.

[0149] 903. Software package optimization.

[0150] In this embodiment, step 903 and Figure 4 Step 403 in the illustrated embodiment is similar and will not be described in detail here.

[0151] 904. Relink and re-layout.

[0152] After obtaining the reference relationship of the first symbol, a layout adjustment strategy of the dynamic library is configured based on the reference relationship. The layout adjustment strategy can be to cut the symbol, or to hierarchically split the dynamic library and link to generate multiple dynamic libraries. Figure 3 This has been described in detail in step 303 of the illustrated embodiment and will not be repeated here.

[0153] After configuring the layout adjustment strategy, relink the dynamic library based on the layout adjustment strategy. The relink operation can be combined with Fig.11 Understand. Fig.11 As shown, the relinking operation includes steps S1101 to S1102.

[0154] S1101. Recompile and link based on source code.

[0155] The source code of the software package is recompiled and linked, thereby relinking the dynamic library. In this embodiment, the linker does not need a link information parsing module.

[0156] S1102, re-link the dynamic library.

[0157] The reference relationship of the first symbol is used as the link input, the layout adjustment strategy of the dynamic library is configured, and then the link is recompiled based on the source code, so as to relink the dynamic library. Figure 4 Step 404 in the illustrated embodiment is similar and will not be described in detail here.

[0158] 905. After miniaturization, the software package is deployed in a storage medium such as Flash or in a memory.

[0159] In this embodiment, the method of re-linking the dynamic library is to recompile and link based on the source code, which expands the application scenarios of the solution and improves the feasibility of the solution.

[0160] In summary, the following Fig.12 The dynamic library layout adjustment method provided in the embodiment of the present application is summarized and described.

[0161] like Fig.12 As shown, first determine which symbols in the dynamic library are used by the executable file (i.e., the first symbol, Fig.12 The first symbol is represented by a solid black circle in the figure, and the mutual reference relationship of all symbols in the dynamic library is obtained. Based on the mutual reference relationship, the global symbol reference relationship of the executable file (i.e., the reference relationship of the first symbol) is constructed, and then the layout adjustment strategy of the dynamic library is configured according to the global symbol reference relationship.

[0162] The layout adjustment strategy is used as an input for relinking to relink the dynamic library. The relinking method can be based on source code recompilation and linking, or it can be based on obtaining link information first and then relinking the dynamic library based on the link information. The link information includes the relocatable target files in the dynamic library and the link command.

[0163] During relinking, layout optimization is performed according to a layout adjustment strategy. The layout adjustment strategy may be to delete symbols that are not required by the executable file in the dynamic library, or to divide the dynamic library into different levels to generate multiple independent dynamic libraries, thereby ultimately obtaining miniaturized software.

[0164] The above describes the embodiments of the present application from the perspective of the method. The following describes the relevant devices in the embodiments of the present application from the perspective of specific device implementation.

[0165] See also Fig.13 , an embodiment of the present application provides a schematic diagram of a dynamic library layout adjustment device 1300 , wherein the dynamic library layout adjustment device 1300 includes a determination unit 1301 , an acquisition unit 1302 , a configuration unit 1303 and a linking unit 1304 .

[0166] The determining unit 1301 is used to determine the first symbol used by the executable file of the software package in the dynamic library.

[0167] The acquisition unit 1302 is used to acquire a reference relationship of the first symbol, where the reference relationship indicates a second symbol associated with the first symbol in the dynamic library.

[0168] The configuration unit 1303 is used to configure a layout adjustment strategy of the dynamic library based on the reference relationship, and the layout adjustment strategy is used to miniaturize the dynamic library.

[0169] The linking unit 1304 is used to re-link the dynamic library based on the layout adjustment strategy.

[0170] Optionally, the layout adjustment strategy is to delete symbols other than the first symbol and the second symbol in the dynamic library.

[0171] Optionally, the reference relationship further indicates the calling frequency of the first symbol and the second symbol, and the layout adjustment strategy is to split the dynamic library based on the calling frequency.

[0172] Optionally, the acquisition unit 1302 is further used to obtain link information, which includes relocatable target files in the dynamic library and link commands corresponding to the relocatable target files; the link unit 1304 is specifically used to relink the dynamic library based on the layout adjustment strategy and the link information.

[0173] Optionally, the linking unit 1304 is specifically configured to compile the source code of the dynamic library based on the layout adjustment strategy to re-link the dynamic library.

[0174] Optionally, the dynamic library layout adjustment device 1300 further includes a storage unit 1305, which is used to store the reference relationship and link information as a section of the dynamic library.

[0175] Optionally, the software package is a root file system rootfs image software package, a container image software package, and a Red Hat Package Manager RPM software package.

[0176] Each unit in the dynamic library layout adjustment device 1300 performs the above Figures 2 to 4 as well as Fig. 9 , Fig.12 The operation of the dynamic library layout adjustment device in the illustrated embodiment will not be described in detail here.

[0177] See below Fig.14 , is a possible structural diagram of a dynamic library layout adjustment device 1400 provided in an embodiment of the present application, including a processor 1401, a communication interface 1402, a memory 1403 and a bus 1404. The processor 1401, the communication interface 1402 and the memory 1403 are interconnected via the bus 1404. In an embodiment of the present application, the processor 1401 is used to control and manage the actions of the dynamic library layout adjustment device, for example, the processor 1401 is used to execute Figure 3 The steps performed by the dynamic library layout adjustment device in the method embodiment are shown. The communication interface 1402 is used to support the dynamic library layout adjustment device to communicate. The memory 1403 is used to store program codes and data of the dynamic library layout adjustment device.

[0178] Among them, the processor 1401 can be a central processing unit, a general-purpose processor, a digital signal processor, an application-specific integrated circuit, a field programmable gate array or other programmable logic device, a transistor logic device, a hardware component or any combination thereof. It can implement or execute various exemplary logic blocks, modules and circuits described in conjunction with the contents disclosed in this application. The processor can also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a digital signal processor and a microprocessor, and so on. The bus 1404 can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Fig.14 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0179] The embodiment of the present application also provides a computer-readable storage medium, wherein the computer-readable storage medium includes instructions, and when the instructions are executed on a computer, the computer executes the aforementioned Figures 2 to 4 as well as Fig. 9 , Fig.12 The method in the illustrated embodiment.

[0180] The present application also provides a computer program product comprising instructions, which, when executed on a computer, enables the computer to execute the aforementioned Figures 2 to 4as well as Fig. 9 , Fig.12 The method in the illustrated embodiment.

[0181] The embodiment of the present application also provides a chip system, the chip system includes at least one processor and a communication interface, the communication interface and the at least one processor are interconnected through a line, and the at least one processor is used to run a computer program or instruction to execute the aforementioned Figures 2 to 4 as well as Fig. 9 , Fig.12 The method in the illustrated embodiment.

[0182] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0183] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as 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 an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.

[0184] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0185] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0186] 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 is essentially 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, and the computer software product is stored in a storage medium, including a number of instructions to enable 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 application. 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 and other media that can store program code.

Claims

1. A method for adjusting the layout of a dynamic library, characterized in that: include: Determine the first symbol used by the executable file of the software package in the dynamic library; Acquire a reference relationship of the first symbol, where the reference relationship indicates a second symbol associated with the first symbol in the dynamic library; Configuring a layout adjustment strategy for the dynamic library based on the reference relationship, wherein the layout adjustment strategy is used to miniaturize the dynamic library; The dynamic library is re-linked based on the layout adjustment strategy.

2. The method according to claim 1, characterized in that The layout adjustment strategy is to delete symbols in the dynamic library except the first symbol and the second symbol.

3. The method according to claim 1, characterized in that The reference relationship also indicates the calling frequency of the first symbol and the second symbol, and the layout adjustment strategy is to split the dynamic library based on the calling frequency.

4. The method according to any one of claims 1 to 3, characterized in that: Before re-linking the dynamic library based on the layout adjustment strategy, the method further includes: Acquire link information, wherein the link information includes a relocatable target file in the dynamic library and a link command; The re-linking operation on the dynamic library based on the layout adjustment strategy includes: The dynamic library is re-linked based on the layout adjustment strategy and the link information.

5. The method according to any one of claims 1 to 3, characterized in that: The re-linking operation on the dynamic library based on the layout adjustment strategy includes: The source code of the dynamic library is compiled based on the layout adjustment strategy to re-link the dynamic library.

6. The method according to claim 4, characterized in that The method further comprises: The reference relationship and the link information are saved as a section of the dynamic library.

7. The method according to any one of claims 1 to 6, characterized in that: The software packages are a root file system rootfs image software package, a container image software package, and a Red Hat Package Manager RPM software package.

8. A dynamic library layout adjustment device, characterized in that: include: A determination unit, used to determine a first symbol used by an executable file of a software package in a dynamic library; an acquiring unit, configured to acquire a reference relationship of the first symbol, wherein the reference relationship indicates a second symbol associated with the first symbol in the dynamic library; A configuration unit, configured to configure a layout adjustment strategy of the dynamic library based on the reference relationship, wherein the layout adjustment strategy is used to miniaturize the dynamic library; A linking unit is used to re-link the dynamic library based on the layout adjustment strategy.

9. The device according to claim 8, characterized in that The layout adjustment strategy is to delete symbols in the dynamic library except the first symbol and the second symbol.

10. The device according to claim 8, characterized in that The reference relationship also indicates the calling frequency of the first symbol and the second symbol, and the layout adjustment strategy is to split the dynamic library based on the calling frequency.

11. The device according to any one of claims 8 to 10, characterized in that The acquisition unit is also used for: Acquire link information, wherein the link information includes a relocatable target file in the dynamic library and a link command; The link unit is specifically used for: The dynamic library is re-linked based on the layout adjustment strategy and the link information.

12. The device according to any one of claims 8 to 10, characterized in that The link unit is specifically used for: The source code of the dynamic library is compiled based on the layout adjustment strategy to re-link the dynamic library.

13. The device according to claim 11, characterized in that The device further comprises a storage unit, which is used to store the reference relationship and the link information as a section of the dynamic library.

14. The device according to any one of claims 8 to 13, characterized in that The software packages are a root file system rootfs image software package, a container image software package, and a Red Hat Package Manager RPM software package.

15. A dynamic library layout adjustment device, characterized in that: include: Processor and memory; The memory is used to store instructions; The processor is configured to execute instructions stored in the memory to implement the method according to any one of claims 1 to 7.

16. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by one or more processors, the method according to any one of claims 1 to 7 is implemented.

17. A computer program product comprising instructions, characterized in that When the computer program product is run on a computer, the computer is caused to execute the method according to any one of claims 1 to 7.