Method and device for compiling functions

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 compilation

Active Publication Date: 2018-05-04
BEIJING QIHOO TECH CO LTD
View PDF4 Cites 16 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
  • Method and device for compiling functions
  • Method and device for compiling functions
  • Method and device for compiling functions

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

An embodiment of the invention provides a method and a device for compiling functions. The method for compiling the functions includes acquiring source codes of the target functions and compiling instructions for compiling the source codes of the target functions; executing the compiling instructions, determining dependency contents used by the target functions from the source codes of the targetfunctions and acquiring declaration statements corresponding to the dependency contents; preprocessing the source codes of the target functions according to preset strategies on the basis of the declaration statements corresponding to the dependency contents; compiling the preprocessed source codes of the target functions and acquiring binary files for implementing work functions of the target functions. The dependency contents at least include one or a plurality of types of called functions, variables and macro. The method and the device have the advantages that the source codes of the targetfunctions are preprocessed, accordingly, the compiling speeds can be increased, and the binary files for minimally implementing the work functions of the target functions 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 Applications(China)
IPC IPC(8): G06F8/41G06F21/57
CPCG06F8/41G06F8/447G06F21/577
Inventor 刘天张建新
Owner BEIJING QIHOO TECH CO LTD
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Try Eureka
PatSnap group products