Unlock instant, AI-driven research and patent intelligence for your innovation.

A function compiling method and device

A compilation method and function technology, applied in the computer field, can solve problems such as the absence of function source codes, achieve the effect of reducing the amount of code and speeding up the compilation speed

Active Publication Date: 2021-04-13
BEIJING QIHOO TECH CO LTD
View PDF4 Cites 0 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0004] It can be seen that there is no method for compiling function source code separately in the prior art

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • A function compiling method and device
  • A function compiling method and device
  • A function compiling method and device

Examples

Experimental program
Comparison scheme
Effect test

Embodiment 1

[0022] The embodiment of the present invention provides a function compilation method, which can be applied to a certain target function in the kernel source code using dependent content, such as global variables, macros, inline functions, signed functions, etc., each An occasion where the target function needs to be compiled separately, such as compiling the problem function corresponding to the kernel vulnerability, making a patch for a certain function in the kernel source code, and wanting to replace a certain function in the kernel with an updated function , Want to obtain the binary code file corresponding to the minimum implementation of the objective function, etc.

[0023] In practical applications, a kernel source code contains many functions. For a certain function, it can use some dependent content, such as using global variables, calling other functions, or using macros and inline functions contained in header files. If the kernel code is compiled as a whole, the ...

Embodiment 2

[0071] Based on the same inventive concept, this embodiment provides a vulnerability detection method, which is applied to the following scenario: when a kernel vulnerability occurs, it is necessary to quickly confirm whether the kernel vulnerability exists.

[0072]Generally, during the kernel vulnerability detection process of the kernel, if a kernel vulnerability occurs, corresponding alarm data will be generated, so that the problem function triggering the kernel vulnerability can be determined. Next, in order to confirm whether the kernel vulnerability really exists, the parameters of the system call plus the system call are needed to try to trigger the vulnerability and finally detect whether the kernel has the vulnerability. Specifically, first, you need to find the caller of the problem function, and then find the caller of the caller, so that you search in turn until you return to the user mode system call interface; secondly, you need to construct the defect code that...

Embodiment 3

[0090] Based on the same inventive concept, as an implementation of the above-mentioned function compiling method, the embodiment of the present invention provides a function compiling device. The device embodiment corresponds to the aforementioned method embodiment. Details in the embodiments are described one by one, but it should be clear that the device in this embodiment can correspondingly implement all the content in the foregoing method embodiments.

[0091] image 3 It is a schematic structural diagram of the function compiling device in Embodiment 3 of the present invention, see image 3 As shown, the function compiling device 30 includes: an obtaining unit 301, an execution unit 302, a preprocessing unit 303, and a compiling unit 304, wherein the obtaining unit 301 is used to obtain the source code of the target function and to compile the source code of the target function the compilation instruction; the execution unit 302 is used to execute the compilation instr...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

PUM

No PUM Login to View More

Abstract

Embodiments of the present invention provide a method and device for compiling a function. The method for compiling a function includes: obtaining the source code of the target function and a compiling instruction for compiling the source code of the target function; executing the compiling instruction, from the In the source code of the target function, determine the dependent content used by the target function, and obtain the declaration statement corresponding to the dependent content, wherein the dependent content is at least one or more of the called function, variable or macro kind; based on the declaration statement corresponding to the dependent content, according to a preset strategy, preprocess the source code of the target function; compile the preprocessed source code of the target function, and obtain the function of the target function binary file. In this way, by preprocessing the source code of the target function, the compilation speed can be improved, and the minimum binary file for realizing the function of the target function can be obtained.

Description

technical field [0001] The invention relates to the field of computers, in particular to a function compiling method and device. Background technique [0002] A Linux kernel source code is composed of hundreds, even thousands, or millions of functions, and the source codes corresponding to these functions may be distributed in different files. For a certain target function in a certain source file, it may need to call some global variables, other functions, macro definitions contained in the header file, inline functions and other dependent content to realize the corresponding function. [0003] In the prior art, when the target function calls dependent content, if you just want to compile the target function separately, in order for the compiler to find these dependent content, it can only be achieved by compiling the kernel source code as a whole. Compilation is very slow. [0004] It can be seen that there is no method for separately compiling function source codes in t...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

Application Information

Patent Timeline
no application Login to View More
Patent Type & Authority Patents(China)
IPC IPC(8): G06F8/41G06F21/57
CPCG06F8/41G06F8/447G06F21/577
Inventor 刘天张建新
Owner BEIJING QIHOO TECH CO LTD