Methods, apparatus, equipment and storage media for determining dynamic inter-library conflict symbols

By filtering and disassembling the external symbols of dynamic library files, conflicting external symbols are identified, resolving application exceptions caused by conflicts between dynamic libraries, saving renaming time and resources, and improving work efficiency.

CN114675841BActive Publication Date: 2025-12-02QINGDAO HAIER TECH +1
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210164910.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-02-22
Publication Date
2025-12-02
Estimated Expiration
2042-02-22

AI Technical Summary

Technical Problem

In existing technologies, conflicts between external symbols in dynamic libraries can cause application malfunctions, and renaming all external symbols wastes time and resources, affecting work efficiency.

Method used

By obtaining external symbols from the target application's dynamic library files, duplicate target external symbols are filtered out, and the dynamic library files containing them are disassembled to determine the consistency of the assembly code and identify conflicting external symbols.

Benefits of technology

Renaming only conflicting external symbols saves development time and resources and improves work efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114675841B_ABST
    Figure CN114675841B_ABST
Patent Text Reader

Abstract

This invention belongs to the field of computer technology, specifically relating to a method, apparatus, device, and storage medium for determining conflicting symbols between dynamic libraries. From pre-stored dynamic library files of a target application, target external symbols that are repeatedly defined in multiple dynamic libraries are selected. The target dynamic library files containing the target external symbols are disassembled to obtain the corresponding assembly code for each target dynamic library. By determining whether the assembly code corresponding to the target external symbols in each target dynamic library is completely identical, conflicting target external symbols between the target dynamic libraries can be identified. Therefore, developers can rename only the conflicting target external symbols between target dynamic libraries, saving application development time and resources and improving work efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of computer data processing technology, and specifically relates to a method, apparatus, device and storage medium for determining dynamic inter-library conflict symbols. Background Technology

[0002] A dynamic library, also known as a dynamic link library, is an executable program used to support the main program during application runtime. Dynamic libraries typically contain externally visible, accessible, and callable symbols, also known as external symbols. These external symbols include those defined within the dynamic library and those not defined within it.

[0003] Typically, an application can have multiple dynamic libraries. Therefore, for external symbols defined in their respective dynamic libraries, there may be instances where the same external symbol is defined repeatedly in two or more dynamic libraries. If the definitions of external symbols differ between two or more dynamic libraries, i.e., there is a conflict between the external symbols, it can cause the application to malfunction or even terminate.

[0004] Therefore, to avoid symbol conflicts, developers need to rename all external symbols in dynamic libraries. However, dynamic libraries often contain a large number of external symbols that do not conflict with each other. Renaming these external symbols wastes time and resources, affecting work efficiency. Therefore, identifying the external symbols that conflict with each dynamic library is an urgent problem to be solved. Summary of the Invention

[0005] To address the aforementioned problems in the prior art, namely, to resolve the waste of time and resources and the impact on work efficiency caused by renaming external symbols that do not conflict between dynamic libraries, this invention provides a method, apparatus, device, and storage medium for determining conflicting symbols between dynamic libraries.

[0006] According to a first aspect of the present invention, the present invention provides a method for determining dynamic inter-library conflict symbols, the method comprising:

[0007] Obtain the external symbols defined in each dynamic library of the target application from the pre-stored dynamic library files of the target application;

[0008] The obtained external symbols are filtered to obtain target external symbols; wherein, the target external symbols are external symbols that are repeatedly defined in multiple dynamic libraries;

[0009] For the target external symbol, obtain the target dynamic library files corresponding to each target dynamic library that defines the target external symbol, and disassemble each target dynamic library file to obtain the assembly code corresponding to the target external symbol in each target dynamic library;

[0010] Determine whether the assembly code corresponding to the target external symbol in each target dynamic library is completely consistent, and determine whether there is a conflict between the target external symbol and each target dynamic library based on the determination result.

[0011] In the preferred embodiment of the above-mentioned method for determining conflicting symbols between dynamic libraries, the step of determining whether the target external symbol conflicts between the target dynamic libraries based on the judgment result includes:

[0012] If the assembly code corresponding to the target external symbol in each target dynamic library is not entirely consistent, then it is determined that there is a conflict between the target external symbol and the target dynamic library.

[0013] If the assembly code corresponding to the target external symbol is completely identical in each target dynamic library, then it is determined that there is no conflict between the target external symbol and each target dynamic library.

[0014] In the preferred embodiment of the above-mentioned method for determining conflicting symbols between dynamic libraries, the step of filtering the acquired external symbols to obtain the target external symbol includes:

[0015] For each acquired external symbol, the external symbol and the name of the dynamic library that defines the external symbol are stored as the first data in a pre-established first table;

[0016] The first data stored in the first table is summarized to obtain the target external symbol.

[0017] In the preferred embodiment of the above-mentioned method for determining conflict symbols between dynamic libraries, before obtaining the external symbols defined in each dynamic library of the target application from the pre-stored dynamic library files of the target application, the method further includes:

[0018] Determine whether the target list is empty; the target list is a list used to store the dynamic library files of the target application.

[0019] If the target list is empty, the process will exit.

[0020] If the target list is not empty, then search for each dynamic library file of the target application that is pre-stored in the target list, and obtain the external symbols defined in each dynamic library of the target application.

[0021] In the preferred embodiment of the above-mentioned method for determining dynamic inter-library conflict symbols, the method further includes:

[0022] For each target external symbol, the target external symbol and the names of the target dynamic libraries that define the target external symbol are stored as second data in a pre-established second table.

[0023] In the preferred embodiment of the above-mentioned method for determining conflicting symbols between dynamic libraries, if it is determined that the target external symbol conflicts between the target dynamic libraries, the method further includes:

[0024] Add a first tag to the target second data stored in the second table; wherein, the target second data is the second data corresponding to the target external symbol that conflicts between the target dynamic libraries.

[0025] In the preferred embodiment of the above-mentioned method for determining conflict symbols between dynamic libraries, the method further includes:

[0026] Output the target second data with the first mark added to the second table.

[0027] According to a second aspect of the present invention, the present invention provides a dynamic inter-library conflict symbol determination apparatus, comprising:

[0028] The acquisition module is used to acquire external symbols defined in each dynamic library of the target application from each dynamic library file of the target application that are stored in advance;

[0029] The filtering module is used to filter the acquired external symbols to obtain target external symbols; wherein, the target external symbols are external symbols that are repeatedly defined in multiple dynamic libraries;

[0030] The processing module is used to obtain the target dynamic library files corresponding to each target dynamic library that defines the target external symbol for each target external symbol, and to disassemble each target dynamic library file to filter and obtain the assembly code corresponding to the target external symbol in each target dynamic library.

[0031] The determination module is used to determine whether the assembly code corresponding to the target external symbol in each target dynamic library is completely consistent, and to determine whether there is a conflict between the target external symbol and each target dynamic library based on the determination result.

[0032] According to a third aspect of the present invention, the present invention provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the dynamic inter-library conflict symbol determination method as described in any of the first aspects of the present invention.

[0033] According to a fourth aspect of the present invention, the present invention provides a computer program product, including a computer program that, when executed by a processor, implements the dynamic inter-library conflict symbol determination method as described in any of the first aspects of the present invention.

[0034] Those skilled in the art will understand that the method, apparatus, device, and storage medium for determining conflicting symbols between dynamic libraries of the present invention, from pre-stored dynamic library files of a target application, filters out target external symbols that are repeatedly defined in multiple dynamic libraries, disassembles each target dynamic library file containing the target external symbol to obtain the corresponding assembly code for the target external symbol in each target dynamic library, and determines the conflicting target external symbols between the target dynamic libraries by judging whether the corresponding assembly code for the target external symbol in each target dynamic library is completely consistent. In the above method, by disassembling each target dynamic library file containing the target external symbol to obtain the corresponding assembly code for the target external symbol in each target dynamic library, the conflicting target external symbols between the target dynamic libraries can be determined. Therefore, developers can only rename the conflicting target external symbols between the target dynamic libraries, saving application development time and resources and improving work efficiency. Attached Figure Description

[0035] Preferred embodiments of the dynamic inter-library conflict symbol determination method, apparatus, device, and storage medium of the present invention will now be described with reference to the accompanying drawings. The drawings are as follows:

[0036] Figure 1 A schematic diagram illustrating an application scenario of the dynamic inter-library conflict symbol determination method provided in an embodiment of the present invention;

[0037] Figure 2 A flowchart illustrating a method for determining dynamic inter-library conflict symbols provided in an embodiment of the present invention;

[0038] Figure 3 A flowchart illustrating another method for determining dynamic inter-library conflict symbols provided in an embodiment of the present invention;

[0039] Figure 4 A flowchart illustrating another method for determining dynamic inter-library conflict symbols provided in an embodiment of the present invention;

[0040] Figure 5 This is a schematic diagram of a dynamic inter-library conflict symbol determination device provided in an embodiment of the present invention;

[0041] Figure 6 This is a schematic diagram of an electronic device provided in one embodiment of the present invention. Detailed Implementation

[0042] First, those skilled in the art should understand that these embodiments are merely for explaining the technical principles of the present invention and are not intended to limit the scope of protection of the present invention. Those skilled in the art can make adjustments as needed to adapt to specific application scenarios.

[0043] Furthermore, it should be noted that, in the description of this invention, unless otherwise explicitly specified and limited, the terms "connected" and "linked" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; and they can refer to the internal connection of two components. Those skilled in the art can understand the specific meaning of the above terms in this invention according to the specific circumstances.

[0044] First, the terms used in this invention will be explained:

[0045] 1) Dynamic library, also known as a dynamic link library, is a type of library used in applications.

[0046] An application (or app) is an executable program used to support the main program during runtime. The core files used by an application during runtime are generally divided into two categories: executable programs and resource files. Resource files are the carriers of various data needed during application runtime, such as images, audio, video, documents, database files, configuration files, etc. The executable program file contains the main program file, which is called by the system to start and run the application. The rest are executable programs used to support the main program (or the main program's dependencies), one common type of supporting executable program being dynamic libraries.

[0047] 2) External symbols refer to symbols that are visible, accessible, and callable both inside and outside the dynamic library (symbols include functions, global variables, constants, classes, etc.). Based on the location where external symbols are defined, they can be divided into external symbols defined in the dynamic library and external symbols not defined in the dynamic library.

[0048] 3) "Multiple" refers to two or more, and other quantifiers are similar. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone. The character " / " generally indicates that the preceding and following objects have an "or" relationship.

[0049] 4) “Correspondence” can refer to an association or binding relationship. A and B correspond to each other, which means that there is an association or binding relationship between A and B.

[0050] The application scenarios of the embodiments of the present invention are explained below:

[0051] Figure 1 This diagram illustrates an application scenario of the dynamic library conflict symbol determination method provided in this embodiment of the invention. Typically, an application can have multiple dynamic libraries. Therefore, for external symbols defined in one dynamic library, there may be cases where the same external symbol is defined repeatedly in two or more dynamic libraries. If the definitions of external symbols are different in two or more dynamic libraries, that is, if there is a conflict between the external symbols, it will cause the application to malfunction or even terminate.

[0052] Therefore, to avoid symbol conflicts, developers need to rename all external symbols in dynamic libraries. However, dynamic libraries often contain a large number of external symbols that do not conflict with other dynamic libraries. Renaming these external symbols would waste time and resources, impacting work efficiency. Therefore, it is necessary to identify the external symbols that conflict with each dynamic library. For example... Figure 1 As shown in the figure, the target list 1 and server 2 are included, and server 2 is equipped with a dynamic inter-library conflict symbol determination device.

[0053] Target list 1 is a list used to store the dynamic library files of the target application. The dynamic library conflict symbol determination device can be mounted in server 2. It is used to retrieve external symbols defined in each dynamic library of the target application from the dynamic library files stored in target list 1, filter out external symbols that are repeatedly defined in multiple dynamic libraries, disassemble the target dynamic library files containing the target external symbols to obtain the corresponding assembly code for each target dynamic library, determine whether the corresponding assembly code for each target external symbol is completely consistent, and thus identify the target external symbols that conflict between the target dynamic libraries.

[0054] The technical solution of the present invention and how the technical solution of the present invention solves the above-mentioned technical problems are described in detail below with specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments. The embodiments of the present invention will now be described with reference to the accompanying drawings.

[0055] Figure 2 This is a flowchart illustrating a method for determining dynamic inter-library conflict symbols provided in an embodiment of the present invention, as shown below. Figure 2 As shown, the method for determining dynamic inter-library conflict symbols provided in this embodiment includes the following steps:

[0056] Step S201: Obtain the external symbols defined in each dynamic library of the target application from the pre-stored dynamic library files of the target application.

[0057] Step S202: Filter the obtained external symbols to obtain target external symbols; wherein, the target external symbols are external symbols that are repeatedly defined in multiple dynamic libraries.

[0058] Step S203: For the target external symbol, obtain the target dynamic library files corresponding to each target dynamic library that defines the target external symbol, and disassemble each target dynamic library file to obtain the assembly code corresponding to the target external symbol in each target dynamic library.

[0059] Step S204: Determine whether the assembly code corresponding to the target external symbol in each target dynamic library is completely consistent, and determine whether there is a conflict between the target external symbol and each target dynamic library based on the determination result.

[0060] It should be noted that the execution subject of the dynamic inter-library conflict symbol determination method provided in this embodiment can be a dynamic inter-library conflict symbol determination device. In practical applications, this dynamic inter-library conflict symbol determination device can be implemented by a computer program, such as application software, or by a medium storing the relevant computer program, such as a USB flash drive or optical disc, or by a physical device integrating or installing the relevant computer program, such as a chip.

[0061] In this embodiment, since renaming all external symbols in the dynamic library of the target application during the construction of the target application would waste a lot of time and resources, in order to avoid unnecessary waste of resources and improve work efficiency, only the external symbols that conflict between the dynamic libraries can be renamed. Therefore, it is necessary to identify the external symbols that conflict between the dynamic libraries.

[0062] Specifically, the dynamic library conflict symbol determination device can first obtain the external symbols defined in each dynamic library of the target application from the pre-stored dynamic library files of the target application.

[0063] The dynamic library files of the target application can be pre-stored in the database, either as a list or in other suitable manner; this embodiment does not limit this.

[0064] In addition, external symbols defined in the target application's dynamic libraries may include, but are not limited to, functions, classes, and global variables and constants.

[0065] In one example, the target application has four dynamic libraries, namely dynamic library A, dynamic library B, dynamic library C and dynamic library D. The dynamic library files of the four dynamic libraries are pre-stored in a list in the database. Each dynamic library file contains a sublist storing the external symbols defined in the current dynamic library. The dynamic library conflict symbol determination device can obtain all the external symbols defined in the four dynamic libraries of the target application from the sublist of the four dynamic library files.

[0066] After the dynamic library conflict symbol determination device obtains the external symbols defined in each dynamic library of the target application, it can filter the obtained external symbols to obtain the target external symbols. The specific filtering method will be defined in other embodiments of the present invention and will not be described in detail here.

[0067] In this context, the target external symbol is an external symbol that is repeatedly defined in multiple dynamic libraries. Continuing the previous example, the dynamic library conflict symbol determination device filters all external symbols defined in the four dynamic libraries of the target application, obtaining three target external symbols: target external symbol m, target external symbol p, and target external symbol q. Specifically, target external symbol m is an external symbol repeatedly defined in dynamic libraries A and B; target external symbol p is an external symbol repeatedly defined in dynamic libraries A, B, and C; and target external symbol q is an external symbol repeatedly defined in dynamic libraries B and C.

[0068] It should be noted that if the dynamic library conflict symbol determination device does not obtain the target external symbol after filtering the acquired external symbols, that is, there is no external symbol that is repeatedly defined in multiple dynamic libraries among the external symbols defined in each dynamic library of the target application, the dynamic library conflict symbol determination device can exit the process.

[0069] After the dynamic library conflict symbol determination device filters and obtains the target external symbols, it can obtain the target dynamic library files corresponding to each target dynamic library that defines the target external symbol for each target external symbol, and perform disassembly processing on each target dynamic library file to filter and obtain the assembly code corresponding to the target external symbol in each target dynamic library.

[0070] Continuing with the previous example, after the dynamic library conflict symbol determination device obtains the target external symbol m, the target external symbol p, and the target external symbol q, for the target external symbol m, since the target external symbol m is an external symbol that is repeatedly defined in dynamic libraries A and B, the dynamic library conflict symbol determination device can take dynamic libraries A and B as target dynamic libraries, and obtain the dynamic library files corresponding to dynamic libraries A and B from the list of the four dynamic library files stored above, that is, the target dynamic library files, and disassemble the dynamic library files corresponding to dynamic libraries A and B respectively to obtain the assembly code of the dynamic library files corresponding to dynamic libraries A and B respectively.

[0071] Specifically, the dynamic library conflict symbol determination device can disassemble the target dynamic library file by calling disassembler software, or it can disassemble the target dynamic library file by other suitable methods. This embodiment does not limit this.

[0072] After obtaining the assembly code of the dynamic library file corresponding to dynamic library A and the assembly code of the dynamic library file corresponding to dynamic library B, the dynamic library conflict symbol determination device can filter out the assembly code corresponding to the target external symbol m from the assembly code of the dynamic library file corresponding to dynamic library A, and then filter out the assembly code corresponding to the target external symbol m from the assembly code of the dynamic library file corresponding to dynamic library B.

[0073] For the target external symbol p, which is an external symbol repeatedly defined in three dynamic libraries A, B, and C, since the dynamic library conflict symbol determination device has already obtained the assembly code of the dynamic library file corresponding to dynamic library A and the assembly code of the dynamic library file corresponding to dynamic library B, it is only necessary to obtain the dynamic library file corresponding to dynamic library C in the above manner, disassemble the dynamic library file corresponding to dynamic library C to obtain the assembly code of the dynamic library file corresponding to dynamic library C, and then filter out the assembly code corresponding to the target external symbol p from the assembly code of the dynamic library files corresponding to dynamic libraries A, B, and C respectively.

[0074] For the target external symbol q, which is an external symbol that is repeatedly defined in two dynamic libraries, dynamic library B and dynamic library C, since the dynamic library conflict symbol determination device has previously obtained the assembly code of the dynamic library file corresponding to dynamic library B and the assembly code of the dynamic library file corresponding to dynamic library C, the assembly code corresponding to the target external symbol q can be directly obtained from the assembly code of the dynamic library files corresponding to dynamic library B and dynamic library C respectively.

[0075] In an optional implementation, the dynamic library conflict symbol determination device can first acquire the dynamic library files corresponding to dynamic library A, dynamic library B, and dynamic library C, respectively, and disassemble the dynamic library files corresponding to dynamic library A, dynamic library B, and dynamic library C to obtain the assembly code of the dynamic library files corresponding to dynamic library A, dynamic library B, and dynamic library C, respectively. Then, from the assembly code of the dynamic library file corresponding to dynamic library A, the assembly code corresponding to the target external symbol m and the target external symbol p is obtained; from the assembly code of the dynamic library file corresponding to dynamic library B, the assembly code corresponding to the target external symbol m, the target external symbol p, and the target external symbol q is obtained; and from the assembly code of the dynamic library file corresponding to dynamic library C, the assembly code corresponding to the target external symbol p and the target external symbol q is obtained.

[0076] After the dynamic library conflict symbol determination device obtains the corresponding assembly code of each target external symbol in each target dynamic library, it can determine whether the corresponding assembly code of the target external symbol in each target dynamic library is completely consistent, and determine whether there is a conflict between the target external symbols in each target dynamic library based on the judgment result.

[0077] In one possible scenario, if the assembly code corresponding to the target external symbol in each target dynamic library is not entirely consistent, the dynamic library conflict symbol determination device can determine that there is a conflict between the target external symbols in each target dynamic library.

[0078] Correspondingly, in another possible case, if the assembly code corresponding to the target external symbol is completely consistent in each target dynamic library, then the dynamic library conflict symbol determination device can determine that there is no conflict between the target external symbols in each target dynamic library.

[0079] Continuing with the previous example, for the target external symbol m, after obtaining the corresponding assembly code of the target external symbol m in dynamic library A and dynamic library B respectively, the dynamic library conflict symbol determination device can determine whether the corresponding assembly code of the target external symbol m in dynamic library A and dynamic library B is consistent. If they are inconsistent, it means that the definition of the target external symbol m in dynamic library A and dynamic library B is different. For example, the value defined in dynamic library A is 2, and the value defined in dynamic library B is 0. Then the dynamic library conflict symbol determination device can determine that there is a conflict between dynamic library A and dynamic library B for the target external symbol m.

[0080] For a target external symbol p, if the dynamic library conflict symbol determination device determines that the assembly code corresponding to the target external symbol p in dynamic library A and dynamic library B is consistent, but the assembly code corresponding to the target external symbol p in dynamic library C is inconsistent with the assembly code corresponding to the target external symbol p in dynamic library A and dynamic library B, that is, the assembly code corresponding to the target external symbol p in dynamic library A, dynamic library B and dynamic library C is not entirely consistent, then it is determined that there is a conflict between the target external symbol m in dynamic library A, dynamic library B and dynamic library C.

[0081] If the dynamic library conflict symbol determination device determines that the assembly code corresponding to the target external symbol q in dynamic library B and dynamic library C is consistent, it indicates that the definition of the target external symbol q is the same in dynamic library B and dynamic library C. Then the dynamic library conflict symbol determination device can determine that there is no conflict between the target external symbol q in dynamic library B and dynamic library C.

[0082] The method for determining conflicting symbols between dynamic libraries provided in this embodiment filters out target external symbols that are repeatedly defined in multiple dynamic libraries from the pre-stored dynamic library files of the target application. It then disassembles each target dynamic library file containing the target external symbol to obtain the corresponding assembly code for that symbol in each dynamic library. By determining whether all the assembly codes corresponding to the target external symbol in each dynamic library are identical, the conflicting target external symbols between the target dynamic libraries are identified. This method, by disassembling each target dynamic library file containing the target external symbol to obtain the corresponding assembly code, can identify conflicting target external symbols between the target dynamic libraries. Therefore, developers can only rename the conflicting target external symbols, saving application development time and resources and improving work efficiency.

[0083] In one alternative implementation, Figure 2 Step S202 can be achieved through the following steps. For example... Figure 3 As shown, Figure 3 This is a flowchart illustrating another method for determining dynamic inter-library conflict symbols provided in an embodiment of the present invention, namely, a possible implementation of step S202.

[0084] Step S2021: For each acquired external symbol, store the external symbol and the name of the dynamic library that defines the external symbol as the first data in a pre-established first table.

[0085] Step S2022: Summarize the first data stored in the first table to obtain the target external symbol.

[0086] In this embodiment, in order to obtain the target external symbol that is repeatedly defined in multiple dynamic libraries from the acquired external symbols, the dynamic library conflict symbol determination device can filter the acquired external symbols.

[0087] Specifically, the dynamic library conflict symbol determination device can, for each acquired external symbol, store the current external symbol and the name of the dynamic library that defines the current external symbol as the first data in a pre-established first table.

[0088] Continuing with the example from the previous embodiment, the external symbols obtained by the dynamic library conflict symbol determination device from dynamic library A include a, m, and p; from dynamic library B, they include c, m, p, and q; from dynamic library C, they include d, p, and q; and from dynamic library D, they include e and f. At this time, the dynamic library conflict symbol determination device can store the external symbol a and the name of the dynamic library A that defines external symbol a as a first data entry into a pre-established first table; store the external symbol m and the name of the dynamic library A that defines external symbol m as another first data entry into the pre-established first table; store the external symbol p and the name of the dynamic library A that defines external symbol p as yet another first data entry into the pre-established first table, and so on. The same process is applied to external symbols d, p, q, e, and f.

[0089] At this time, the dynamic library conflict symbol determination device can use the summary function of the first table to summarize the first data stored in the first table. For example, it can summarize the external symbols that appear repeatedly in the first table, that is, the target external symbols that are repeatedly defined in multiple dynamic libraries, such as the external symbol m, external symbol p and external symbol q in the example above.

[0090] Using the above method, target external symbols that are repeatedly defined in multiple dynamic libraries can be accurately screened from the obtained external symbols, laying the foundation for further identification of conflicting symbols between dynamic libraries.

[0091] In one alternative implementation, in Figure 3 After step S2022, the method may further include: for each target external symbol, storing the target external symbol and the name of each target dynamic library that defines the target external symbol as a second data in a pre-established second table.

[0092] In the above example, after the dynamic library conflict symbol determination device summarizes the first data stored in the first table, it can obtain eight pieces of first data, namely, the first data corresponding to the target external symbol m and the name of the dynamic library A that defines the target external symbol m, the first data corresponding to the target external symbol m and the name of the dynamic library B that defines the target external symbol m, the first data corresponding to the target external symbol p and the name of the dynamic library A that defines the target external symbol p, the first data corresponding to the target external symbol p and the name of the dynamic library B that defines the target external symbol p, the first data corresponding to the target external symbol p and the name of the dynamic library C that defines the target external symbol p, the first data corresponding to the target external symbol q and the name of the dynamic library B that defines the target external symbol q, and the first data corresponding to the target external symbol q and the name of the dynamic library C that defines the target external symbol q.

[0093] In this embodiment, in order to more intuitively and clearly show the correspondence between each target external symbol and the dynamic library that defines the current target external symbol, the dynamic library conflict symbol determination device can store the target external symbol and the name of each target dynamic library that defines the current target external symbol as the second data in a pre-established second table for each target external symbol.

[0094] For example, the target external symbol m and the names of the target dynamic libraries that define the target external symbol m, i.e., the names of dynamic library A and dynamic library B, are stored as a second data entry in a pre-established second table. The target external symbol p and the names of the target dynamic libraries that define the target external symbol p, i.e., the names of dynamic library A, dynamic library B, and dynamic library C, are stored as another second data entry in a pre-established second table. The target external symbol q and the names of the target dynamic libraries that define the target external symbol q, i.e., the names of dynamic library B and dynamic library C, are stored as yet another second data entry in a pre-established second table. In other words, the second table can ultimately store three second data entries.

[0095] In one alternative implementation, in Figure 2 In step S205, if it is determined that the target external symbol conflicts among the target dynamic libraries, the method further includes: adding a first mark to the target second data stored in the second table; wherein the target second data is the second data corresponding to the target external symbol that conflicts among the target dynamic libraries.

[0096] In this embodiment, if the dynamic library conflict symbol determination device determines that there is a conflict between the target external symbols in each target dynamic library, then a first mark is added to the second data corresponding to the target external symbols that conflict between each target dynamic library, that is, the target second data stored in the second table, to indicate that the target external symbol is a conflict symbol. Specifically, the first mark can be a numerical mark, such as 0 or 1, or other types of marks. This embodiment does not limit this.

[0097] In an optional implementation, the method further includes: outputting target second data with a first tag added to the second table.

[0098] In this embodiment, in order to enable developers to promptly learn about conflict symbols in dynamic libraries and rename them, the dynamic library conflict symbol determination device can also output the target second data with the first mark added after adding a first mark to the target second data stored in the second table. This allows developers to obtain the conflict symbols and the dynamic libraries that define the conflict symbols without having to check the second table themselves, thereby enabling them to quickly locate and rename the conflict symbols, further improving work efficiency.

[0099] Figure 4 A flowchart illustrating another method for determining dynamic inter-library conflict symbols provided in an embodiment of the present invention is shown below. Figure 4 As shown, in one alternative implementation, in Figure 2 Before step S201, the following steps may also be included:

[0100] Step S401: Determine whether the target list is empty; the target list is a list used to store the dynamic library files of the target application.

[0101] Step S402: If the target list is empty, exit the process.

[0102] Step S403: If the target list is not empty, search for each dynamic library file of the target application that is pre-stored in the target list, and obtain the external symbols defined in each dynamic library of the target application.

[0103] In this embodiment, each dynamic library file of the target application is pre-stored in a target list in the database. The dynamic library conflict symbol determination device can first determine whether the target list is empty. In one possible case, the target list is empty, which indicates that the target application does not have dynamic libraries. At this time, the dynamic library conflict symbol determination device can exit the process.

[0104] In another possible scenario, if the target list is not empty, it indicates that the target application has dynamic libraries. In this case, the dynamic library conflict symbol determination device can search for each dynamic library file of the target application that is pre-stored in the target list and obtain the external symbols defined in each dynamic library of the target application. The specific method of obtaining these symbols has been described in the above embodiments of the present invention and will not be repeated here.

[0105] The dynamic library conflict symbol determination method provided in this embodiment determines whether to exit the process by judging whether the target list is empty, thereby eliminating the need for further processing of applications that do not have dynamic libraries and effectively avoiding resource waste.

[0106] Figure 5 This is a schematic diagram of a dynamic inter-library conflict symbol determination device provided in an embodiment of the present invention, as shown below. Figure 5 As shown, the dynamic inter-library conflict symbol determination device provided in this embodiment includes:

[0107] The acquisition module 51 is used to acquire external symbols defined in each dynamic library of the target application from each dynamic library file of the target application that is stored in advance.

[0108] The filtering module 52 is used to filter the acquired external symbols to obtain target external symbols; wherein the target external symbols are external symbols that are repeatedly defined in multiple dynamic libraries.

[0109] The processing module 53 is used to obtain the target dynamic library files corresponding to each target dynamic library that defines the target external symbol, and to disassemble each target dynamic library file to obtain the assembly code corresponding to the target external symbol in each target dynamic library.

[0110] The determination module 54 is used to determine whether the assembly code corresponding to the target external symbol in each target dynamic library is completely consistent, and to determine whether there is a conflict between the target external symbol and each target dynamic library based on the determination result.

[0111] In the preferred embodiment of the above-mentioned dynamic library conflict symbol determination device, the determination module 54 is specifically used to determine that if the assembly code corresponding to the target external symbol in each target dynamic library is not entirely consistent, then the target external symbol is determined to have a conflict between each target dynamic library; if the assembly code corresponding to the target external symbol in each target dynamic library is entirely consistent, then the target external symbol is determined to have no conflict between each target dynamic library.

[0112] In the preferred embodiment of the above-mentioned dynamic library conflict symbol determination device, the filtering module 52 includes a storage unit 521, which is used to store the external symbol and the name of the dynamic library that defines the external symbol as the first data in a pre-established first table for each acquired external symbol.

[0113] The filtering module 52 also includes a summarizing unit 522, which is used to summarize the first data stored in the first table to obtain the target external symbol.

[0114] In the preferred embodiment of the above-mentioned dynamic library conflict symbol determination device, the device further includes: a judgment module 55, used to judge whether the target list is empty; the target list is a list used to store each dynamic library file of the target application; an exit module 56, used to exit the process if the target list is empty; and an acquisition module 51, specifically used to search for each dynamic library file of the target application that is pre-stored in the target list if the target list is not empty, and to acquire the external symbols defined in each dynamic library of the target application.

[0115] In a preferred embodiment of the above-mentioned dynamic library conflict symbol determination device, the device further includes: a storage module 57, used to store the target external symbol and the name of each target dynamic library that defines the target external symbol as a second data in a pre-established second table for each target external symbol.

[0116] In the preferred embodiment of the above-mentioned dynamic inter-library conflict symbol determination device, the device further includes: an adding module 58, used to add a first mark to the target second data stored in the second table; wherein, the target second data is the second data corresponding to the target external symbol that conflicts between the target dynamic libraries.

[0117] In the preferred embodiment of the above-mentioned dynamic inter-library conflict symbol determination device, the device further includes: an output module 59, used to output the target second data with the first mark added to the second table.

[0118] It should be noted that the technical solution and effects of the dynamic inter-library conflict symbol determination device provided in this embodiment can be found in the relevant content of the foregoing method embodiments, and will not be repeated here.

[0119] Figure 6 A schematic diagram of an electronic device provided in one embodiment of the present invention, as shown below. Figure 6 As shown, the electronic device provided in this embodiment includes a memory 601 and a processor 602.

[0120] Memory 601 is used to store programs. Specifically, the program may include program code, which includes computer-executable instructions. Memory 601 may include high-speed RAM memory, and may also include non-volatile memory, such as at least one disk storage device.

[0121] Processor 602 is used to execute programs stored in memory 601.

[0122] The computer program is stored in memory 601 and configured to be executed by processor 502 to implement the present invention. Figures 2-4 The corresponding embodiments provide a method for determining dynamic inter-library conflict symbols. Related explanations can be found in the relevant documentation. Figures 2-4 The relevant descriptions and effects of the steps in the text will be understood, and will not be elaborated on here.

[0123] In this embodiment, the memory 601 and the processor 602 are connected via a bus. The bus can be an Industry Standard Architecture (ISA) bus, 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, Figure 6 The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.

[0124] One embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon, the computer program being executed by a processor to implement the present invention. Figures 2-4 The dynamic inter-library conflict symbol determination method provided in any of the corresponding embodiments.

[0125] The computer-readable storage medium can be ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, and optical data storage device, etc.

[0126] This invention provides an embodiment of a computer program product, including a computer program that is executed by a processor to implement the invention. Figures 2-4 The dynamic inter-library conflict symbol determination method provided in any of the corresponding embodiments.

[0127] In the several embodiments provided by this invention, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of modules is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple modules or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or modules may be electrical, mechanical, or other forms.

[0128] Other embodiments of the invention will readily occur to those skilled in the art upon consideration of the specification and practice of the applications disclosed herein. This invention is intended to cover any variations, uses, or adaptations of the invention that follow the general principles of the invention and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of the invention are indicated by the following claims.

[0129] It should be understood that the present invention is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of the invention is limited only by the appended claims.

[0130] The technical solution of the present invention has been described above with reference to the preferred embodiments shown in the accompanying drawings. However, it will be readily understood by those skilled in the art that the scope of protection of the present invention is obviously not limited to these specific embodiments. Without departing from the principles of the present invention, those skilled in the art can make equivalent changes or substitutions to the relevant technical features, and the technical solutions after these changes or substitutions will all fall within the scope of protection of the present invention.

Claims

1. A method for determining dynamic inter-library conflict symbols, characterized in that, include: Determine if the target list is empty; the target list is a list used to store the dynamic library files of the target application. If the target list is empty, the process will exit. If the target list is not empty, then search for each dynamic library file of the target application that is pre-stored in the target list, and obtain the external symbols defined in each dynamic library of the target application; The obtained external symbols are filtered to obtain target external symbols; wherein, the target external symbols are external symbols that are repeatedly defined in multiple dynamic libraries; For the target external symbol, obtain the target dynamic library files corresponding to each target dynamic library that defines the target external symbol, and call disassembler software to disassemble each target dynamic library file respectively, and filter to obtain the assembly code corresponding to the target external symbol in each target dynamic library; Determine whether the assembly code corresponding to the target external symbol in each target dynamic library is completely consistent. If the assembly code corresponding to the target external symbol in each target dynamic library is not completely consistent, then it is determined that there is a conflict between the target external symbol and the target dynamic library. If the assembly code corresponding to the target external symbol is completely identical in each target dynamic library, then it is determined that there is no conflict between the target external symbol and each target dynamic library.

2. The method for determining dynamic inter-library conflict symbols according to claim 1, characterized in that, The step of filtering the acquired external symbols to obtain the target external symbols includes: For each acquired external symbol, the external symbol and the name of the dynamic library that defines the external symbol are stored as the first data in a pre-established first table; The first data stored in the first table is summarized to obtain the target external symbol.

3. The method for determining dynamic inter-library conflict symbols according to claim 2, characterized in that, After summarizing the first data stored in the first table to obtain the target external symbol, the process further includes: For each target external symbol, the target external symbol and the names of the target dynamic libraries that define the target external symbol are stored as second data in a pre-established second table.

4. The method for determining dynamic inter-library conflict symbols according to claim 3, characterized in that, If it is determined that the target external symbol conflicts among the target dynamic libraries, the method further includes: Add a first tag to the target second data stored in the second table; wherein, the target second data is the second data corresponding to the target external symbol that conflicts between the target dynamic libraries.

5. The method for determining dynamic inter-library conflict symbols according to claim 4, characterized in that, The method further includes: Output the target second data with the first mark added to the second table.

6. A dynamic inter-library conflict symbol determination device, characterized in that, include: The acquisition module is used to acquire external symbols defined in each dynamic library of the target application from each dynamic library file of the target application that are stored in advance; The filtering module is used to filter the acquired external symbols to obtain target external symbols; wherein, the target external symbols are external symbols that are repeatedly defined in multiple dynamic libraries; The processing module is used to obtain the target dynamic library files corresponding to each target dynamic library that defines the target external symbol for each target external symbol, and call the disassembler to disassemble each target dynamic library file respectively, and filter to obtain the assembly code corresponding to the target external symbol in each target dynamic library; The determination module is used to determine whether the assembly code corresponding to the target external symbol in each target dynamic library is completely consistent. If the assembly code corresponding to the target external symbol in each target dynamic library is not completely consistent, it is determined that there is a conflict between the target external symbol and the target dynamic library. If the assembly code corresponding to the target external symbol in each target dynamic library is completely consistent, it is determined that there is no conflict between the target external symbol and the target dynamic library. The device further includes: a judgment module, used to judge whether the target list is empty; the target list is a list used to store the dynamic library files of the target application; and an exit module, used to exit the process if the target list is empty. The acquisition module is specifically used to, if the target list is not empty, search for each dynamic library file of the target application that is pre-stored in the target list, and obtain the external symbols defined in each dynamic library of the target application.

7. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the dynamic inter-library conflict symbol determination method as described in any one of claims 1-5.

8. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by the processor, it implements the dynamic inter-library conflict symbol determination method as described in any one of claims 1-5.

Citation Information

Patent Citations

  • ELF binary library file symbol conflict detection method and system and medium

    CN112925707A