WO2022116437A1 - Multi-architecture static library conflict processing method and apparatus, device, and storage medium - Google Patents

Multi-architecture static library conflict processing method and apparatus, device, and storage medium Download PDF

Info

Publication number
WO2022116437A1
WO2022116437A1 PCT/CN2021/083792 CN2021083792W WO2022116437A1 WO 2022116437 A1 WO2022116437 A1 WO 2022116437A1 CN 2021083792 W CN2021083792 W CN 2021083792W WO 2022116437 A1 WO2022116437 A1 WO 2022116437A1
Authority
WO
WIPO (PCT)
Prior art keywords
symbol
architecture
static library
symbol table
static
Prior art date
Application number
PCT/CN2021/083792
Other languages
French (fr)
Chinese (zh)
Inventor
吴烁宇
Original Assignee
平安科技(深圳)有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 平安科技(深圳)有限公司 filed Critical 平安科技(深圳)有限公司
Publication of WO2022116437A1 publication Critical patent/WO2022116437A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/71Version control; Configuration management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/43Checking; Contextual analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/77Software metrics

Definitions

  • the present application relates to the field of artificial intelligence, and in particular, to a multi-architecture static library conflict processing method, apparatus, device and storage medium.
  • the inventor realizes that the existing methods for dealing with static library conflicts have limitations, and the static libraries processed by the existing static library conflict processing methods usually require a lot of manual verification work, and need to be modified and tested repeatedly. , it can be used normally, and there may be the risk that business functions cannot be used normally, and the processing efficiency is low, and it cannot meet the requirements of minimal changes and rapid and stable launch of complex services.
  • the main purpose of this application is to solve the technical problems of low efficiency and poor stability in handling static library conflicts.
  • a first aspect of the present application provides a multi-architecture static library conflict processing method, and the multi-architecture static library conflict processing method includes:
  • the target files in the target file list corresponding to each single-architecture static library are recompressed to obtain multiple non-conflicting new single-architecture static libraries, and the new single-architecture static libraries are merged into a new multi-architecture static library.
  • a second aspect of the present application provides a multi-architecture static library conflict processing apparatus, and the multi-architecture static library conflict processing apparatus includes:
  • an extraction module configured to scan each multi-architecture static library respectively, extract a multi-architecture static library list with static library conflicts, and separate each multi-architecture static library in the multi-architecture static library list into a plurality of single-architecture static libraries;
  • an update module for extracting the first symbol tables of the single-architecture static libraries, and updating the reference symbols for the first symbol tables of the single-architecture static libraries to obtain a second symbol table with dependencies
  • a decompression module used for decompressing the single-architecture static libraries, and extracting the target file list of each single-architecture static library and the third symbol table corresponding to each target file from the decompression result;
  • a modification module configured to modify the symbol name, symbol structure size and memory start address of the corresponding symbol in the third symbol table with reference to the second symbol table;
  • the compression module is used to recompress the target files in the target file list corresponding to each single-architecture static library, obtain a plurality of non-conflicting new single-architecture static libraries, and merge the new single-architecture static libraries into new multi-architecture static libraries.
  • Architecture static library
  • a third aspect of the present application provides a multi-architecture static library conflict processing device, comprising: a memory and at least one processor, where an instruction is stored in the memory; the at least one processor invokes the instruction in the memory, So that the multi-architecture static library conflict processing device executes the steps of the multi-architecture static library conflict processing method as shown below:
  • the target files in the target file list corresponding to each single-architecture static library are recompressed to obtain multiple non-conflicting new single-architecture static libraries, and the new single-architecture static libraries are merged into a new multi-architecture static library.
  • a fourth aspect of the present application provides a computer-readable storage medium, where instructions are stored in the computer-readable storage medium, when the computer-readable storage medium runs on a computer, the computer executes the multi-architecture static library conflict processing method shown below A step of:
  • the target files in the target file list corresponding to each single-architecture static library are recompressed to obtain multiple non-conflicting new single-architecture static libraries, and the new single-architecture static libraries are merged into a new multi-architecture static library.
  • the conflicting multi-architecture static libraries are first separated into single-architecture static libraries. Since there may be interdependencies between the single-architecture static libraries, all the symbol tables of the single-architecture static libraries need to be checked. The reference symbol is updated to get the symbol table with dependencies. Then, according to the symbol table with dependencies, match the object file decompressed from the single-architecture static library, and rename the symbols in the matched object file, so as to solve the symbol conflict between multi-architecture static libraries The problem.
  • the present application uniformly renames the object file symbols in the conflicting multi-architecture static library, thereby efficiently generating a new stable multi-architecture static library.
  • FIG. 1 is a schematic diagram of a first embodiment of a multi-architecture static library conflict processing method in an embodiment of the present application
  • FIG. 2 is a schematic diagram of a second embodiment of a method for handling multi-architecture static library conflicts in an embodiment of the present application
  • FIG. 3 is a schematic diagram of an embodiment of a multi-architecture static library conflict processing apparatus in an embodiment of the present application
  • FIG. 4 is a schematic diagram of an embodiment of a multi-architecture static library conflict processing device in an embodiment of the present application.
  • Embodiments of the present application provide a method, apparatus, device, and storage medium for dealing with multi-architecture static library conflicts. "Three", “fourth”, etc., if present, are used to distinguish similar objects and are not necessarily used to describe a particular order or sequence. It is to be understood that data so used may be interchanged under appropriate circumstances so that the embodiments described herein can be practiced in sequences other than those illustrated or described herein.
  • the first embodiment of the method for handling multi-architecture static library conflicts in the embodiment of the present application includes:
  • the execution body of the present application may be a multi-architecture static library conflict processing device, and may also be a terminal or a server, which is not specifically limited here.
  • the embodiments of the present application take the server as an execution subject as an example for description.
  • the static library provided to the application for reference may be composed of several sub-static libraries as the basic unit of compilation, and a static library is composed of compressed object files (.o files).
  • a static library is composed of compressed object files (.o files).
  • the multi-architecture (Fat) static library is composed of multiple single-architecture (Thin) static libraries packaged. Therefore, if there are several sub-static libraries, the Thin static library needs to be extracted separately for each sub-static library.
  • the Thin static library under different CPU architectures may have differences in code implementation, and the symbol table needs to be processed separately for the single-CPU architecture.
  • step 101 includes:
  • Each multi-architecture static library in the multi-architecture static library list is separated into a plurality of single-architecture static libraries.
  • the symbol list and object file information are checked and compared to confirm that there is a static library where symbols and object files conflict.
  • this interdependence relationship may be determined by the symbol table of each single-architecture static library. For example, when an undefined external symbol identifier b is found in static library A, and the symbol b is an external symbol implemented by internal code in static library B, that is, symbol b is defined in static library B, then it is considered static Library A depends on static library B. When it is recognized that the static library A depends on the static library B, the symbol table update operation needs to be performed. The specific operation method is to extract the symbol table of the static library B, and export and add it to the symbol table of the static library A. Perform the corresponding symbol table update operation for each static library with external dependencies in turn.
  • step 102 includes:
  • the reference symbols are updated on the first symbol tables of the single-architecture static libraries to obtain a second symbol table with dependencies.
  • the static library can be simply regarded as a set of object files (.o), that is, a file formed by many object files after being compressed and packaged.
  • object files a file formed by many object files after being compressed and packaged.
  • the most commonly used C language static library libc is located in /usr/lib/libc.a, which is part of the glibc project.
  • glibc itself is developed in C language, it consists of hundreds of C language source code files, that is to say, after the compilation is completed, there are the same number of object files, such as printf.o, scanf.o for input and output; File operations include fread.o, fwrite.o; time and date include date.o, time.o; memory management includes malloc.o, etc.
  • the ar compression program is usually used to compress these object files together, and number and organize them. Indexing, to facilitate search and retrieval, forms a static library file.
  • the static library can be decompressed through the command line: ar-x ⁇ library.a/binary>, and several object files and symbol tables corresponding to each object file are extracted from the decompression result.
  • the symbol tables of each target file are matched according to the symbols in the second symbol table, and the symbols in the second symbol table included in each target file are matched, and the symbols in the second symbol table are matched according to the symbols in the second symbol table.
  • the preset renaming rules modify the matched symbols.
  • the size of the symbol structure of the new symbol and the starting address of the memory need to be modified accordingly.
  • the target file where the symbol to be modified is located is searched out according to the updated symbol table of the reference symbol, so as to rename the conflicting symbol in the target file.
  • step 104 includes:
  • using each symbol name in the second symbol table as a matching keyword, traversing the third symbol table corresponding to each target file in sequence, and obtaining a matching result includes:
  • S1 take a symbol name of an unmatched symbol in the second symbol table as a matching keyword, and match with a third symbol table corresponding to an unmatched target file to obtain a matching result;
  • the symbol renaming program needs to perform two-layer traversal.
  • the first layer traverses the target file list corresponding to the CPU architecture
  • the second layer traverses the symbol table corresponding to the target file
  • the old symbol name in the single target file is modified to the new symbol name generated according to the naming rule.
  • the symbol renaming program judges the CPU architecture type by reading the Mach-O file structure of the target file, skips the HEADER part, searches for the LC_SYMTAB identifier, and obtains the Symbol Table Offset, and the symbol is in units of nlist/nlist_64 (Defined in mach-o/nlist.h), retrieve the matching symbol names in turn, when the symbol to be modified is found, modify the nlist/nlist_64 structure size and n_un.n_strx as the new symbol name, and readjust the symbol The memory start address of the subsequent symbol structure.
  • modifying the symbol name, symbol structure size and memory start address of the matching symbol corresponding to the matching result according to a preset modification rule includes:
  • the symbol modification rule can be in multiple ways. For example, a modified prefix can be added uniformly on the basis of the original symbol to be modified, and the modified prefix can be customized as a unified prefix symbol, such as " _ ⁇ prefix>".
  • a modified prefix can be added uniformly on the basis of the original symbol to be modified, and the modified prefix can be customized as a unified prefix symbol, such as " _ ⁇ prefix>".
  • it is best to implement the same modification rules for all matched symbols so that the original App application project that directly calls the interface of the newly added module conflicting static library can be used to modify the name of the called class/method/global variable synchronously, for example, Corresponding to the prefix symbol, the " ⁇ prefix>_" prefix is added before the original name.
  • the modified target files are compressed and merged into a single-architecture static library. If there is a single-architecture static library with multiple CPU architectures, the modified single-architecture static library is merged into a multi-architecture static library.
  • the modified single-architecture static library is merged into a multi-architecture static library.
  • multiple multi-architecture static libraries will be merged into one static library as much as possible for unified external output.
  • different single-architecture static libraries will be named with duplicate targets. The file names are renamed and then repackaged into a single multi-arch static library output.
  • the conflicting multi-architecture static libraries are first separated into single-architecture static libraries. Since there may be interdependencies among the single-architecture static libraries, all the symbols need to be referenced to the symbol tables of the single-architecture static libraries. Update to get the symbol table with dependencies. Then, according to the symbol table with dependencies, match the object file decompressed from the single-architecture static library, and rename the symbols in the matched object file, so as to solve the symbol conflict between multi-architecture static libraries The problem.
  • the present application uniformly renames the object file symbols in the conflicting multi-architecture static library, thereby efficiently generating a new stable multi-architecture static library.
  • the second embodiment of the multi-architecture static library conflict processing method in the embodiment of the present application includes:
  • this interdependence relationship may be determined by the symbol table of each single-architecture static library. For example, when an undefined external symbol identifier b is found in static library A, and the symbol b is an external symbol implemented by internal code in static library B, that is, symbol b is defined in static library B, then it is considered static Library A depends on static library B. When it is recognized that the static library A depends on the static library B, the symbol table update operation needs to be performed. The specific operation method is to extract the symbol table of the static library B, and export and add it to the symbol table of the static library A. Perform the corresponding symbol table update operation for each static library with external dependencies in turn.
  • the embodiment of the present application since there may be interdependencies among the single-architecture static libraries, it is necessary to export the external symbol tables of the static libraries for dependency analysis.
  • an undefined external symbol is found in one static library, and the undefined external symbol has internal code implementation in another static library, then it is determined that the two static libraries are mutually dependent.
  • the embodiment of the present application can comprehensively modify conflicting symbols, thereby avoiding the risk of error reporting caused by omission.
  • the multi-architecture static library conflict processing method in the embodiment of the present application has been described above, and the multi-architecture static library conflict processing device in the embodiment of the present application is described below. Referring to FIG. 3, the multi-architecture static library conflict processing device in the embodiment of the present application is described.
  • One embodiment includes:
  • the extraction module 301 is configured to scan each multi-architecture static library respectively, extract a multi-architecture static library list with static library conflicts, and separate each multi-architecture static library in the multi-architecture static library list into a plurality of single-architecture static libraries;
  • an update module 302 configured to extract the first symbol tables of the single-architecture static libraries, and update the reference symbols of the first symbol tables of the single-architecture static libraries to obtain a second symbol table with dependencies;
  • the decompression module 303 is configured to perform decompression processing on the single-architecture static libraries, and extract the target file list of each single-architecture static library and the third symbol table corresponding to each target file from the decompression result;
  • Modifying module 304 configured to modify the symbol name, symbol structure size and memory start address of the corresponding symbol in the third symbol table with reference to the second symbol table;
  • the compression module 305 is used to recompress the target files in the target file list corresponding to each single-architecture static library, obtain a plurality of non-conflicting new single-architecture static libraries, and merge the new single-architecture static libraries into a new single-architecture static library. Multi-arch static library.
  • the extraction module 301 is specifically configured to:
  • the multi-architecture static library corresponding to the static library conflict is added to the preset list to obtain a multi-architecture static library list.
  • the update module 302 is further configured to:
  • the reference symbols are updated on the first symbol tables of the single-architecture static libraries to obtain a second symbol table with dependencies.
  • the update module 302 is further configured to:
  • a plurality of static library groups with dependent calling relationships are screened, wherein the static library group includes a first static library and a second static library, and the first static library Two static libraries depend on the first static library;
  • the symbol table of the first static library in each static library group is respectively added to the symbol table of the second static library to obtain the second symbol table with dependencies corresponding to each of the single-architecture static libraries.
  • the modifying module 304 includes:
  • the first modification submodule is used to traverse the third symbol table corresponding to each target file in turn by using each symbol name in the second symbol table as a matching keyword to obtain a matching result;
  • the second modification sub-module is configured to modify the symbol name, symbol structure size and memory start address of the matching symbol corresponding to the matching result according to a preset modification rule if the matching result is not empty.
  • the first modification submodule includes:
  • a matching unit used for taking a symbol name of an unmatched symbol in the second symbol table as a matching keyword, and matching with a third symbol table corresponding to an unmatched target file to obtain a matching result
  • a first judging unit for judging whether there is an unmatched symbol in the second symbol table
  • a first circulation unit for cyclically executing a matching unit and a first judging unit if there is an unmatched symbol in the second symbol table
  • a second judging unit configured to judge whether there is an unmatched target file if there is no unmatched symbol in the second symbol table
  • the second circulation unit is used for cyclically executing the matching unit, the first judgment unit, the first circulation unit and the second judgment unit if there is an unmatched target file;
  • the third judgment unit is used to judge whether there is an unmatched second symbol table if there is no unmatched target file
  • the third loop unit is configured to loop through the matching unit, the first judgment unit, the first loop unit, the second judgment unit, the second loop unit and the third judgment unit if there is an unmatched second symbol table.
  • the second modification submodule is specifically used for:
  • the conflicting multi-architecture static libraries are first separated into single-architecture static libraries. Since there may be interdependencies among the single-architecture static libraries, all the symbols need to be referenced to the symbol tables of the single-architecture static libraries. Update to get the symbol table with dependencies. Then, according to the symbol table with dependencies, match the object file decompressed from the single-architecture static library, and rename the symbols in the matched object file, so as to solve the symbol conflict between multi-architecture static libraries The problem.
  • the present application uniformly renames the object file symbols in the conflicting multi-architecture static library, thereby efficiently generating a new stable multi-architecture static library.
  • FIG. 3 above describes the multi-architecture static library conflict processing device in the embodiment of the present application in detail from the perspective of modular functional entities, and the following describes the multi-architecture static library conflict processing device in the embodiment of the present application in detail from the perspective of hardware processing.
  • FIG. 4 is a schematic structural diagram of a multi-architecture static library conflict processing device provided by an embodiment of the present application.
  • the multi-architecture static library conflict processing device 500 may vary greatly due to different configurations or performances, and may include one or more than one Central processing units (CPU) 510 (eg, one or more processors) and memory 520, one or more storage media 530 (eg, one or more mass storage devices) that store application programs 533 or data 532.
  • the memory 520 and the storage medium 530 may be short-term storage or persistent storage.
  • the program stored in the storage medium 530 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations on the multi-architecture static library conflict processing apparatus 500 .
  • the processor 510 may be configured to communicate with the storage medium 530 to execute a series of instruction operations in the storage medium 530 on the multi-architecture static library conflict processing device 500 .
  • the multi-architecture static library conflict processing device 500 may also include one or more power supplies 540, one or more wired or wireless network interfaces 550, one or more input and output interfaces 560, and/or, one or more operating systems 531, For example Windows Server, Mac OS X, Unix, Linux, FreeBSD, etc.
  • operating systems 531 For example Windows Server, Mac OS X, Unix, Linux, FreeBSD, etc.
  • FIG. 4 does not constitute a limitation on the multi-architecture static library conflict processing device, and may include more or less components than those shown in the figure, or a combination of certain some components, or a different arrangement of components.
  • the present application also provides a multi-architecture static library conflict processing device, the multi-architecture static library conflict processing device includes a memory and a processor, the memory stores computer-readable instructions, and when the computer-readable instructions are executed by the processor, causes processing The controller executes the steps of the multi-architecture static library conflict processing method in the above embodiments.
  • the present application also provides a computer-readable storage medium.
  • the computer-readable storage medium may be a non-volatile computer-readable storage medium.
  • the computer-readable storage medium may also be a volatile computer-readable storage medium.
  • the computer-readable storage medium stores instructions that, when executed on a computer, cause the computer to execute the steps of the multi-architecture static library conflict processing method.
  • the integrated unit if implemented in the form of a software functional unit and sold or used as an independent product, may be stored in a computer-readable storage medium.
  • the technical solutions of the present application can be embodied in the form of software products in essence, or the parts that contribute to the prior art, or all or part of the technical solutions, and the computer software products are stored in a storage medium , including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present application.
  • the aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), magnetic disk or optical disk and other media that can store program codes .

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Devices For Executing Special Programs (AREA)

Abstract

A multi-architecture static library conflict processing method and apparatus, a device, and a storage medium. The multi-architecture static library conflict processing method comprises: extracting a multi-architecture static library list having a static library conflict and separating same into a plurality of single-architecture static libraries; extracting a first symbol table of each single-architecture static library and performing reference symbol updating to obtain a second symbol table having a dependency relationship; decompressing each single-architecture static library, and extracting a target file list of each single-architecture static library and a third symbol table corresponding to each target file; with reference to the second symbol table, modifying a symbol name, a symbol structure size, and a memory start address of a corresponding symbol in the third symbol table; and re-compressing and merging the target files in the target file list corresponding to each single-architecture static library into a new multi-architecture static library. By means of the method, a static library conflict can be quickly positioned, the conflict can be resolved, and stable operation of a multi-architecture static library is ensured.

Description

多架构静态库冲突处理方法、装置、设备及存储介质Multi-architecture static library conflict processing method, apparatus, device and storage medium
本申请要求于2020年12月3日提交中国专利局、申请号为202011393997.3、发明名称为“多架构静态库冲突处理方法、装置、设备及存储介质”的中国专利申请的优先权,其全部内容通过引用结合在申请中。This application claims the priority of the Chinese patent application filed on December 3, 2020 with the application number 202011393997.3 and the title of the invention is "Multi-architecture Static Library Conflict Handling Method, Apparatus, Equipment and Storage Medium", the entire contents of which are Incorporated in the application by reference.
技术领域technical field
本申请涉及人工智能领域,尤其涉及一种多架构静态库冲突处理方法、装置、设备及存储介质。The present application relates to the field of artificial intelligence, and in particular, to a multi-architecture static library conflict processing method, apparatus, device and storage medium.
背景技术Background technique
随着计算机技术的发展,iOS/Mac平台应用软件开发中需要持续迭代集成的模块越来越多,当新增模块功能需要对原静态库进行局部改造时,或者当不同的模块依赖同一个静态库的不同版本,而不同版本之间的静态库的外部接口存在局部差异时,在编译软件应用的过程中,会出现静态库冲突的问题,导致各业务模块功能受到了影响。With the development of computer technology, there are more and more modules that need continuous iterative integration in the development of iOS/Mac platform application software. When the functions of new modules require partial transformation of the original static library, or when different modules rely on the same static library When there are local differences in the external interface of the static library between different versions of the library, in the process of compiling the software application, the problem of static library conflict will occur, which will affect the functions of each business module.
发明人意识到,现有的对于静态库冲突的处理方法均存在局限性,通过现有的静态库冲突处理方法处理后的静态库,通常还需要大量的人工核验工作,需要反复地修改与测试,才能正常使用,还可能存在业务功能不能正常使用的风险,且处理效率低,不能满足复杂业务最小改动并快速稳定的上线要求。The inventor realizes that the existing methods for dealing with static library conflicts have limitations, and the static libraries processed by the existing static library conflict processing methods usually require a lot of manual verification work, and need to be modified and tested repeatedly. , it can be used normally, and there may be the risk that business functions cannot be used normally, and the processing efficiency is low, and it cannot meet the requirements of minimal changes and rapid and stable launch of complex services.
发明内容SUMMARY OF THE INVENTION
本申请的主要目的在于解决对静态库冲突的处理效率低且稳定性差的技术问题。The main purpose of this application is to solve the technical problems of low efficiency and poor stability in handling static library conflicts.
本申请第一方面提供了一种多架构静态库冲突处理方法,所述多架构静态库冲突处理方法,包括:A first aspect of the present application provides a multi-architecture static library conflict processing method, and the multi-architecture static library conflict processing method includes:
分别扫描各多架构静态库,提取存在静态库冲突的多架构静态库列表,并将所述多架构静态库列表中各多架构静态库分离为多个单架构静态库;Scanning each multi-architecture static library respectively, extracting a multi-architecture static library list with static library conflicts, and separating each multi-architecture static library in the multi-architecture static library list into a plurality of single-architecture static libraries;
提取所述各单架构静态库的第一符号表,并对所述各单架构静态库的第一符号表进行引用符号更新,得到带依赖关系的第二符号表;extracting the first symbol tables of the single-architecture static libraries, and updating the reference symbols for the first symbol tables of the single-architecture static libraries to obtain a second symbol table with dependencies;
对所述各单架构静态库进行解压缩处理,并从解压缩结果中提取各单架构静态库的目标文件列表及各目标文件对应的第三符号表;Decompressing the single-architecture static libraries, and extracting the target file list of each single-architecture static library and the third symbol table corresponding to each target file from the decompression result;
参照所述第二符号表,修改所述第三符号表中对应符号的符号名称、符号结构体大小及内存起始地址;With reference to the second symbol table, modify the symbol name, symbol structure size and memory start address of the corresponding symbol in the third symbol table;
重新压缩各单架构静态库对应目标文件列表中的目标文件,得到非冲突的多个新的单架构静态库,并将所述各新的单架构静态库合并为新的多架构静态库。The target files in the target file list corresponding to each single-architecture static library are recompressed to obtain multiple non-conflicting new single-architecture static libraries, and the new single-architecture static libraries are merged into a new multi-architecture static library.
本申请第二方面提供了一种多架构静态库冲突处理装置,所述多架构静态库冲突处理装置包括:A second aspect of the present application provides a multi-architecture static library conflict processing apparatus, and the multi-architecture static library conflict processing apparatus includes:
提取模块,用于分别扫描各多架构静态库,提取存在静态库冲突的多架构静态库列表,并将所述多架构静态库列表中各多架构静态库分离为多个单架构静态库;an extraction module, configured to scan each multi-architecture static library respectively, extract a multi-architecture static library list with static library conflicts, and separate each multi-architecture static library in the multi-architecture static library list into a plurality of single-architecture static libraries;
更新模块,用于提取所述各单架构静态库的第一符号表,并对所述各单架构静态库的第一符号表进行引用符号更新,得到带依赖关系的第二符号表;an update module for extracting the first symbol tables of the single-architecture static libraries, and updating the reference symbols for the first symbol tables of the single-architecture static libraries to obtain a second symbol table with dependencies;
解压模块,用于对所述各单架构静态库进行解压缩处理,并从解压缩结果中提取各单架构静态库的目标文件列表及各目标文件对应的第三符号表;a decompression module, used for decompressing the single-architecture static libraries, and extracting the target file list of each single-architecture static library and the third symbol table corresponding to each target file from the decompression result;
修改模块,用于参照所述第二符号表,修改所述第三符号表中对应符号的符号名称、符号结构体大小及内存起始地址;a modification module, configured to modify the symbol name, symbol structure size and memory start address of the corresponding symbol in the third symbol table with reference to the second symbol table;
压缩模块,用于重新压缩各单架构静态库对应目标文件列表中的目标文件,得到非冲突的多个新的单架构静态库,并将所述各新的单架构静态库合并为新的多架构静态库。The compression module is used to recompress the target files in the target file list corresponding to each single-architecture static library, obtain a plurality of non-conflicting new single-architecture static libraries, and merge the new single-architecture static libraries into new multi-architecture static libraries. Architecture static library.
本申请第三方面提供了一种多架构静态库冲突处理设备,包括:存储器和至少一个处理器,所述存储器中存储有指令;所述至少一个处理器调用所述存储器中的所述指令,以使得所述多架构静态库冲突处理设备执行如下所示的多架构静态库冲突处理方法的步骤:A third aspect of the present application provides a multi-architecture static library conflict processing device, comprising: a memory and at least one processor, where an instruction is stored in the memory; the at least one processor invokes the instruction in the memory, So that the multi-architecture static library conflict processing device executes the steps of the multi-architecture static library conflict processing method as shown below:
分别扫描各多架构静态库,提取存在静态库冲突的多架构静态库列表,并将所述多架构静态库列表中各多架构静态库分离为多个单架构静态库;Scanning each multi-architecture static library respectively, extracting a multi-architecture static library list with static library conflicts, and separating each multi-architecture static library in the multi-architecture static library list into a plurality of single-architecture static libraries;
提取所述各单架构静态库的第一符号表,并对所述各单架构静态库的第一符号表进行引用符号更新,得到带依赖关系的第二符号表;extracting the first symbol tables of the single-architecture static libraries, and updating the reference symbols for the first symbol tables of the single-architecture static libraries to obtain a second symbol table with dependencies;
对所述各单架构静态库进行解压缩处理,并从解压缩结果中提取各单架构静态库的目标文件列表及各目标文件对应的第三符号表;Decompressing the single-architecture static libraries, and extracting the target file list of each single-architecture static library and the third symbol table corresponding to each target file from the decompression result;
参照所述第二符号表,修改所述第三符号表中对应符号的符号名称、符号结构体大小及内存起始地址;With reference to the second symbol table, modify the symbol name, symbol structure size and memory start address of the corresponding symbol in the third symbol table;
重新压缩各单架构静态库对应目标文件列表中的目标文件,得到非冲突的多个新的单架构静态库,并将所述各新的单架构静态库合并为新的多架构静态库。The target files in the target file list corresponding to each single-architecture static library are recompressed to obtain multiple non-conflicting new single-architecture static libraries, and the new single-architecture static libraries are merged into a new multi-architecture static library.
本申请的第四方面提供了一种计算机可读存储介质,所述计算机可读存储介质中存储有指令,当其在计算机上运行时,使得计算机执行如下所示的多架构静态库冲突处理方法的步骤:A fourth aspect of the present application provides a computer-readable storage medium, where instructions are stored in the computer-readable storage medium, when the computer-readable storage medium runs on a computer, the computer executes the multi-architecture static library conflict processing method shown below A step of:
分别扫描各多架构静态库,提取存在静态库冲突的多架构静态库列表,并将所述多架构静态库列表中各多架构静态库分离为多个单架构静态库;Scanning each multi-architecture static library respectively, extracting a multi-architecture static library list with static library conflicts, and separating each multi-architecture static library in the multi-architecture static library list into a plurality of single-architecture static libraries;
提取所述各单架构静态库的第一符号表,并对所述各单架构静态库的第一符号表进行引用符号更新,得到带依赖关系的第二符号表;extracting the first symbol tables of the single-architecture static libraries, and updating the reference symbols for the first symbol tables of the single-architecture static libraries to obtain a second symbol table with dependencies;
对所述各单架构静态库进行解压缩处理,并从解压缩结果中提取各单架构静态库的目标文件列表及各目标文件对应的第三符号表;Decompressing the single-architecture static libraries, and extracting the target file list of each single-architecture static library and the third symbol table corresponding to each target file from the decompression result;
参照所述第二符号表,修改所述第三符号表中对应符号的符号名称、符号结构体大小及内存起始地址;With reference to the second symbol table, modify the symbol name, symbol structure size and memory start address of the corresponding symbol in the third symbol table;
重新压缩各单架构静态库对应目标文件列表中的目标文件,得到非冲突的多个新的单架构静态库,并将所述各新的单架构静态库合并为新的多架构静态库。The target files in the target file list corresponding to each single-architecture static library are recompressed to obtain multiple non-conflicting new single-architecture static libraries, and the new single-architecture static libraries are merged into a new multi-architecture static library.
本申请提供的技术方案中,首先将存在冲突的多架构静态库分离为单架构静态库,由于各单架构静态库之间可能存在相互依赖关系,所有需要对各单架构静态库的符号表进行引用符号更新,得到存在依赖关系的符号表。然后再根据存在依赖关系的符号表,去匹配从单架构静态库中解压缩处理的目标文件,并把匹配到的目标文件中的符号进行重命名操作,从而解决多架构静态库之间符号冲突的问题。本申请对发生冲突的多架构静态库中的目标文件符号进行统一重命名,从而高效地生成稳定的新多架构静态库。In the technical solution provided by the present application, the conflicting multi-architecture static libraries are first separated into single-architecture static libraries. Since there may be interdependencies between the single-architecture static libraries, all the symbol tables of the single-architecture static libraries need to be checked. The reference symbol is updated to get the symbol table with dependencies. Then, according to the symbol table with dependencies, match the object file decompressed from the single-architecture static library, and rename the symbols in the matched object file, so as to solve the symbol conflict between multi-architecture static libraries The problem. The present application uniformly renames the object file symbols in the conflicting multi-architecture static library, thereby efficiently generating a new stable multi-architecture static library.
附图说明Description of drawings
图1为本申请实施例中多架构静态库冲突处理方法的第一个实施例示意图;1 is a schematic diagram of a first embodiment of a multi-architecture static library conflict processing method in an embodiment of the present application;
图2为本申请实施例中多架构静态库冲突处理方法的第二个实施例示意图;2 is a schematic diagram of a second embodiment of a method for handling multi-architecture static library conflicts in an embodiment of the present application;
图3为本申请实施例中多架构静态库冲突处理装置的一个实施例示意图;3 is a schematic diagram of an embodiment of a multi-architecture static library conflict processing apparatus in an embodiment of the present application;
图4为本申请实施例中多架构静态库冲突处理设备的一个实施例示意图。FIG. 4 is a schematic diagram of an embodiment of a multi-architecture static library conflict processing device in an embodiment of the present application.
具体实施方式Detailed ways
本申请实施例提供了一种多架构静态库冲突处理方法、装置、设备及存储介质,本申请的说明书和权利要求书及上述附图中的术语“第一”、“第二”、“第三”、“第四”等(如果存在)是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。应该理解这样使用的数据在适当情况下可以互换,以便这里描述的实施例能够以除了在这里图示或描述的内容以外的顺序实施。此外,术语“包括”或“具有”及其任何变形,意图在于覆盖不排他的包含,例如,包含了一系列步骤或单元的过程、方法、系统、产品或设备不必限于清楚地列出的那些步骤或单元,而是可包括没有清楚地列出的或对于这些过程、方法、产品或设备固有的其它步骤或单元。Embodiments of the present application provide a method, apparatus, device, and storage medium for dealing with multi-architecture static library conflicts. "Three", "fourth", etc., if present, are used to distinguish similar objects and are not necessarily used to describe a particular order or sequence. It is to be understood that data so used may be interchanged under appropriate circumstances so that the embodiments described herein can be practiced in sequences other than those illustrated or described herein. Furthermore, the terms "comprising" or "having" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those expressly listed steps or units, but may include other steps or units not expressly listed or inherent to these processes, methods, products or devices.
为便于理解,下面对本申请实施例的具体流程进行描述,请参阅图1,本申请实施例中多架构静态库冲突处理方法的第一个实施例包括:For ease of understanding, the following describes the specific process of the embodiment of the present application, with reference to FIG. 1 , the first embodiment of the method for handling multi-architecture static library conflicts in the embodiment of the present application includes:
101、分别扫描各多架构静态库,提取存在静态库冲突的多架构静态库列表,并将所述多架构静态库列表中各多架构静态库分离为多个单架构静态库;101. Scan each multi-architecture static library respectively, extract a multi-architecture static library list with static library conflicts, and separate each multi-architecture static library in the multi-architecture static library list into multiple single-architecture static libraries;
可以理解的是,本申请的执行主体可以为多架构静态库冲突处理装置,还可以是终端或者服务器,具体此处不做限定。本申请实施例以服务器为执行主体为例进行说明。It can be understood that the execution body of the present application may be a multi-architecture static library conflict processing device, and may also be a terminal or a server, which is not specifically limited here. The embodiments of the present application take the server as an execution subject as an example for description.
本实施例中,iOS/Mac平台应用集成静态库时,产生冲突的可能是两个多架构静态库之间,各静态库暴露给外部使用的函数/类名/全局变量称为该静态库的外部符号,而发生冲突的原因就是外部符号名称重复导致的,其中,这些外部符号存储在各静态库的Mach-O文件的符号表中,可以通过命令行的方式可提取符号表。In this embodiment, when an iOS/Mac platform application integrates a static library, a conflict may occur between two multi-architecture static libraries, and the functions/class names/global variables exposed by each static library to external use are called the static library's function/class name/global variable. The reason for the conflict is that the names of external symbols are repeated. These external symbols are stored in the symbol table of the Mach-O file of each static library, and the symbol table can be extracted through the command line.
本实施例中,提供给应用引用的静态库可能由若干个子静态库作为编译基本单元组成,而一个静态库又是由若干个目标文件(.o文件)压缩组成。当应用需要支持多个CPU架构(如arm64/armv7/x86_64)编译时,多架构(Fat)静态库是由多个单架构(Thin)静态库打包组成。因此如果存在若干子静态库,需要对每个子静态库分别提取Thin静态库,不同CPU架构下的Thin静态库在代码实现上可能存在差异,需要分开单CPU架构处理符号表。In this embodiment, the static library provided to the application for reference may be composed of several sub-static libraries as the basic unit of compilation, and a static library is composed of compressed object files (.o files). When the application needs to support multiple CPU architectures (such as arm64/armv7/x86_64) to compile, the multi-architecture (Fat) static library is composed of multiple single-architecture (Thin) static libraries packaged. Therefore, if there are several sub-static libraries, the Thin static library needs to be extracted separately for each sub-static library. The Thin static library under different CPU architectures may have differences in code implementation, and the symbol table needs to be processed separately for the single-CPU architecture.
可选的,在一实施例中,步骤101包括:Optionally, in an embodiment, step 101 includes:
分别扫描各多架构静态库,确认已集成静态库与待集成静态库;Scan each multi-architecture static library separately to confirm that the static library has been integrated and the static library to be integrated;
分别提取所述已集成静态库的第四符号表与所述待集成静态库的第五符号表;respectively extracting the fourth symbol table of the integrated static library and the fifth symbol table of the static library to be integrated;
判断所述第四符号表与所述第五符号表之间是否存在重复的符号名称;judging whether there are duplicate symbol names between the fourth symbol table and the fifth symbol table;
若存在,则确定存在静态库冲突,并将静态库冲突对应的多架构静态库存入预置列表中,得到多架构静态库列表;If it exists, it is determined that there is a static library conflict, and the multi-architecture static library corresponding to the static library conflict is added to the preset list to obtain a multi-architecture static library list;
将所述多架构静态库列表中各多架构静态库分离为多个单架构静态库。Each multi-architecture static library in the multi-architecture static library list is separated into a plurality of single-architecture static libraries.
本可选实施例中,识别静态库冲突的方法有两种:一是针对以SDK形式对外提供的静态库,对可能存在冲突的静态库整体外部符号提取后进行私有化命名处理,即可得到无冲突的静态库;二是针对应用内部集成,提取编译后的应用主工程Mach-O文件符号表,以及准备增加到工程中的静态库Mach-O文件符号表,导出有内部代码实现的外部符号列表,以及目标文件信息,通过查找比对,确认存在符号和目标文件冲突所在的静态库。In this optional embodiment, there are two methods for identifying static library conflicts: one is for static libraries provided externally in the form of SDK, and after extracting the overall external symbols of the static library that may have conflicts, perform privatization and naming processing to obtain Conflict-free static library; second, for the internal integration of the application, extract the compiled application main project Mach-O file symbol table, as well as the static library Mach-O file symbol table to be added to the project, and export the external code implemented by the internal code. The symbol list and object file information are checked and compared to confirm that there is a static library where symbols and object files conflict.
102、提取所述各单架构静态库的第一符号表,并对所述各单架构静态库的第一符号表进行引用符号更新,得到带依赖关系的第二符号表;102. Extract the first symbol tables of the single-architecture static libraries, and update the reference symbols for the first symbol tables of the single-architecture static libraries to obtain a second symbol table with dependencies;
本实施例中,各单架构静态库之间可能存在相互依赖关系,这种相互依赖关系可以通过各单架构静态库的符号表进行判断。例如,当静态库A中发现未定义的外部符号标识b,而该符号b在静态库B中为有内部代码实现的外部符号,即在静态库B中定义了符号b,那么,即认为静态库A依赖静态库B。当识别到静态库A依赖静态库B时,需进行符号表更新操作,具体操作方式为提取静态库B的符号表,导出添加到静态库A的符号表中。依次对每个有外部依赖的静态库,执行对应的符号表更新操作。In this embodiment, there may be an interdependence relationship between the single-architecture static libraries, and this interdependence relationship can be determined by the symbol table of each single-architecture static library. For example, when an undefined external symbol identifier b is found in static library A, and the symbol b is an external symbol implemented by internal code in static library B, that is, symbol b is defined in static library B, then it is considered static Library A depends on static library B. When it is recognized that the static library A depends on the static library B, the symbol table update operation needs to be performed. The specific operation method is to extract the symbol table of the static library B, and export and add it to the symbol table of the static library A. Perform the corresponding symbol table update operation for each static library with external dependencies in turn.
可选的,在一实施例中,步骤102包括:Optionally, in an embodiment, step 102 includes:
提取所述各单架构静态库的第一符号表,并确定所述各单架构静态库之间的相互依赖关系;extracting the first symbol tables of the single-architecture static libraries, and determining the interdependence between the single-architecture static libraries;
根据所述各单架构静态库之间的相互依赖关系,对所述各单架构静态库的第一符号表进行引用符号更新,得到带依赖关系的第二符号表。According to the interdependence between the single-architecture static libraries, the reference symbols are updated on the first symbol tables of the single-architecture static libraries to obtain a second symbol table with dependencies.
本可选实施例中,为了统一重命名符号,需要对内部相互依赖的静态库,进行引用符号更新,从而在重命名时不产生遗漏符号,避免后续引入集成静态库时发生错误。将更新了引用符号的静态库作为带依赖关系的第二符号表,用于匹配目标文件中各需要修改的符号。In this optional embodiment, in order to rename symbols uniformly, it is necessary to update the reference symbols of the internal interdependent static libraries, so that missing symbols are not generated during renaming, and errors are avoided when the integrated static library is subsequently imported. The static library with updated reference symbols is used as the second symbol table with dependencies to match the symbols that need to be modified in the object file.
103、对所述各单架构静态库进行解压缩处理,并从解压缩结果中提取各单架构静态库的目标文件列表及各目标文件对应的第三符号表;103. Perform decompression processing on the single-architecture static libraries, and extract the target file list of each single-architecture static library and the third symbol table corresponding to each target file from the decompression result;
本实施例中,静态库可以简单地看成是一组目标文件(.o)的集合,即很多目标文件经过压缩打包后形成的一个文件。比如,最常用的C语言静态库libc位于/usr/lib/libc.a,它属于glibc项目的一部分。而glibc本身是用C语言开发的,它由成百上千个C语言源代码文件组成,也就是说,编译完成以后有相同数量的目标文件,比如输入输出有printf.o,scanf.o;文件操作有fread.o,fwrite.o;时间日期有date.o,time.o;内存管理有malloc.o等。把这些零散的目标文件直接提供给库的使用者,很大程度上会造成文件传输、管理和组织方面的不便,于是通常使用ar压缩程序将这些目标文件压缩到一起,并且对其进行编号和索引,以便于查找和检索,就形成了静态库文件。在本实施例中,可以通过命令行:ar-x<library.a/binary>对静态库进行解压缩,在解压缩结果中提取若干个目标文件,以及各个目标文件对应的符号表。In this embodiment, the static library can be simply regarded as a set of object files (.o), that is, a file formed by many object files after being compressed and packaged. For example, the most commonly used C language static library libc is located in /usr/lib/libc.a, which is part of the glibc project. And glibc itself is developed in C language, it consists of hundreds of C language source code files, that is to say, after the compilation is completed, there are the same number of object files, such as printf.o, scanf.o for input and output; File operations include fread.o, fwrite.o; time and date include date.o, time.o; memory management includes malloc.o, etc. Providing these scattered object files directly to the users of the library will cause inconvenience in file transfer, management and organization to a large extent, so the ar compression program is usually used to compress these object files together, and number and organize them. Indexing, to facilitate search and retrieval, forms a static library file. In this embodiment, the static library can be decompressed through the command line: ar-x <library.a/binary>, and several object files and symbol tables corresponding to each object file are extracted from the decompression result.
104、参照所述第二符号表,修改所述第三符号表中对应符号的符号名称、符号结构体大小及内存起始地址;104. With reference to the second symbol table, modify the symbol name, symbol structure size and memory start address of the corresponding symbol in the third symbol table;
本实施例中,得到带依赖关系的第二符号表后,根据第二符号表中的符号,匹配各目标文件的符号表,匹配出各目标文件中包含第二符号表中的符号,并按照预置的重命名规则对匹配到的符号进行修改。为了集成静态库的可执行性,需要对新符号的符号结构体大小以及内存起始地址也进行相应的修改。本实施例根据更新了引用符号的符号表来查找出要修改的符号所在的目标文件,从而对目标文件中的冲突符号进行重命名。In this embodiment, after the second symbol table with dependencies is obtained, the symbol tables of each target file are matched according to the symbols in the second symbol table, and the symbols in the second symbol table included in each target file are matched, and the symbols in the second symbol table are matched according to the symbols in the second symbol table. The preset renaming rules modify the matched symbols. In order to integrate the executable of the static library, the size of the symbol structure of the new symbol and the starting address of the memory need to be modified accordingly. In this embodiment, the target file where the symbol to be modified is located is searched out according to the updated symbol table of the reference symbol, so as to rename the conflicting symbol in the target file.
可选的,在一实施例中,步骤104包括:Optionally, in an embodiment, step 104 includes:
分别以所述第二符号表中各符号名称为匹配关键字,依次遍历所述各目标文件对应的第三符号表,得到匹配结果;Taking each symbol name in the second symbol table as a matching keyword, traverse the third symbol table corresponding to each target file in turn to obtain a matching result;
若所述匹配结果非空,则按预置修改规则,修改所述匹配结果对应匹配符号的符号名称、符号结构体大小及内存起始地址。If the matching result is not empty, modify the symbol name, symbol structure size and memory start address of the matching symbol corresponding to the matching result according to the preset modification rule.
可选的,在一实施例中,所述分别以所述第二符号表中各符号名称为匹配关键字,依次遍历所述各目标文件对应的第三符号表,得到匹配结果包括:Optionally, in an embodiment, using each symbol name in the second symbol table as a matching keyword, traversing the third symbol table corresponding to each target file in sequence, and obtaining a matching result includes:
S1、以所述第二符号表中未匹配符号的一个符号名称为匹配关键字,与未匹配的一个目标文件对应的第三符号表进行匹配,得到匹配结果;S1, take a symbol name of an unmatched symbol in the second symbol table as a matching keyword, and match with a third symbol table corresponding to an unmatched target file to obtain a matching result;
S2、判断所述第二符号表中是否存在未匹配符号;S2, judging whether there is an unmatched symbol in the second symbol table;
S3、若所述第二符号表中存在未匹配符号,则循环执行S1-S2;S3, if there is an unmatched symbol in the second symbol table, cyclically execute S1-S2;
S4、若所述第二符号表中不存在未匹配符号,则判断是否存在未匹配的目标文件;S4, if there is no unmatched symbol in the second symbol table, then determine whether there is an unmatched target file;
S5、若存在未匹配的目标文件,则循环执行S1-S4;S5. If there is an unmatched target file, execute S1-S4 in a loop;
S6、若不存在未匹配的目标文件,则判断是否存在未匹配的第二符号表;S6, if there is no unmatched target file, determine whether there is an unmatched second symbol table;
S7、若存在未匹配的第二符号表,则循环执行S1-S6。S7. If there is an unmatched second symbol table, cyclically execute S1-S6.
本可选实施例中,符号重命名程序需要进行两层遍历,第一层遍历对应CPU架构的目 标文件列表,第二层遍历目标文件对应的符号表,以目标文件为修改单元执行符号重命名。当判断目标文件存在需要修改的符号信息时,将单个目标文件中的旧符号名称,修改为按照命名规则生成的新符号名称。In this optional embodiment, the symbol renaming program needs to perform two-layer traversal. The first layer traverses the target file list corresponding to the CPU architecture, the second layer traverses the symbol table corresponding to the target file, and uses the target file as the modification unit to perform symbol renaming. . When it is judged that the target file has the symbol information that needs to be modified, the old symbol name in the single target file is modified to the new symbol name generated according to the naming rule.
本可选实施例中,符号重命名程序通过读取目标文件的Mach-O文件架构,判断CPU架构类型,跳过HEADER部分,查找LC_SYMTAB标识,获取到Symbol Table Offset,符号以nlist/nlist_64为单位(定义在mach-o/nlist.h中),依次检索匹配符号名称,当发现存在要修改的符号时,修改nlist/nlist_64结构体大小以及n_un.n_strx为新符号名称,并重新调整该符号的后续符号结构体的内存起始地址。In this optional embodiment, the symbol renaming program judges the CPU architecture type by reading the Mach-O file structure of the target file, skips the HEADER part, searches for the LC_SYMTAB identifier, and obtains the Symbol Table Offset, and the symbol is in units of nlist/nlist_64 (Defined in mach-o/nlist.h), retrieve the matching symbol names in turn, when the symbol to be modified is found, modify the nlist/nlist_64 structure size and n_un.n_strx as the new symbol name, and readjust the symbol The memory start address of the subsequent symbol structure.
可选的,在一实施例中,所述若所述匹配结果非空,则按预置修改规则,修改所述匹配结果对应匹配符号的符号名称、符号结构体大小及内存起始地址包括:Optionally, in one embodiment, if the matching result is not empty, modifying the symbol name, symbol structure size and memory start address of the matching symbol corresponding to the matching result according to a preset modification rule includes:
所述若所述匹配结果非空,则在所述各匹配符号的符号名称前,添加相同的修饰符号,得到多个新符号;If the matching result is not empty, add the same modifier symbol before the symbol name of each matching symbol to obtain a plurality of new symbols;
将所述各新符号添加至对应单架构静态库的第一符号表中;adding the new symbols to the first symbol table corresponding to the single-architecture static library;
调整所述各单架构静态库的第一符号表中各新符号对应的符号结构体大小、内存起始地址。Adjust the size of the symbol structure and the starting address of the memory corresponding to each new symbol in the first symbol table of each single-architecture static library.
本可选实施例中,符号修改规则可以有多种方式,例如可以是,在需要修改的原符号基础上,统一增加一个修饰前缀,该修饰前缀可以自定义为一个统一的前缀符号,例如“_<prefix>”。另外,最好是对所有匹配到的符号实行相同的修改规则,以便于后续涉及直接调用新增模块冲突静态库接口的App应用原工程,同步修改调用的类/方法/全局变量名称,例如,与前缀符号相应地,在原来名称前增加“<prefix>_”前缀。In this optional embodiment, the symbol modification rule can be in multiple ways. For example, a modified prefix can be added uniformly on the basis of the original symbol to be modified, and the modified prefix can be customized as a unified prefix symbol, such as " _<prefix>". In addition, it is best to implement the same modification rules for all matched symbols, so that the original App application project that directly calls the interface of the newly added module conflicting static library can be used to modify the name of the called class/method/global variable synchronously, for example, Corresponding to the prefix symbol, the "<prefix>_" prefix is added before the original name.
105、重新压缩各单架构静态库对应目标文件列表中的目标文件,得到非冲突的多个新的单架构静态库,并将所述各新的单架构静态库合并为新的多架构静态库。105. Recompress the target files in the target file list corresponding to each single-architecture static library, obtain a plurality of non-conflicting new single-architecture static libraries, and merge the new single-architecture static libraries into a new multi-architecture static library .
本实施例中,将修改完成的目标文件压缩合并为单架构静态库,如果存在多CPU架构的单架构静态库,将修改完成的单架构静态库合并为多架构静态库。作为SDK静态库输出时,为减少外部应用集成的工作量,会将多个多架构静态库尽可能合并成一个静态库统一对外输出,合并时将不同的单架构静态库之间命名重复的目标文件名称进行重命名,然后再重新打包集成为单个多架构静态库输出。In this embodiment, the modified target files are compressed and merged into a single-architecture static library. If there is a single-architecture static library with multiple CPU architectures, the modified single-architecture static library is merged into a multi-architecture static library. When exporting as SDK static library, in order to reduce the workload of external application integration, multiple multi-architecture static libraries will be merged into one static library as much as possible for unified external output. When merging, different single-architecture static libraries will be named with duplicate targets. The file names are renamed and then repackaged into a single multi-arch static library output.
本申请实施例中,首先将存在冲突的多架构静态库分离为单架构静态库,由于各单架构静态库之间可能存在相互依赖关系,所有需要对各单架构静态库的符号表进行引用符号更新,得到存在依赖关系的符号表。然后再根据存在依赖关系的符号表,去匹配从单架构静态库中解压缩处理的目标文件,并把匹配到的目标文件中的符号进行重命名操作,从而解决多架构静态库之间符号冲突的问题。本申请对发生冲突的多架构静态库中的目标文件符号进行统一重命名,从而高效地生成稳定的新多架构静态库。In the embodiment of the present application, the conflicting multi-architecture static libraries are first separated into single-architecture static libraries. Since there may be interdependencies among the single-architecture static libraries, all the symbols need to be referenced to the symbol tables of the single-architecture static libraries. Update to get the symbol table with dependencies. Then, according to the symbol table with dependencies, match the object file decompressed from the single-architecture static library, and rename the symbols in the matched object file, so as to solve the symbol conflict between multi-architecture static libraries The problem. The present application uniformly renames the object file symbols in the conflicting multi-architecture static library, thereby efficiently generating a new stable multi-architecture static library.
请参阅图2,本申请实施例中多架构静态库冲突处理方法的第二个实施例包括:Referring to FIG. 2, the second embodiment of the multi-architecture static library conflict processing method in the embodiment of the present application includes:
201、分别扫描各多架构静态库,提取存在静态库冲突的多架构静态库列表,并将所述多架构静态库列表中各多架构静态库分离为多个单架构静态库;201. Scan each multi-architecture static library respectively, extract a multi-architecture static library list with static library conflicts, and separate each multi-architecture static library in the multi-architecture static library list into multiple single-architecture static libraries;
202、提取所述各单架构静态库的第一符号表;202. Extract the first symbol table of each single-architecture static library;
203、导出所述各第一符号表中的所有外部符号,并根据所述各外部符号之间的依赖关系,确定所述各单架构静态库之间的相互依赖关系;203. Deriving all external symbols in the first symbol tables, and determining the interdependence between the single-architecture static libraries according to the dependency between the external symbols;
204、从所述各单架构静态库之间的相互依赖关系中筛选出存在依赖调用关系的多个静态库组,其中,所述静态库组包括第一静态库与第二静态库,且所述第二静态库依赖所述第一静态库;204. Screen out a plurality of static library groups with dependent calling relationships from the interdependencies between the single-architecture static libraries, wherein the static library group includes a first static library and a second static library, and all The second static library depends on the first static library;
205、分别将所述各静态库组中第一静态库的符号表添加到第二静态库的符号表中,得 到所述各单架构静态库对应的带依赖关系的第二符号表;205, respectively add the symbol table of the first static library in the described each static library group in the symbol table of the second static library, obtain the corresponding second symbol table with dependency of the each single-architecture static library;
本实施例中,各单架构静态库之间可能存在相互依赖关系,这种相互依赖关系可以通过各单架构静态库的符号表进行判断。例如,当静态库A中发现未定义的外部符号标识b,而该符号b在静态库B中为有内部代码实现的外部符号,即在静态库B中定义了符号b,那么,即认为静态库A依赖静态库B。当识别到静态库A依赖静态库B时,需进行符号表更新操作,具体操作方式为提取静态库B的符号表,导出添加到静态库A的符号表中。依次对每个有外部依赖的静态库,执行对应的符号表更新操作。In this embodiment, there may be an interdependence relationship between the single-architecture static libraries, and this interdependence relationship can be determined by the symbol table of each single-architecture static library. For example, when an undefined external symbol identifier b is found in static library A, and the symbol b is an external symbol implemented by internal code in static library B, that is, symbol b is defined in static library B, then it is considered static Library A depends on static library B. When it is recognized that the static library A depends on the static library B, the symbol table update operation needs to be performed. The specific operation method is to extract the symbol table of the static library B, and export and add it to the symbol table of the static library A. Perform the corresponding symbol table update operation for each static library with external dependencies in turn.
本实施例中,为了统一重命名符号,需要对内部相互依赖的静态库,进行引用符号更新,从而在重命名时不产生遗漏符号,避免后续引入集成静态库时发生错误。将更新了引用符号的静态库作为带依赖关系的第二符号表,用于匹配目标文件中各需要修改的符号。In this embodiment, in order to rename symbols uniformly, it is necessary to update the reference symbols of the internal interdependent static libraries, so that no missing symbols are generated during renaming, and errors occur when the integrated static library is subsequently imported. The static library with updated reference symbols is used as the second symbol table with dependencies to match the symbols that need to be modified in the object file.
206、对所述各单架构静态库进行解压缩处理,并从解压缩结果中提取各单架构静态库的目标文件列表及各目标文件对应的第三符号表;206, performing decompression processing on the single-architecture static libraries, and extracting the target file list of each single-architecture static library and the third symbol table corresponding to each target file from the decompression result;
207、参照所述第二符号表,修改所述第三符号表中对应符号的符号名称、符号结构体大小及内存起始地址;207. With reference to the second symbol table, modify the symbol name, symbol structure size and memory start address of the corresponding symbol in the third symbol table;
208、重新压缩各单架构静态库对应目标文件列表中的目标文件,得到非冲突的多个新的单架构静态库,并将所述各新的单架构静态库合并为新的多架构静态库。208. Recompress the target files in the target file list corresponding to each single-architecture static library, obtain a plurality of non-conflicting new single-architecture static libraries, and merge the new single-architecture static libraries into a new multi-architecture static library .
本申请实施例中,由于各单架构静态库之间可能存在相互依赖关系,因此需要导出各静态库的外部符号表做依赖关系分析。当发现一个静态库中出现未定义的外部符号时,而该未定义的外部符号在另一个静态库中有内部代码实现,那么,即确定这两个静态库之间相互依赖。然后将有定义的静态库符号表添加至有未定义符号的静态库符号表中,得到带依赖关系的符号表。本申请实施例通过依赖关系分析,能够全面地修改冲突符号,避免遗漏所带来的报错风险。In the embodiment of the present application, since there may be interdependencies among the single-architecture static libraries, it is necessary to export the external symbol tables of the static libraries for dependency analysis. When an undefined external symbol is found in one static library, and the undefined external symbol has internal code implementation in another static library, then it is determined that the two static libraries are mutually dependent. Then add the defined static library symbol table to the static library symbol table with undefined symbols to obtain the symbol table with dependencies. Through dependency relationship analysis, the embodiment of the present application can comprehensively modify conflicting symbols, thereby avoiding the risk of error reporting caused by omission.
上面对本申请实施例中多架构静态库冲突处理方法进行了描述,下面对本申请实施例中多架构静态库冲突处理装置进行描述,请参阅图3,本申请实施例中多架构静态库冲突处理装置一个实施例包括:The multi-architecture static library conflict processing method in the embodiment of the present application has been described above, and the multi-architecture static library conflict processing device in the embodiment of the present application is described below. Referring to FIG. 3, the multi-architecture static library conflict processing device in the embodiment of the present application is described. One embodiment includes:
提取模块301,用于分别扫描各多架构静态库,提取存在静态库冲突的多架构静态库列表,并将所述多架构静态库列表中各多架构静态库分离为多个单架构静态库;The extraction module 301 is configured to scan each multi-architecture static library respectively, extract a multi-architecture static library list with static library conflicts, and separate each multi-architecture static library in the multi-architecture static library list into a plurality of single-architecture static libraries;
更新模块302,用于提取所述各单架构静态库的第一符号表,并对所述各单架构静态库的第一符号表进行引用符号更新,得到带依赖关系的第二符号表;an update module 302, configured to extract the first symbol tables of the single-architecture static libraries, and update the reference symbols of the first symbol tables of the single-architecture static libraries to obtain a second symbol table with dependencies;
解压模块303,用于对所述各单架构静态库进行解压缩处理,并从解压缩结果中提取各单架构静态库的目标文件列表及各目标文件对应的第三符号表;The decompression module 303 is configured to perform decompression processing on the single-architecture static libraries, and extract the target file list of each single-architecture static library and the third symbol table corresponding to each target file from the decompression result;
修改模块304,用于参照所述第二符号表,修改所述第三符号表中对应符号的符号名称、符号结构体大小及内存起始地址;Modifying module 304, configured to modify the symbol name, symbol structure size and memory start address of the corresponding symbol in the third symbol table with reference to the second symbol table;
压缩模块305,用于重新压缩各单架构静态库对应目标文件列表中的目标文件,得到非冲突的多个新的单架构静态库,并将所述各新的单架构静态库合并为新的多架构静态库。The compression module 305 is used to recompress the target files in the target file list corresponding to each single-architecture static library, obtain a plurality of non-conflicting new single-architecture static libraries, and merge the new single-architecture static libraries into a new single-architecture static library. Multi-arch static library.
可选的,在一实施例中,所述提取模块301具体用于:Optionally, in an embodiment, the extraction module 301 is specifically configured to:
分别扫描各多架构静态库,确认已集成静态库与待集成静态库;Scan each multi-architecture static library separately to confirm that the static library has been integrated and the static library to be integrated;
分别提取所述已集成静态库的第四符号表与所述待集成静态库的第五符号表;respectively extracting the fourth symbol table of the integrated static library and the fifth symbol table of the static library to be integrated;
判断所述第四符号表与所述第五符号表之间是否存在重复的符号名称;Judging whether there are duplicate symbol names between the fourth symbol table and the fifth symbol table;
若存在,则确定存在静态库冲突,并将静态库冲突对应的多架构静态库存入预置列表中,得到多架构静态库列表。If there is, it is determined that there is a static library conflict, and the multi-architecture static library corresponding to the static library conflict is added to the preset list to obtain a multi-architecture static library list.
可选的,在一实施例中,所述更新模块302还用于:Optionally, in an embodiment, the update module 302 is further configured to:
提取所述各单架构静态库的第一符号表,并确定所述各单架构静态库之间的相互依赖 关系;Extract the first symbol table of each single-architecture static library, and determine the interdependence between the single-architecture static libraries;
根据所述各单架构静态库之间的相互依赖关系,对所述各单架构静态库的第一符号表进行引用符号更新,得到带依赖关系的第二符号表。According to the interdependence between the single-architecture static libraries, the reference symbols are updated on the first symbol tables of the single-architecture static libraries to obtain a second symbol table with dependencies.
可选的,在一实施例中,所述更新模块302还用于:Optionally, in an embodiment, the update module 302 is further configured to:
导出所述各第一符号表中的所有外部符号,并根据所述各外部符号之间的依赖关系,确定所述各单架构静态库之间的相互依赖关系;Deriving all external symbols in the first symbol tables, and determining the interdependence between the single-architecture static libraries according to the dependency between the external symbols;
从所述各单架构静态库之间的相互依赖关系中筛选出存在依赖调用关系的多个静态库组,其中,所述静态库组包括第一静态库与第二静态库,且所述第二静态库依赖所述第一静态库;From the interdependencies between the single-architecture static libraries, a plurality of static library groups with dependent calling relationships are screened, wherein the static library group includes a first static library and a second static library, and the first static library Two static libraries depend on the first static library;
分别将所述各静态库组中第一静态库的符号表添加到第二静态库的符号表中,得到所述各单架构静态库对应的带依赖关系的第二符号表。The symbol table of the first static library in each static library group is respectively added to the symbol table of the second static library to obtain the second symbol table with dependencies corresponding to each of the single-architecture static libraries.
可选的,在一实施例中,所述修改模块304包括:Optionally, in an embodiment, the modifying module 304 includes:
第一修改子模块,用于分别以所述第二符号表中各符号名称为匹配关键字,依次遍历所述各目标文件对应的第三符号表,得到匹配结果;The first modification submodule is used to traverse the third symbol table corresponding to each target file in turn by using each symbol name in the second symbol table as a matching keyword to obtain a matching result;
第二修改子模块,用于若所述匹配结果非空,则按预置修改规则,修改所述匹配结果对应匹配符号的符号名称、符号结构体大小及内存起始地址。The second modification sub-module is configured to modify the symbol name, symbol structure size and memory start address of the matching symbol corresponding to the matching result according to a preset modification rule if the matching result is not empty.
可选的,在一实施例中,所述第一修改子模块包括:Optionally, in an embodiment, the first modification submodule includes:
匹配单元,用于以所述第二符号表中未匹配符号的一个符号名称为匹配关键字,与未匹配的一个目标文件对应的第三符号表进行匹配,得到匹配结果;A matching unit, used for taking a symbol name of an unmatched symbol in the second symbol table as a matching keyword, and matching with a third symbol table corresponding to an unmatched target file to obtain a matching result;
第一判断单元,用于判断所述第二符号表中是否存在未匹配符号;a first judging unit for judging whether there is an unmatched symbol in the second symbol table;
第一循环单元,用于若所述第二符号表中存在未匹配符号,则循环执行匹配单元、第一判断单元;a first circulation unit, for cyclically executing a matching unit and a first judging unit if there is an unmatched symbol in the second symbol table;
第二判断单元,用于若所述第二符号表中不存在未匹配符号,则判断是否存在未匹配的目标文件;a second judging unit, configured to judge whether there is an unmatched target file if there is no unmatched symbol in the second symbol table;
第二循环单元,用于若存在未匹配的目标文件,则循环执行匹配单元、第一判断单元、第一循环单元及第二判断单元;The second circulation unit is used for cyclically executing the matching unit, the first judgment unit, the first circulation unit and the second judgment unit if there is an unmatched target file;
第三判断单元,用于若不存在未匹配的目标文件,则判断是否存在未匹配的第二符号表;The third judgment unit is used to judge whether there is an unmatched second symbol table if there is no unmatched target file;
第三循环单元,用于若存在未匹配的第二符号表,则循环执行匹配单元、第一判断单元、第一循环单元、第二判断单元、第二循环单元及第三判断单元。The third loop unit is configured to loop through the matching unit, the first judgment unit, the first loop unit, the second judgment unit, the second loop unit and the third judgment unit if there is an unmatched second symbol table.
可选的,在一实施例中,所述第二修改子模块具体用于:Optionally, in an embodiment, the second modification submodule is specifically used for:
在所述各匹配符号的符号名称前,添加相同的修饰符号,得到多个新符号;Before the symbol name of each matching symbol, add the same modifier symbol to obtain multiple new symbols;
将所述各新符号添加至对应单架构静态库的第一符号表中;adding the new symbols to the first symbol table corresponding to the single-architecture static library;
调整所述各单架构静态库的第一符号表中各新符号对应的符号结构体大小、内存起始地址。Adjust the size of the symbol structure and the starting address of the memory corresponding to each new symbol in the first symbol table of each single-architecture static library.
本申请实施例中,首先将存在冲突的多架构静态库分离为单架构静态库,由于各单架构静态库之间可能存在相互依赖关系,所有需要对各单架构静态库的符号表进行引用符号更新,得到存在依赖关系的符号表。然后再根据存在依赖关系的符号表,去匹配从单架构静态库中解压缩处理的目标文件,并把匹配到的目标文件中的符号进行重命名操作,从而解决多架构静态库之间符号冲突的问题。本申请对发生冲突的多架构静态库中的目标文件符号进行统一重命名,从而高效地生成稳定的新多架构静态库。In the embodiment of the present application, the conflicting multi-architecture static libraries are first separated into single-architecture static libraries. Since there may be interdependencies among the single-architecture static libraries, all the symbols need to be referenced to the symbol tables of the single-architecture static libraries. Update to get the symbol table with dependencies. Then, according to the symbol table with dependencies, match the object file decompressed from the single-architecture static library, and rename the symbols in the matched object file, so as to solve the symbol conflict between multi-architecture static libraries The problem. The present application uniformly renames the object file symbols in the conflicting multi-architecture static library, thereby efficiently generating a new stable multi-architecture static library.
上面图3从模块化功能实体的角度对本申请实施例中的多架构静态库冲突处理装置进行详细描述,下面从硬件处理的角度对本申请实施例中多架构静态库冲突处理设备进行详 细描述。Figure 3 above describes the multi-architecture static library conflict processing device in the embodiment of the present application in detail from the perspective of modular functional entities, and the following describes the multi-architecture static library conflict processing device in the embodiment of the present application in detail from the perspective of hardware processing.
图4是本申请实施例提供的一种多架构静态库冲突处理设备的结构示意图,该多架构静态库冲突处理设备500可因配置或性能不同而产生比较大的差异,可以包括一个或一个以上处理器(central processing units,CPU)510(例如,一个或一个以上处理器)和存储器520,一个或一个以上存储应用程序533或数据532的存储介质530(例如一个或一个以上海量存储设备)。其中,存储器520和存储介质530可以是短暂存储或持久存储。存储在存储介质530的程序可以包括一个或一个以上模块(图示没标出),每个模块可以包括对多架构静态库冲突处理设备500中的一系列指令操作。更进一步地,处理器510可以设置为与存储介质530通信,在多架构静态库冲突处理设备500上执行存储介质530中的一系列指令操作。FIG. 4 is a schematic structural diagram of a multi-architecture static library conflict processing device provided by an embodiment of the present application. The multi-architecture static library conflict processing device 500 may vary greatly due to different configurations or performances, and may include one or more than one Central processing units (CPU) 510 (eg, one or more processors) and memory 520, one or more storage media 530 (eg, one or more mass storage devices) that store application programs 533 or data 532. Among them, the memory 520 and the storage medium 530 may be short-term storage or persistent storage. The program stored in the storage medium 530 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations on the multi-architecture static library conflict processing apparatus 500 . Furthermore, the processor 510 may be configured to communicate with the storage medium 530 to execute a series of instruction operations in the storage medium 530 on the multi-architecture static library conflict processing device 500 .
多架构静态库冲突处理设备500还可以包括一个或一个以上电源540,一个或一个以上有线或无线网络接口550,一个或一个以上输入输出接口560,和/或,一个或一个以上操作系统531,例如Windows Serve,Mac OS X,Unix,Linux,FreeBSD等等。本领域技术人员可以理解,图4示出的多架构静态库冲突处理设备结构并不构成对多架构静态库冲突处理设备的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。The multi-architecture static library conflict processing device 500 may also include one or more power supplies 540, one or more wired or wireless network interfaces 550, one or more input and output interfaces 560, and/or, one or more operating systems 531, For example Windows Server, Mac OS X, Unix, Linux, FreeBSD, etc. Those skilled in the art can understand that the structure of the multi-architecture static library conflict processing device shown in FIG. 4 does not constitute a limitation on the multi-architecture static library conflict processing device, and may include more or less components than those shown in the figure, or a combination of certain some components, or a different arrangement of components.
本申请还提供一种多架构静态库冲突处理设备,所述多架构静态库冲突处理设备包括存储器和处理器,存储器中存储有计算机可读指令,计算机可读指令被处理器执行时,使得处理器执行上述各实施例中的所述多架构静态库冲突处理方法的步骤。The present application also provides a multi-architecture static library conflict processing device, the multi-architecture static library conflict processing device includes a memory and a processor, the memory stores computer-readable instructions, and when the computer-readable instructions are executed by the processor, causes processing The controller executes the steps of the multi-architecture static library conflict processing method in the above embodiments.
本申请还提供一种计算机可读存储介质,该计算机可读存储介质可以为非易失性计算机可读存储介质,该计算机可读存储介质也可以为易失性计算机可读存储介质,所述计算机可读存储介质中存储有指令,当所述指令在计算机上运行时,使得计算机执行所述多架构静态库冲突处理方法的步骤。The present application also provides a computer-readable storage medium. The computer-readable storage medium may be a non-volatile computer-readable storage medium. The computer-readable storage medium may also be a volatile computer-readable storage medium. The computer-readable storage medium stores instructions that, when executed on a computer, cause the computer to execute the steps of the multi-architecture static library conflict processing method.
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统,装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the system, device and unit described above may refer to the corresponding process in the foregoing method embodiments, which will not be repeated here.
所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(read-only memory,ROM)、随机存取存储器(random access memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。The integrated unit, if implemented in the form of a software functional unit and sold or used as an independent product, may be stored in a computer-readable storage medium. Based on this understanding, the technical solutions of the present application can be embodied in the form of software products in essence, or the parts that contribute to the prior art, or all or part of the technical solutions, and the computer software products are stored in a storage medium , including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), magnetic disk or optical disk and other media that can store program codes .
以上所述,以上实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的精神和范围。As mentioned above, the above embodiments are only used to illustrate the technical solutions of the present application, but not to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand: The technical solutions described in the embodiments are modified, or some technical features thereof are equivalently replaced; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions in the embodiments of the present application.

Claims (20)

  1. 一种多架构静态库冲突处理方法,其中,所述多架构静态库冲突处理方法包括:A multi-architecture static library conflict processing method, wherein the multi-architecture static library conflict processing method comprises:
    分别扫描各多架构静态库,提取存在静态库冲突的多架构静态库列表,并将所述多架构静态库列表中各多架构静态库分离为多个单架构静态库;Scanning each multi-architecture static library respectively, extracting a multi-architecture static library list with static library conflicts, and separating each multi-architecture static library in the multi-architecture static library list into a plurality of single-architecture static libraries;
    提取所述各单架构静态库的第一符号表,并对所述各单架构静态库的第一符号表进行引用符号更新,得到带依赖关系的第二符号表;extracting the first symbol tables of the single-architecture static libraries, and updating the reference symbols for the first symbol tables of the single-architecture static libraries to obtain a second symbol table with dependencies;
    对所述各单架构静态库进行解压缩处理,并从解压缩结果中提取各单架构静态库的目标文件列表及各目标文件对应的第三符号表;Decompressing the single-architecture static libraries, and extracting the target file list of each single-architecture static library and the third symbol table corresponding to each target file from the decompression result;
    参照所述第二符号表,修改所述第三符号表中对应符号的符号名称、符号结构体大小及内存起始地址;With reference to the second symbol table, modify the symbol name, symbol structure size and memory start address of the corresponding symbol in the third symbol table;
    重新压缩各单架构静态库对应目标文件列表中的目标文件,得到非冲突的多个新的单架构静态库,并将所述各新的单架构静态库合并为新的多架构静态库。The target files in the target file list corresponding to each single-architecture static library are recompressed to obtain multiple non-conflicting new single-architecture static libraries, and the new single-architecture static libraries are merged into a new multi-architecture static library.
  2. 根据权利要求1所述的多架构静态库冲突处理方法,其中,所述分别扫描各多架构静态库,提取存在静态库冲突的多架构静态库列表包括:The method for processing multi-architecture static library conflicts according to claim 1, wherein said scanning each multi-architecture static library separately, and extracting a list of multi-architecture static libraries with static library conflicts includes:
    分别扫描各多架构静态库,确认已集成静态库与待集成静态库;Scan each multi-architecture static library separately to confirm that the static library has been integrated and the static library to be integrated;
    分别提取所述已集成静态库的第四符号表与所述待集成静态库的第五符号表;respectively extracting the fourth symbol table of the integrated static library and the fifth symbol table of the static library to be integrated;
    判断所述第四符号表与所述第五符号表之间是否存在重复的符号名称;judging whether there are duplicate symbol names between the fourth symbol table and the fifth symbol table;
    若存在,则确定存在静态库冲突,并将静态库冲突对应的多架构静态库存入预置列表中,得到多架构静态库列表。If there is, it is determined that there is a static library conflict, and the multi-architecture static library corresponding to the static library conflict is added to the preset list to obtain a multi-architecture static library list.
  3. 根据权利要求1所述的多架构静态库冲突处理方法,其中,所述提取所述各单架构静态库的第一符号表,并对所述各单架构静态库的第一符号表进行引用符号更新,得到带依赖关系的第二符号表包括:The multi-architecture static library conflict processing method according to claim 1, wherein the extracting the first symbol table of each single-architecture static library, and referencing the first symbol table of each single-architecture static library Update, get a second symbol table with dependencies including:
    提取所述各单架构静态库的第一符号表,并确定所述各单架构静态库之间的相互依赖关系;extracting the first symbol tables of the single-architecture static libraries, and determining the interdependence between the single-architecture static libraries;
    根据所述各单架构静态库之间的相互依赖关系,对所述各单架构静态库的第一符号表进行引用符号更新,得到带依赖关系的第二符号表。According to the interdependence between the single-architecture static libraries, the reference symbols are updated on the first symbol tables of the single-architecture static libraries to obtain a second symbol table with dependencies.
  4. 根据权利要求1或3所述的多架构静态库冲突处理方法,其中,所述对所述各单架构静态库的第一符号表进行引用符号更新,得到带依赖关系的第二符号表包括:The multi-architecture static library conflict processing method according to claim 1 or 3, wherein the updating of the reference symbols on the first symbol tables of the single-architecture static libraries to obtain the second symbol table with dependencies comprises:
    导出所述各第一符号表中的所有外部符号,并根据所述各外部符号之间的依赖关系,确定所述各单架构静态库之间的相互依赖关系;Deriving all external symbols in the first symbol tables, and determining the interdependence between the single-architecture static libraries according to the dependency between the external symbols;
    从所述各单架构静态库之间的相互依赖关系中筛选出存在依赖调用关系的多个静态库组,其中,所述静态库组包括第一静态库与第二静态库,且所述第二静态库依赖所述第一静态库;From the interdependencies between the single-architecture static libraries, a plurality of static library groups with dependent calling relationships are screened, wherein the static library group includes a first static library and a second static library, and the first static library Two static libraries depend on the first static library;
    分别将所述各静态库组中第一静态库的符号表添加到第二静态库的符号表中,得到所述各单架构静态库对应的带依赖关系的第二符号表。The symbol table of the first static library in each static library group is respectively added to the symbol table of the second static library to obtain the second symbol table with dependencies corresponding to each of the single-architecture static libraries.
  5. 根据权利要求1所述的多架构静态库冲突处理方法,其中,所述参照所述第二符号表,修改所述第三符号表中对应符号的符号名称、符号结构体大小及内存起始地址包括:The method for handling multi-architecture static library conflicts according to claim 1, wherein, by referring to the second symbol table, modifying the symbol name, symbol structure size and memory start address of the corresponding symbol in the third symbol table include:
    分别以所述第二符号表中各符号名称为匹配关键字,依次遍历所述各目标文件对应的第三符号表,得到匹配结果;Taking each symbol name in the second symbol table as a matching keyword, traverse the third symbol table corresponding to each target file in turn to obtain a matching result;
    若所述匹配结果非空,则按预置修改规则,修改所述匹配结果对应匹配符号的符号名称、符号结构体大小及内存起始地址。If the matching result is not empty, modify the symbol name, symbol structure size and memory start address of the matching symbol corresponding to the matching result according to the preset modification rule.
  6. 根据权利要求5所述的多架构静态库冲突处理方法,其中,所述分别以所述第二符号表中各符号名称为匹配关键字,依次遍历所述各目标文件对应的第三符号表,得到匹配结果包括:The multi-architecture static library conflict processing method according to claim 5, wherein the third symbol table corresponding to each target file is sequentially traversed by using each symbol name in the second symbol table as a matching keyword, The matching results obtained include:
    S1、以所述第二符号表中未匹配符号的一个符号名称为匹配关键字,与未匹配的一个目标文件对应的第三符号表进行匹配,得到匹配结果;S1, take a symbol name of an unmatched symbol in the second symbol table as a matching keyword, and match with a third symbol table corresponding to an unmatched target file to obtain a matching result;
    S2、判断所述第二符号表中是否存在未匹配符号;S2, judging whether there is an unmatched symbol in the second symbol table;
    S3、若所述第二符号表中存在未匹配符号,则循环执行S1-S2;S3, if there is an unmatched symbol in the second symbol table, cyclically execute S1-S2;
    S4、若所述第二符号表中不存在未匹配符号,则判断是否存在未匹配的目标文件;S4, if there is no unmatched symbol in the second symbol table, then determine whether there is an unmatched target file;
    S5、若存在未匹配的目标文件,则循环执行S1-S4;S5. If there is an unmatched target file, execute S1-S4 in a loop;
    S6、若不存在未匹配的目标文件,则判断是否存在未匹配的第二符号表;S6, if there is no unmatched target file, determine whether there is an unmatched second symbol table;
    S7、若存在未匹配的第二符号表,则循环执行S1-S6。S7. If there is an unmatched second symbol table, cyclically execute S1-S6.
  7. 根据权利要求5所述的多架构静态库冲突处理方法,其中,所述若所述匹配结果非空,则按预置修改规则,修改所述匹配结果对应匹配符号的符号名称、符号结构体大小及内存起始地址包括:The multi-architecture static library conflict processing method according to claim 5, wherein, if the matching result is not empty, modify the symbol name and symbol structure size of the matching symbol corresponding to the matching result according to a preset modification rule And the memory start address includes:
    若所述匹配结果非空,则在所述各匹配符号的符号名称前,添加相同的修饰符号,得到多个新符号;If the matching result is not empty, add the same modifier symbol before the symbol name of each matching symbol to obtain a plurality of new symbols;
    将所述各新符号添加至对应单架构静态库的第一符号表中;adding the new symbols to the first symbol table corresponding to the single-architecture static library;
    调整所述各单架构静态库的第一符号表中各新符号对应的符号结构体大小、内存起始地址。Adjust the size of the symbol structure and the starting address of the memory corresponding to each new symbol in the first symbol table of each single-architecture static library.
  8. 一种多架构静态库冲突处理装置,其中,所述多架构静态库冲突处理装置包括:A multi-architecture static library conflict processing device, wherein the multi-architecture static library conflict processing device comprises:
    提取模块,用于分别扫描各多架构静态库,提取存在静态库冲突的多架构静态库列表,并将所述多架构静态库列表中各多架构静态库分离为多个单架构静态库;an extraction module, configured to scan each multi-architecture static library respectively, extract a multi-architecture static library list with static library conflicts, and separate each multi-architecture static library in the multi-architecture static library list into a plurality of single-architecture static libraries;
    更新模块,用于提取所述各单架构静态库的第一符号表,并对所述各单架构静态库的第一符号表进行引用符号更新,得到带依赖关系的第二符号表;an update module for extracting the first symbol tables of the single-architecture static libraries, and updating the reference symbols for the first symbol tables of the single-architecture static libraries to obtain a second symbol table with dependencies;
    解压模块,用于对所述各单架构静态库进行解压缩处理,并从解压缩结果中提取各单架构静态库的目标文件列表及各目标文件对应的第三符号表;a decompression module, used for decompressing the single-architecture static libraries, and extracting the target file list of each single-architecture static library and the third symbol table corresponding to each target file from the decompression result;
    修改模块,用于参照所述第二符号表,修改所述第三符号表中对应符号的符号名称、符号结构体大小及内存起始地址;a modification module, configured to modify the symbol name, symbol structure size and memory start address of the corresponding symbol in the third symbol table with reference to the second symbol table;
    压缩模块,用于重新压缩各单架构静态库对应目标文件列表中的目标文件,得到非冲突的多个新的单架构静态库,并将所述各新的单架构静态库合并为新的多架构静态库。The compression module is used to recompress the target files in the target file list corresponding to each single-architecture static library, obtain a plurality of non-conflicting new single-architecture static libraries, and merge the new single-architecture static libraries into new multi-architecture static libraries. Architecture static library.
  9. 一种多架构静态库冲突处理设备,其中,所述多架构静态库冲突处理设备包括:存储器和至少一个处理器;A multi-architecture static library conflict processing device, wherein the multi-architecture static library conflict processing device includes: a memory and at least one processor;
    所述至少一个处理器调用所述存储器中的所述指令,以使得所述多架构静态库冲突处理设备执行如下所述的多架构静态库冲突处理方法的步骤:The at least one processor invokes the instructions in the memory, so that the multi-architecture static library conflict processing device executes the steps of the multi-architecture static library conflict processing method as follows:
    分别扫描各多架构静态库,提取存在静态库冲突的多架构静态库列表,并将所述多架构静态库列表中各多架构静态库分离为多个单架构静态库;Scanning each multi-architecture static library respectively, extracting a multi-architecture static library list with static library conflicts, and separating each multi-architecture static library in the multi-architecture static library list into a plurality of single-architecture static libraries;
    提取所述各单架构静态库的第一符号表,并对所述各单架构静态库的第一符号表进行引用符号更新,得到带依赖关系的第二符号表;extracting the first symbol tables of the single-architecture static libraries, and updating the reference symbols for the first symbol tables of the single-architecture static libraries to obtain a second symbol table with dependencies;
    对所述各单架构静态库进行解压缩处理,并从解压缩结果中提取各单架构静态库的目标文件列表及各目标文件对应的第三符号表;Decompressing the single-architecture static libraries, and extracting the target file list of each single-architecture static library and the third symbol table corresponding to each target file from the decompression result;
    参照所述第二符号表,修改所述第三符号表中对应符号的符号名称、符号结构体大小及内存起始地址;With reference to the second symbol table, modify the symbol name, symbol structure size and memory start address of the corresponding symbol in the third symbol table;
    重新压缩各单架构静态库对应目标文件列表中的目标文件,得到非冲突的多个新的单架构静态库,并将所述各新的单架构静态库合并为新的多架构静态库。The target files in the target file list corresponding to each single-architecture static library are recompressed to obtain multiple non-conflicting new single-architecture static libraries, and the new single-architecture static libraries are merged into a new multi-architecture static library.
  10. 根据权利要求9所述的多架构静态库冲突处理设备,其中,所述多架构静态库冲突处理设备被所述处理器执行所述分别扫描各多架构静态库,提取存在静态库冲突的多架构静态库列表的步骤时,包括:The multi-architecture static library conflict processing device according to claim 9, wherein the multi-architecture static library conflict processing device is executed by the processor to scan each multi-architecture static library separately, and extract the multi-architectures with static library conflicts When listing the static libraries, the steps include:
    分别扫描各多架构静态库,确认已集成静态库与待集成静态库;Scan each multi-architecture static library separately to confirm that the static library has been integrated and the static library to be integrated;
    分别提取所述已集成静态库的第四符号表与所述待集成静态库的第五符号表;respectively extracting the fourth symbol table of the integrated static library and the fifth symbol table of the static library to be integrated;
    判断所述第四符号表与所述第五符号表之间是否存在重复的符号名称;judging whether there are duplicate symbol names between the fourth symbol table and the fifth symbol table;
    若存在,则确定存在静态库冲突,并将静态库冲突对应的多架构静态库存入预置列表中,得到多架构静态库列表。If there is, it is determined that there is a static library conflict, and the multi-architecture static library corresponding to the static library conflict is added to the preset list to obtain a multi-architecture static library list.
  11. 根据权利要求9所述的多架构静态库冲突处理设备,其中,所述多架构静态库冲突处理设备被所述处理器执行所述提取所述各单架构静态库的第一符号表,并对所述各单架构静态库的第一符号表进行引用符号更新,得到带依赖关系的第二符号表的步骤时,包括:The multi-architecture static library conflict processing device according to claim 9, wherein the multi-architecture static library conflict processing device is executed by the processor to extract the first symbol table of each single-architecture static library, and perform the extraction of the first symbol table of each single-architecture static library. When the first symbol table of each single-architecture static library is updated with reference symbols to obtain the second symbol table with dependencies, the steps include:
    提取所述各单架构静态库的第一符号表,并确定所述各单架构静态库之间的相互依赖关系;extracting the first symbol tables of the single-architecture static libraries, and determining the interdependence between the single-architecture static libraries;
    根据所述各单架构静态库之间的相互依赖关系,对所述各单架构静态库的第一符号表进行引用符号更新,得到带依赖关系的第二符号表。According to the interdependencies among the single-architecture static libraries, the reference symbols are updated to the first symbol tables of the single-architecture static libraries to obtain a second symbol table with dependencies.
  12. 根据权利要求9或11所述的多架构静态库冲突处理设备,其中,所述多架构静态库冲突处理设备被所述处理器执行所述对所述各单架构静态库的第一符号表进行引用符号更新,得到带依赖关系的第二符号表的步骤时,包括:The multi-architecture static library conflict processing device according to claim 9 or 11, wherein the multi-architecture static library conflict processing device is executed by the processor to perform the processing on the first symbol tables of the single-architecture static libraries. When referencing symbol update, the steps to obtain the second symbol table with dependencies include:
    导出所述各第一符号表中的所有外部符号,并根据所述各外部符号之间的依赖关系,确定所述各单架构静态库之间的相互依赖关系;Deriving all external symbols in the first symbol tables, and determining the interdependence between the single-architecture static libraries according to the dependency between the external symbols;
    从所述各单架构静态库之间的相互依赖关系中筛选出存在依赖调用关系的多个静态库组,其中,所述静态库组包括第一静态库与第二静态库,且所述第二静态库依赖所述第一静态库;From the interdependencies between the single-architecture static libraries, a plurality of static library groups with dependent calling relationships are screened, wherein the static library group includes a first static library and a second static library, and the first static library Two static libraries depend on the first static library;
    分别将所述各静态库组中第一静态库的符号表添加到第二静态库的符号表中,得到所述各单架构静态库对应的带依赖关系的第二符号表。The symbol table of the first static library in each static library group is respectively added to the symbol table of the second static library to obtain the second symbol table with dependencies corresponding to each of the single-architecture static libraries.
  13. 根据权利要求9所述的多架构静态库冲突处理设备,其中,所述多架构静态库冲突处理设备被所述处理器执行所述参照所述第二符号表,修改所述第三符号表中对应符号的符号名称、符号结构体大小及内存起始地址的步骤时,包括:The multi-architecture static library conflict processing device according to claim 9, wherein the multi-architecture static library conflict processing device is executed by the processor to refer to the second symbol table and modify the third symbol table. The steps corresponding to the symbol name, symbol structure size and memory start address of the symbol include:
    分别以所述第二符号表中各符号名称为匹配关键字,依次遍历所述各目标文件对应的第三符号表,得到匹配结果;Taking each symbol name in the second symbol table as a matching keyword, traverse the third symbol table corresponding to each target file in turn to obtain a matching result;
    若所述匹配结果非空,则按预置修改规则,修改所述匹配结果对应匹配符号的符号名称、符号结构体大小及内存起始地址。If the matching result is not empty, modify the symbol name, symbol structure size and memory start address of the matching symbol corresponding to the matching result according to the preset modification rule.
  14. 根据权利要求13所述的多架构静态库冲突处理设备,其中,所述多架构静态库冲突处理设备被所述处理器执行所述分别以所述第二符号表中各符号名称为匹配关键字,依次遍历所述各目标文件对应的第三符号表,得到匹配结果的步骤时,包括:The multi-architecture static library conflict processing device according to claim 13 , wherein the multi-architecture static library conflict processing device is executed by the processor and uses each symbol name in the second symbol table as a matching keyword. , traverse the third symbol table corresponding to each target file in turn, and the steps of obtaining a matching result include:
    S1、以所述第二符号表中未匹配符号的一个符号名称为匹配关键字,与未匹配的一个目标文件对应的第三符号表进行匹配,得到匹配结果;S1, take a symbol name of an unmatched symbol in the second symbol table as a matching keyword, and match with a third symbol table corresponding to an unmatched target file to obtain a matching result;
    S2、判断所述第二符号表中是否存在未匹配符号;S2, judging whether there is an unmatched symbol in the second symbol table;
    S3、若所述第二符号表中存在未匹配符号,则循环执行S1-S2;S3, if there is an unmatched symbol in the second symbol table, cyclically execute S1-S2;
    S4、若所述第二符号表中不存在未匹配符号,则判断是否存在未匹配的目标文件;S4, if there is no unmatched symbol in the second symbol table, then determine whether there is an unmatched target file;
    S5、若存在未匹配的目标文件,则循环执行S1-S4;S5. If there is an unmatched target file, execute S1-S4 cyclically;
    S6、若不存在未匹配的目标文件,则判断是否存在未匹配的第二符号表;S6, if there is no unmatched target file, determine whether there is an unmatched second symbol table;
    S7、若存在未匹配的第二符号表,则循环执行S1-S6。S7. If there is an unmatched second symbol table, cyclically execute S1-S6.
  15. 根据权利要求13所述的多架构静态库冲突处理设备,其中,所述多架构静态库冲突处理设备被所述处理器执行所述若所述匹配结果非空,则按预置修改规则,修改所述匹配结果对应匹配符号的符号名称、符号结构体大小及内存起始地址的步骤时,包括:The multi-architecture static library conflict processing device according to claim 13, wherein the multi-architecture static library conflict processing device is executed by the processor, and if the matching result is not empty, modifying the device according to a preset modification rule When the matching result corresponds to the symbol name, symbol structure size and memory start address of the matching symbol, the steps include:
    若所述匹配结果非空,则在所述各匹配符号的符号名称前,添加相同的修饰符号,得到多个新符号;If the matching result is not empty, add the same modifier symbol before the symbol name of each matching symbol to obtain a plurality of new symbols;
    将所述各新符号添加至对应单架构静态库的第一符号表中;adding the new symbols to the first symbol table corresponding to the single-architecture static library;
    调整所述各单架构静态库的第一符号表中各新符号对应的符号结构体大小、内存起始地址。Adjust the size of the symbol structure and the starting address of the memory corresponding to each new symbol in the first symbol table of each single-architecture static library.
  16. 一种计算机可读存储介质,所述计算机可读存储介质上存储有指令,其中,所述指令被处理器执行时实现如下所述的多架构静态库冲突处理方法的步骤:A computer-readable storage medium storing instructions on the computer-readable storage medium, wherein when the instructions are executed by a processor, the steps of the multi-architecture static library conflict processing method described below are implemented:
    分别扫描各多架构静态库,提取存在静态库冲突的多架构静态库列表,并将所述多架构静态库列表中各多架构静态库分离为多个单架构静态库;Scanning each multi-architecture static library respectively, extracting a multi-architecture static library list with static library conflicts, and separating each multi-architecture static library in the multi-architecture static library list into a plurality of single-architecture static libraries;
    提取所述各单架构静态库的第一符号表,并对所述各单架构静态库的第一符号表进行引用符号更新,得到带依赖关系的第二符号表;extracting the first symbol tables of the single-architecture static libraries, and updating the reference symbols for the first symbol tables of the single-architecture static libraries to obtain a second symbol table with dependencies;
    对所述各单架构静态库进行解压缩处理,并从解压缩结果中提取各单架构静态库的目标文件列表及各目标文件对应的第三符号表;Decompressing the single-architecture static libraries, and extracting the target file list of each single-architecture static library and the third symbol table corresponding to each target file from the decompression result;
    参照所述第二符号表,修改所述第三符号表中对应符号的符号名称、符号结构体大小及内存起始地址;With reference to the second symbol table, modify the symbol name, symbol structure size and memory start address of the corresponding symbol in the third symbol table;
    重新压缩各单架构静态库对应目标文件列表中的目标文件,得到非冲突的多个新的单架构静态库,并将所述各新的单架构静态库合并为新的多架构静态库。The target files in the target file list corresponding to each single-architecture static library are recompressed to obtain multiple non-conflicting new single-architecture static libraries, and the new single-architecture static libraries are merged into a new multi-architecture static library.
  17. 根据权利要求16所述的计算机可读存储介质,其中,所述多架构静态库冲突处理的指令被所述处理器执行所述分别扫描各多架构静态库,提取存在静态库冲突的多架构静态库列表的步骤时,包括:The computer-readable storage medium according to claim 16, wherein the instruction for processing the multi-architecture static library conflict is executed by the processor to scan each multi-architecture static library separately, and extract the multi-architecture static library conflict with the static library. When listing the steps in the library, include:
    分别扫描各多架构静态库,确认已集成静态库与待集成静态库;Scan each multi-architecture static library separately to confirm that the static library has been integrated and the static library to be integrated;
    分别提取所述已集成静态库的第四符号表与所述待集成静态库的第五符号表;respectively extracting the fourth symbol table of the integrated static library and the fifth symbol table of the static library to be integrated;
    判断所述第四符号表与所述第五符号表之间是否存在重复的符号名称;Judging whether there are duplicate symbol names between the fourth symbol table and the fifth symbol table;
    若存在,则确定存在静态库冲突,并将静态库冲突对应的多架构静态库存入预置列表中,得到多架构静态库列表。If it exists, it is determined that there is a static library conflict, and the multi-architecture static library corresponding to the static library conflict is added to the preset list to obtain a multi-architecture static library list.
  18. 根据权利要求16所述的计算机可读存储介质,其中,所述多架构静态库冲突处理的指令被所述处理器执行所述提取所述各单架构静态库的第一符号表,并对所述各单架构静态库的第一符号表进行引用符号更新,得到带依赖关系的第二符号表的步骤时,包括:17. The computer-readable storage medium of claim 16, wherein the multi-architecture static library conflict handling instructions are executed by the processor to extract the first symbol table of each single-architecture static library, and perform a When the first symbol table of each single-architecture static library is described to update the reference symbols to obtain the second symbol table with dependencies, the steps include:
    提取所述各单架构静态库的第一符号表,并确定所述各单架构静态库之间的相互依赖关系;extracting the first symbol tables of the single-architecture static libraries, and determining the interdependence between the single-architecture static libraries;
    根据所述各单架构静态库之间的相互依赖关系,对所述各单架构静态库的第一符号表进行引用符号更新,得到带依赖关系的第二符号表。According to the interdependencies among the single-architecture static libraries, the reference symbols are updated to the first symbol tables of the single-architecture static libraries to obtain a second symbol table with dependencies.
  19. 根据权利要求16或18所述的计算机可读存储介质,其中,所述多架构静态库冲突处理的指令被所述处理器执行所述对所述各单架构静态库的第一符号表进行引用符号更新,得到带依赖关系的第二符号表的步骤时,包括:The computer-readable storage medium of claim 16 or 18, wherein the instructions for multi-architecture static library conflict handling are executed by the processor to reference the first symbol table of each single-architecture static library When symbols are updated, the steps to obtain the second symbol table with dependencies include:
    导出所述各第一符号表中的所有外部符号,并根据所述各外部符号之间的依赖关系,确定所述各单架构静态库之间的相互依赖关系;Deriving all external symbols in the first symbol tables, and determining the interdependence between the single-architecture static libraries according to the dependency between the external symbols;
    从所述各单架构静态库之间的相互依赖关系中筛选出存在依赖调用关系的多个静态库组,其中,所述静态库组包括第一静态库与第二静态库,且所述第二静态库依赖所述第一静态库;From the interdependencies between the single-architecture static libraries, a plurality of static library groups with dependent calling relationships are screened, wherein the static library group includes a first static library and a second static library, and the first static library Two static libraries depend on the first static library;
    分别将所述各静态库组中第一静态库的符号表添加到第二静态库的符号表中,得到所述各单架构静态库对应的带依赖关系的第二符号表。The symbol table of the first static library in each static library group is respectively added to the symbol table of the second static library, so as to obtain a second symbol table with dependencies corresponding to each of the single-architecture static libraries.
  20. 根据权利要求16所述的计算机可读存储介质,其中,所述多架构静态库冲突处理的指令被所述处理器执行所述参照所述第二符号表,修改所述第三符号表中对应符号的符 号名称、符号结构体大小及内存起始地址的步骤时,包括:The computer-readable storage medium according to claim 16, wherein the instruction of the multi-architecture static library conflict handling is executed by the processor by referring to the second symbol table, and modifying the corresponding data in the third symbol table. The steps for the symbol name, symbol structure size, and memory start address of the symbol include:
    分别以所述第二符号表中各符号名称为匹配关键字,依次遍历所述各目标文件对应的第三符号表,得到匹配结果;Taking each symbol name in the second symbol table as a matching keyword, traverse the third symbol table corresponding to each target file in turn to obtain a matching result;
    若所述匹配结果非空,则按预置修改规则,修改所述匹配结果对应匹配符号的符号名称、符号结构体大小及内存起始地址。If the matching result is not empty, modify the symbol name, symbol structure size and memory start address of the matching symbol corresponding to the matching result according to the preset modification rule.
PCT/CN2021/083792 2020-12-03 2021-03-30 Multi-architecture static library conflict processing method and apparatus, device, and storage medium WO2022116437A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202011393997.3A CN112506558A (en) 2020-12-03 2020-12-03 Multi-architecture static library conflict processing method, device, equipment and storage medium
CN202011393997.3 2020-12-03

Publications (1)

Publication Number Publication Date
WO2022116437A1 true WO2022116437A1 (en) 2022-06-09

Family

ID=74969367

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/083792 WO2022116437A1 (en) 2020-12-03 2021-03-30 Multi-architecture static library conflict processing method and apparatus, device, and storage medium

Country Status (2)

Country Link
CN (1) CN112506558A (en)
WO (1) WO2022116437A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114816370A (en) * 2022-06-29 2022-07-29 广州易方信息科技股份有限公司 Method for splitting SDK static library at iOS end at any fine granularity

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112506558A (en) * 2020-12-03 2021-03-16 平安科技(深圳)有限公司 Multi-architecture static library conflict processing method, device, equipment and storage medium
CN114840195B (en) * 2022-06-29 2022-10-04 广州易方信息科技股份有限公司 Privatization method for iOS SDK static library

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110246966A1 (en) * 2010-04-06 2011-10-06 Sony Computer Entertainment America Inc. Embedding source files into program symbol files
CN107480068A (en) * 2017-08-22 2017-12-15 武汉斗鱼网络科技有限公司 Code integrity detection method, device, electric terminal and readable storage medium storing program for executing
CN108614696A (en) * 2016-12-08 2018-10-02 腾讯科技(深圳)有限公司 The method and device that a kind of method that application makes, static library generate
CN110609788A (en) * 2019-08-27 2019-12-24 绿漫科技有限公司 Automatic method for detecting static library conflict
CN112506558A (en) * 2020-12-03 2021-03-16 平安科技(深圳)有限公司 Multi-architecture static library conflict processing method, device, equipment and storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110246966A1 (en) * 2010-04-06 2011-10-06 Sony Computer Entertainment America Inc. Embedding source files into program symbol files
CN108614696A (en) * 2016-12-08 2018-10-02 腾讯科技(深圳)有限公司 The method and device that a kind of method that application makes, static library generate
CN107480068A (en) * 2017-08-22 2017-12-15 武汉斗鱼网络科技有限公司 Code integrity detection method, device, electric terminal and readable storage medium storing program for executing
CN110609788A (en) * 2019-08-27 2019-12-24 绿漫科技有限公司 Automatic method for detecting static library conflict
CN112506558A (en) * 2020-12-03 2021-03-16 平安科技(深圳)有限公司 Multi-architecture static library conflict processing method, device, equipment and storage medium

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114816370A (en) * 2022-06-29 2022-07-29 广州易方信息科技股份有限公司 Method for splitting SDK static library at iOS end at any fine granularity

Also Published As

Publication number Publication date
CN112506558A (en) 2021-03-16

Similar Documents

Publication Publication Date Title
WO2022116437A1 (en) Multi-architecture static library conflict processing method and apparatus, device, and storage medium
US20230126005A1 (en) Consistent filtering of machine learning data
US10366053B1 (en) Consistent randomized record-level splitting of machine learning data
US11100420B2 (en) Input processing for machine learning
US20150379426A1 (en) Optimized decision tree based models
US20150363195A1 (en) Software package management
US10360002B2 (en) Method, apparatus, and computer-readable medium for generating an alternative implementation of a program on one or more engines
CN107402798B (en) Method and apparatus for converting sequencing scripts to reuse JCL in different coding environments
Schlegel et al. Management of machine learning lifecycle artifacts: A survey
US20140074849A1 (en) Remote artifact repository
EP3384385A1 (en) Methods and systems for mapping object oriented/functional languages to database languages
US20080201290A1 (en) Computer-implemented methods, systems, and computer program products for enhanced batch mode processing of a relational database
CN111932207A (en) Project data processing method and device, computer equipment and storage medium
US9411618B2 (en) Metadata-based class loading using a content repository
CN113495728A (en) Dependency relationship determination method, dependency relationship determination device, electronic equipment and medium
CN113515303B (en) Project transformation method, device and equipment
US10606805B2 (en) Object-level image query and retrieval
US9396239B2 (en) Compiling method, storage medium and compiling apparatus
CN113342749A (en) File path matching method, device, equipment and computer readable storage medium
JP6737039B2 (en) Database system, data processing program, and data processing method
CN111400243B (en) Development management system based on pipeline service and file storage method and device
US11941379B1 (en) Accelerating static program analysis with artifact reuse
Şeker et al. Summarising big data: public GitHub dataset for software engineering challenges
CN110737429A (en) modular compiling method and device utilizing Makefile self-dependent relationship
US11256602B2 (en) Source code file retrieval

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 21899481

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 21899481

Country of ref document: EP

Kind code of ref document: A1