CN116661779B - Multi-compiler hybrid link method based on symbol dynamic redirection - Google Patents

Multi-compiler hybrid link method based on symbol dynamic redirection Download PDF

Info

Publication number
CN116661779B
CN116661779B CN202310926311.XA CN202310926311A CN116661779B CN 116661779 B CN116661779 B CN 116661779B CN 202310926311 A CN202310926311 A CN 202310926311A CN 116661779 B CN116661779 B CN 116661779B
Authority
CN
China
Prior art keywords
library
symbol
compiler
address
link
Prior art date
Legal status (The legal status 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 status listed.)
Active
Application number
CN202310926311.XA
Other languages
Chinese (zh)
Other versions
CN116661779A (en
Inventor
温研
杜凯
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Linzhuo Information Technology Co Ltd
Original Assignee
Beijing Linzhuo Information Technology Co Ltd
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 Beijing Linzhuo Information Technology Co Ltd filed Critical Beijing Linzhuo Information Technology Co Ltd
Priority to CN202310926311.XA priority Critical patent/CN116661779B/en
Publication of CN116661779A publication Critical patent/CN116661779A/en
Application granted granted Critical
Publication of CN116661779B publication Critical patent/CN116661779B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/36Software reuse
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44521Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/448Execution paradigms, e.g. implementations of programming paradigms
    • G06F9/4482Procedural
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

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

Abstract

The invention discloses a multi-compiler mixed linking method based on symbol dynamic redirection, which obtains function names or variable names of error symbols in source codes based on a mapping relation between a built compiler and a symbol reduction function of the built compiler, simultaneously obtains function names or variable names of symbols in the source codes in all currently used linked libraries to form a library source name table, determines symbols corresponding to the error symbols through comparison with the library source name table, and completes proxy and export of the error symbols through constructing an encapsulation library, thereby solving the problem of symbol mismatch during program compiling caused by difference of compiler name modification rules.

Description

Multi-compiler hybrid link method based on symbol dynamic redirection
Technical Field
The invention belongs to the technical field of computer application development, and particularly relates to a multi-compiler hybrid link method based on symbol dynamic redirection.
Background
In some programming languages, function reloads or method reloads are mainly used to create a plurality of homonymous functions with different implementations. The specific implementation of the function appropriate to the calling context will be run when the reload function is called, in other words, the calling reload function enables different tasks to be performed depending on the context.
Name manipulation (Name manipulation) is used in compiler construction to solve various problems caused by resolving unique names for programming entities, and provides a method of encoding additional information in the form of names of functions, structures, classes, or other data types in order to pass more semantic information from the compiler to the Linker. However, different compilers, even different versions of the same compiler, have different name modification rules, that is, the names of the same function compiled by different compilers often have large differences, which results in that a dynamic library or a static library generated by a certain compiler cannot be identified by other compilers, that is, cannot be used when linking after compiling program source code. For example, a dynamic library or a static library libA is compiled by the GCC, the libA realizes and derives a function fun, the symbol derived by modifying the name of the function fun by the GCC is funX, however, if a user writes the program A and uses a clang compiler to execute compiling, the user modifies the name of the function fun into funY due to the modification rule according to the name of clang, and the program A is linked to fail.
In summary, the existing compiling framework has the problem that the symbols of the program in compiling are not matched due to the difference of name modification rules among different compilers or different versions of the same compiler.
Disclosure of Invention
In view of the above, the present invention provides a hybrid linking method of multiple compilers based on dynamic redirection of symbols, which realizes hybrid linking of symbols under multiple compilers.
The invention provides a multi-compiler hybrid link method based on symbol dynamic redirection, which comprises the following steps:
step 1, extracting symbol reduction functions of different compilers and different versions of the same compiler, packaging the symbol reduction functions into API interfaces, marking the API interfaces as symbol reduction APIs, and establishing a mapping relation between the compiler and the symbol reduction APIs as compiler reduction mapping;
step 2, if the first compiler compiles the target program to execute the link operation to generate symbol errors which cannot be resolved, adding the current error symbol into an error symbol list, and sequentially adding a link library related to the current link operation into a link library list according to the link sequence; otherwise, if the target program has completed compiling the link completely, ending the flow, and if the target program has not completed compiling the link completely, executing step 2;
step 3, searching a symbol reduction API corresponding to the first compiler in the compiler reduction mapping to be marked as a first symbol reduction API, and executing symbol reduction operation on the current error symbol by adopting the first symbol reduction API to obtain a function name or a variable name of the current error symbol in the source code to be marked as a first source name;
step 4, the names of compilers generating the link libraries in the link library list are marked as second compilers, and symbol reduction APIs corresponding to the second compilers are searched in a compiler reduction map and marked as second symbol reduction APIs; performing symbol reduction operation on all symbols of the linked library by adopting a second symbol reduction API to obtain function names or variable names in source codes, and adding the function names or variable names into a library source name table;
step 5, if the names which are the same as the first source names exist in the library source name table, marking the symbols which are matched with the first source names in the corresponding link libraries as first library symbols, and marking the link libraries which are corresponding to the first source names as first link libraries; establishing a first encapsulation library to encapsulate a source code of a first proxy, wherein the first proxy is a proxy function or a proxy variable of a current error symbol with the same name as the first source name, and the identifier of the first proxy is set to be exported; if not, ending the flow;
step 6, adding an initialization function into a first encapsulation library to be recorded as an encapsulation initialization function, and then adding the encapsulation initialization function into an initialization function list of a target program, so that the encapsulation initialization function can be called when the target program is executed; the package initialization function is used for processing data access abnormality when the current error symbol is a variable, and acquiring a memory address of a first agent as a new instruction address to execute subsequent operations when the abnormality occurs;
and 7, compiling the first packaging library by using a first compiler to obtain a first packaging link library, adding the first packaging link library into a link library list, and executing the step 2.
Further, the link library is a static library or a dynamic library.
Further, in the step 7, the first package link library is a static library or a dynamic library.
Further, the implementation manner of the first agent when the current error symbol is a function is as follows:
the first proxy is a function with the same name as the first source, if the first linked library is a dynamic library, the dynamic library loading function is called to load the first linked library, then the symbol dynamic analysis function is called to acquire the address of the first library symbol and record the address as a function address, and the first library symbol is called according to the function address; if the first link library is a static library, acquiring a relative address of a first library symbol in the first link library as an offset address, acquiring an address of the first link library as a base address, taking the sum of the offset address and the base address as a function address, and jumping to the function address;
the source code of the first agent is added to the source code of the first encapsulation library.
Further, the implementation manner of the first agent when the current error symbol is a variable is as follows:
the first agent is the variable with the same name as the first source, if the first agent is executed for the first time, an unreadable data segment is added into a first encapsulation library and marked as an identification data segment, the first agent is defined as a data structure, the data structure comprises the address of a first link library, namely a base address, and the relative address of a first library symbol in the first link library, namely an offset address, the first agent is written into the identification data segment, and the source code of the first agent is added into the source code of the first encapsulation library; otherwise, the source code of the first agent is added to the source code of the first encapsulation library.
Further, the implementation manner of the package initialization function in the step 6 is as follows:
when the data address in the captured data access abnormality is in the identification data segment, a data structure in the identification data segment is obtained, the base address and the offset address in the data structure are summed to obtain an address A, the address A is used for replacing the operand address of the instruction A triggering the current abnormality, and then the instruction address of the current process is pointed to the instruction A and then the current process is continuously executed.
Further, the compiler in the compiler reduction map contains the name and version number of the compiler.
Advantageous effects
The invention obtains the function name or variable name of the error symbol in the source code based on the mapping relation between the constructed compiler and the symbol reduction function, and simultaneously obtains the function names or variable names of the symbols in the source code in all the link libraries currently used to form a library source name table, determines the symbol corresponding to the error symbol by comparing with the library source name table, and completes the proxy and the export of the error symbol by constructing the encapsulation library, thereby solving the problem of symbol mismatch during program compiling caused by the difference of compiler name modification rules.
Detailed Description
The present invention will be described in detail with reference to the following examples.
The invention provides a multi-compiler hybrid link method based on symbol dynamic redirection, which has the following core ideas: based on the constructed mapping relation between different compilers and the symbol reduction function, function names or variable names of the symbols in the source codes can be obtained, function names or variable names of the symbols in the source codes in all currently used link libraries are obtained to form a library source name table, symbols really corresponding to error symbols are determined through comparison with the library source name table, and the derivation of the symbols is completed through constructing an encapsulation library.
The invention provides a multi-compiler hybrid link method based on symbol dynamic redirection, which specifically comprises the following steps:
step 1, extracting symbol reduction functions, namely demangaging functions, of different compilers and different versions of the same compiler respectively, packaging the symbol reduction functions into API interfaces, and recording the API interfaces as symbol reduction APIs; and establishing mapping relations between different compilers and different versions of the same compiler and the symbol reduction API, and recording the mapping relations as compiler reduction mapping.
Step 2, if the first compiler compiles the target program to execute the link operation to generate the symbol error which cannot be resolved, adding the current error symbol into an error symbol list to obtain a link library searched by the current link operation, wherein the link library comprises a static library and a dynamic library, and adding the link library into a link library list in sequence according to the link sequence; otherwise, if the target program has completed compiling the link, the process is ended, and if the target program has not completed compiling the link, step 2 is executed.
The current error symbol is a symbol which cannot be resolved, and the name of the symbol is the name after the name modification is executed by the warp-knitting device. In the present invention, a compiler currently executing a program compiling operation is referred to as a first compiler.
Step 3, searching a corresponding symbol reduction API in the compiler reduction mapping according to the name and version of the first compiler, and marking the symbol reduction API as the first symbol reduction API; and performing symbol reduction operation on the current error symbol by using the first symbol reduction API to obtain the function name or variable name of the current error symbol in the source code, and recording the function name or variable name as a first source name.
Step 4, traversing the link library in the link library list, obtaining the name of a compiler generating the link library, marking the name as a second compiler, searching a corresponding symbol reduction API in a compiler reduction map according to the name and version of the second compiler, and marking the name as a second symbol reduction API; and performing symbol reduction operation on all symbols of the linked library by adopting a second symbol reduction API to obtain function names or variable names in source codes, and adding the function names or variable names into a library source name table.
Step 5, if the names identical to the first source names exist in the library source name table, the symbol names obtained by the two matched symbols after the name modification operation of different compilers or different versions of the same compiler are different, but the source names, namely the function names or variable names, are identical, the symbol of the symbol matched with the first source name in the corresponding link library is marked as a first library symbol, and the link library corresponding to the first source name is marked as a first link library; constructing a first encapsulation library for encapsulating a source code of a first agent which is a proxy function or a proxy variable of a current error symbol, wherein the name of the first agent is the same as the first source name, and setting the identification of the first agent to be exported; if not, the process is ended.
The first proxy is used for acquiring the actual memory address of the current error symbol, and then executing the link operation on the content of the actual memory address.
One implementation of the first agent is:
step 5.1, if the current error symbol is a function, executing step 5.2, and if the current error symbol is a variable, executing step 5.3.
Step 5.2, the first proxy is a function with the same name as the first source, if the first linked library is a dynamic library, a dynamic library loading function is called to load the first linked library, then a symbol dynamic analysis function is called to obtain the address of a first library symbol and recorded as a function address, and the first library symbol is called according to the function address; if the first link library is a static library, the relative address of the first library symbol in the first link library is obtained and marked as an offset address, the address of the first link library is obtained and marked as a base address, the sum of the offset address and the base address is used as a function address, the function address is jumped to, and then the step 5.4 is executed.
Step 5.3, the first agent is the variable with the same name as the first source, if the first agent is executed for the first time, adding a data segment which is not readable and writable in a first encapsulation library and is marked as an identification data segment is realized by adding a compiling modifier, the first agent is defined as a data structure, the data structure comprises two address class members, namely a base address which is an address of a first link library and a relative address which is an offset address of a first library symbol in the first link library, and the first agent is written in the identification data segment by adding the compiling modifier, so that step 5.4 is executed; otherwise, step 5.4 is performed.
And 5.4, adding the source code of the first agent into the source code of the first encapsulation library, identifying the first agent as exported, and ending the flow.
A location increment identifier of a function or variable is defined in the source code to derive its corresponding symbol.
Step 6, adding an initialization function into a first encapsulation library to be recorded as an encapsulation initialization function, and then adding the encapsulation initialization function into an initialization function list of a target program, so that the encapsulation initialization function can be called when the target program is executed; the package initialization function is used for processing data access abnormality when the current error sign is a variable, and when the abnormality is generated, the memory address of the first agent is obtained as a new instruction address to execute subsequent operations.
One implementation of the package initialization function is as follows:
when the data address in the captured data access abnormality is in the identification data segment, acquiring a data structure in the identification data segment, summing the base address and the offset address in the data structure to obtain an address A, and replacing the operand address of the instruction A triggering the current abnormality by the address A to realize that the operation of the instruction A on the data is directed to a first agent in a first link library; and then directing the instruction address of the current process to the instruction A and continuing to execute the instruction A.
And 7, compiling the first packaging library by using a first compiler to obtain a first packaging link library, adding the first packaging link library into a link library list, and then executing the step 2.
Examples
The embodiment adopts the multi-compiler hybrid link method based on symbol dynamic redirection, which is provided by the invention, and specifically comprises the following steps:
s1, for each version of each compiler, the following steps are respectively executed:
recording the current Compiler as a Compiler and the current version as V;
extracting a demangaging function of a version V of a Compiler, packaging the demangaging function as an API interface, and recording the API interface as a dema Compiler V, wherein the Compiler is a Compiler name, and V is a version number of the Compiler.
S2, establishing a mapping relation between the version V of the Compiler and the dem Compiler V, and marking the mapping relation as mapDemAPI2Compiler V.
S3, when an error of a symbol which cannot be resolved occurs when the compiler program mA executes a link operation, adding the symbol which cannot be resolved into a list unresolvedSymbiolList, wherein the symbols are all symbols subjected to name modification processing, and then:
s3.1, acquiring all dynamic libraries and static libraries searched by a Linker when linking the programA, and respectively and sequentially adding the dynamic libraries and the static libraries into a linkLibList according to a linking sequence.
The Linker searches all dynamic libraries and static libraries when obtaining the linking program ma in various ways, such as obtaining from compiling command lines, obtaining from makefiles, or obtaining from the default configuration of the current system link.
S3.2, marking each unresolved symbol in the unresolved SymbList as unresolved Symbol, wherein the unresolved Symbol is a symbol with a modified name, and respectively executing the following operations on the unresolved Symbol:
s3.2.1, obtaining the name and version of the current compiler, and finding the API interface dem compiler V of the demangaging function corresponding to the name and version in the mapDemeAPI 2compiler V.
S3.2.2 invoking demCompilerV to perform demanganning operation on unresolvedSymbol, getting the symbol name of the source code level before it is modified by the name, i.e. the function name or variable name it uses in the source code.
S3.2.3 for each dynamic or static library in the linkLibList, the following operations are performed sequentially:
(1) The current link library is marked as linkLib, and the link library is a static library or a dynamic library;
(2) The name and version of a compiler adopted by the generation of the linkLib can be obtained from meta information of a plurality of bytes at the beginning of the linkLib library file, a demangaging function API interface corresponding to the masquer API2compiler V is searched, and the demaquer V1 is marked;
(3) And performing demangaging operation on all the linkable or derivable symbols in the linkLib by using the dem compiler V1, acquiring the symbol names of the source code levels of the symbols before the symbols are modified by names, namely function names or variable names, and adding the symbol names of the source code levels into a source code level symbol list.
S3.2.4, matching the unresolvedSymbol in the source code level symbol list acquired in the last step, if the two are matched to the same name, which means that although the names of the two symbols are different after being modified by the name, the symbols before being modified by the name are the same, marking the symbols in the linkLib as symobolInLinkLib, symobolInLinkLib as the symbols after being modified by the name, constructing or expanding an encapsulation library libWrapper, generating a source code of a proxy function or a proxy variable for the unresolvedSymbol in the libWrapper, wherein the source code of the proxy function or the proxy variable is consistent with the name before the unresolvedSymbol is modified by the name, so as to ensure that the name after the proxy function or the proxy variable is compiled by the same compiler is also the unresolvedSymbol, and the specific steps are as follows:
(1) If unresolvedsymnol is a function, the function name before unresolvedsymnol is modified by the name is named as demFunction, and a source code of a proxy function is generated for the function name, wherein the function name is demFunction, and the specific implementation of the demFunction is as follows:
if the linkLib is a dynamic library, the following code is generated for demFunction: calling a dynamic library loading function, such as a dlopen function of a Linux system, and loading linkLib; calling a symbol dynamic analysis function, such as a dlsym function of a Linux system, and obtaining an address of symbolinlinlinklib to be funAddress; calling symbolinlinlinklib according to the function address furadd;
if the linkLib is a static library, acquiring a relative address, namely an offset address, of the symbolinlinlinkliboffset in the linkLib, and marking the relative address as symbolinllinkliboffset; the following codes are generated for demFunctions: obtaining a base address of a linkLib, marking the base address as a linkLibBaseAddress, and using a jump instruction, such as a jmp instruction of an x86 system, to jump to an address where the addresses linkLibBaseAddress and symobolInLinkLibOffset are summed;
adding demFunction code to the source code of libWrapper;
the demFunction is identified as exported.
(2) If unresolvedSymbol is a variable, the variable name before unresolvedSymbol is modified by the name is named as demVar, and a source code of a proxy variable is generated for the variable name, and then:
if the first execution is performed, adding a non-readable and writable data segment dataSection in the libWrapper by adding a compiling modifier, defining the demVar as a data structure, wherein the data structure comprises two address class members including a base address of the linkLib and an offset address of the symbolInLinkLib in the linkLib, and adding the demVar into the dataSection by adding the compiling modifier;
if not the first execution, demVar is identified as exported.
S4, adding an initialization function into the libWrapper, which is marked as libWrapperInitFuntion, adding the libWrapperInitFuntion into an initialization function list of the program mA, and realizing by adding a compiling option, so that the libWrapperInitFuntion can be called when the program mA is executed.
The specific implementation of libWrapperInitFuntion is as follows:
adding a data access exception handling function for the current process, wherein the function is realized by the following steps: if the data address related to the captured data access abnormality is in the dataSection, a corresponding data structure is obtained from the address, namely, the offset address comprising a linkLib base address and a variable, and the operand address of the instruction triggering the current abnormality is replaced by adopting the result after summation of the two to realize that the data operation of the instruction with the current abnormality points to the demVar in the linkLib; and pointing the instruction address of the current process to the instruction with the abnormality, and continuing to execute the current process after recovering the abnormality.
S5, compiling the libWrapper by using the current compiler to generate a link library, wherein the link library can be a static library or a dynamic library.
S6, adding the link library of the libWrapper into a link library list of the program mA, and recompiling the link program mA.
In summary, the above embodiments are only preferred embodiments of the present invention, and are not intended to limit the scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (7)

1. A multi-compiler hybrid link method based on dynamic redirection of symbols, comprising the steps of:
step 1, extracting symbol reduction functions of different compilers and different versions of the same compiler, packaging the symbol reduction functions into API interfaces, marking the API interfaces as symbol reduction APIs, and establishing a mapping relation between the compiler and the symbol reduction APIs as compiler reduction mapping;
step 2, if the first compiler compiles the target program to execute the link operation to generate symbol errors which cannot be resolved, adding the current error symbol into an error symbol list, and sequentially adding a link library related to the current link operation into a link library list according to the link sequence; otherwise, if the target program has completed compiling the link completely, ending the flow, and if the target program has not completed compiling the link completely, executing step 2;
step 3, searching a symbol reduction API corresponding to the first compiler in the compiler reduction mapping to be marked as a first symbol reduction API, and executing symbol reduction operation on the current error symbol by adopting the first symbol reduction API to obtain a function name or a variable name of the current error symbol in the source code to be marked as a first source name;
step 4, the names of compilers generating the link libraries in the link library list are marked as second compilers, and symbol reduction APIs corresponding to the second compilers are searched in a compiler reduction map and marked as second symbol reduction APIs; performing symbol reduction operation on all symbols of the linked library by adopting a second symbol reduction API to obtain function names or variable names in source codes, and adding the function names or variable names into a library source name table;
step 5, if the names which are the same as the first source names exist in the library source name table, marking the symbols which are matched with the first source names in the corresponding link libraries as first library symbols, and marking the link libraries which are corresponding to the first source names as first link libraries; establishing a first encapsulation library to encapsulate a source code of a first proxy, wherein the first proxy is a proxy function or a proxy variable of a current error symbol with the same name as the first source name, and the identifier of the first proxy is set to be exported; if not, ending the flow;
step 6, adding an initialization function into a first encapsulation library to be recorded as an encapsulation initialization function, and then adding the encapsulation initialization function into an initialization function list of a target program, so that the encapsulation initialization function can be called when the target program is executed; the package initialization function is used for processing data access abnormality when the current error symbol is a variable, and acquiring a memory address of a first agent as a new instruction address to execute subsequent operations when the abnormality occurs;
and 7, compiling the first packaging library by using a first compiler to obtain a first packaging link library, adding the first packaging link library into a link library list, and executing the step 2.
2. The multi-compiler hybrid linking method of claim 1, wherein the linked library is a static library or a dynamic library.
3. The multi-compiler hybrid link method according to claim 1, wherein the first encapsulation link library in step 7 is a static library or a dynamic library.
4. The multi-compiler hybrid chaining method of claim 2, further comprising the first agent implemented when a current error symbol is a function as follows:
the first proxy is a function with the same name as the first source, if the first linked library is a dynamic library, the dynamic library loading function is called to load the first linked library, then the symbol dynamic analysis function is called to acquire the address of the first library symbol and record the address as a function address, and the first library symbol is called according to the function address; if the first link library is a static library, acquiring a relative address of a first library symbol in the first link library as an offset address, acquiring an address of the first link library as a base address, taking the sum of the offset address and the base address as a function address, and jumping to the function address;
the source code of the first agent is added to the source code of the first encapsulation library.
5. The multi-compiler hybrid chaining method of claim 2, further comprising the first agent implemented when a current error symbol is a variable:
the first agent is the variable with the same name as the first source, if the first agent is executed for the first time, an unreadable data segment is added into a first encapsulation library and marked as an identification data segment, the first agent is defined as a data structure, the data structure comprises the address of a first link library, namely a base address, and the relative address of a first library symbol in the first link library, namely an offset address, the first agent is written into the identification data segment, and the source code of the first agent is added into the source code of the first encapsulation library; otherwise, the source code of the first agent is added to the source code of the first encapsulation library.
6. The multi-compiler hybrid chaining method according to claim 1, wherein the package initialization function in step 6 is implemented in the following manner:
when the data address in the captured data access abnormality is in the identification data segment, a data structure in the identification data segment is obtained, the base address and the offset address in the data structure are summed to obtain an address A, the address A is used for replacing the operand address of the instruction A triggering the current abnormality, and then the instruction address of the current process is pointed to the instruction A and then the current process is continuously executed.
7. The multi-compiler hybrid linking method according to claim 1, wherein the compiler in the compiler reduction map contains a name and version number of the compiler.
CN202310926311.XA 2023-07-26 2023-07-26 Multi-compiler hybrid link method based on symbol dynamic redirection Active CN116661779B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310926311.XA CN116661779B (en) 2023-07-26 2023-07-26 Multi-compiler hybrid link method based on symbol dynamic redirection

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310926311.XA CN116661779B (en) 2023-07-26 2023-07-26 Multi-compiler hybrid link method based on symbol dynamic redirection

Publications (2)

Publication Number Publication Date
CN116661779A CN116661779A (en) 2023-08-29
CN116661779B true CN116661779B (en) 2023-09-19

Family

ID=87724484

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310926311.XA Active CN116661779B (en) 2023-07-26 2023-07-26 Multi-compiler hybrid link method based on symbol dynamic redirection

Country Status (1)

Country Link
CN (1) CN116661779B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103729579A (en) * 2014-01-02 2014-04-16 北京深思数盾科技有限公司 Function-level software protection method
CN105426226A (en) * 2015-11-24 2016-03-23 无锡江南计算技术研究所 Compiling and generation method for heterogeneous code fusion
CN107239315A (en) * 2017-04-11 2017-10-10 北京深鉴智能科技有限公司 Towards the programming model of neutral net heterogeneous computing platforms
CN108052327A (en) * 2017-12-11 2018-05-18 北京奇虎科技有限公司 A kind of kernel module compiling, loading method and device
CN114815990A (en) * 2022-04-19 2022-07-29 南京艾莫尔人工智能研究院有限公司 Configuration method and device of low-code development platform
CN116400895A (en) * 2023-03-09 2023-07-07 广州南方卫星导航仪器有限公司 Dynamic link library reflection method and system based on C language preprocessor

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
GB2552474A (en) * 2016-07-21 2018-01-31 Sony Interactive Entertainment Inc Program compiler, linker and method

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103729579A (en) * 2014-01-02 2014-04-16 北京深思数盾科技有限公司 Function-level software protection method
CN105426226A (en) * 2015-11-24 2016-03-23 无锡江南计算技术研究所 Compiling and generation method for heterogeneous code fusion
CN107239315A (en) * 2017-04-11 2017-10-10 北京深鉴智能科技有限公司 Towards the programming model of neutral net heterogeneous computing platforms
CN108052327A (en) * 2017-12-11 2018-05-18 北京奇虎科技有限公司 A kind of kernel module compiling, loading method and device
CN114815990A (en) * 2022-04-19 2022-07-29 南京艾莫尔人工智能研究院有限公司 Configuration method and device of low-code development platform
CN116400895A (en) * 2023-03-09 2023-07-07 广州南方卫星导航仪器有限公司 Dynamic link library reflection method and system based on C language preprocessor

Also Published As

Publication number Publication date
CN116661779A (en) 2023-08-29

Similar Documents

Publication Publication Date Title
CN107291480B (en) Function calling method and device
US10698668B1 (en) Custom code transformations during compilation process
US8966635B2 (en) Software module object analysis
US10459707B2 (en) Instruction-set simulator and its simulator generation method
CN100462920C (en) Unwind information for optimized programs
CN113094667B (en) System for preventing java program from being decompiled
CN107632832B (en) Dalvik byte code oriented control flow confusion method
CN112965720B (en) Component compiling method, device, equipment and computer readable storage medium
CN110673837B (en) Code repairing method and device, electronic equipment and computer readable storage medium
Zhang et al. Characterizing and detecting webassembly runtime bugs
US7512938B2 (en) Typed intermediate representation for object-oriented languages
CN116661779B (en) Multi-compiler hybrid link method based on symbol dynamic redirection
KR102209151B1 (en) Method and device for patching security vulnerable executable binaries
Kotselidis et al. Cross-ISA debugging in meta-circular VMs
Ferrara et al. CIL to Java-bytecode translation for static analysis leveraging
CN114253554A (en) Code processing method and device and storage medium
CN113094664B (en) System for preventing android application program from being decompiled
CN113094665B (en) System for preventing java program from being decompiled
CN112114809B (en) Program code safety protection method, device and storage medium
Sousa et al. Preventing atomicity violations with contracts
CN114706586A (en) Code compiling method, code running method, code compiling device, code running device, computer equipment and storage medium
CN113094666B (en) System for preventing java program from being decompiled
CN114707124B (en) NET platform code protection method and system based on code virtualization
CN115470151B (en) Application operation analysis method, computing device and storage medium
CN116243971B (en) Static dependency bootstrapping-based kernel-independent module construction method

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant