CN111767056A - Source code compiling method, executable file running method and terminal equipment - Google Patents

Source code compiling method, executable file running method and terminal equipment Download PDF

Info

Publication number
CN111767056A
CN111767056A CN202010603636.0A CN202010603636A CN111767056A CN 111767056 A CN111767056 A CN 111767056A CN 202010603636 A CN202010603636 A CN 202010603636A CN 111767056 A CN111767056 A CN 111767056A
Authority
CN
China
Prior art keywords
executable file
source code
compiled
storage address
storage space
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.)
Pending
Application number
CN202010603636.0A
Other languages
Chinese (zh)
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.)
Guangdong Oppo Mobile Telecommunications Corp Ltd
Original Assignee
Guangdong Oppo Mobile Telecommunications Corp 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 Guangdong Oppo Mobile Telecommunications Corp Ltd filed Critical Guangdong Oppo Mobile Telecommunications Corp Ltd
Priority to CN202010603636.0A priority Critical patent/CN111767056A/en
Publication of CN111767056A publication Critical patent/CN111767056A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

The application provides a source code compiling method, an executable file running method and terminal equipment. The source code compiling method comprises the following steps: determining target parameters contained in a source code to be compiled, wherein the target parameters are parameters only used in a preset stage of running of an executable file, and the executable file is a compiled file corresponding to the source code to be compiled; when the source code to be compiled is compiled, determining a storage address for storing the target parameter when the compiled executable file runs, wherein a storage space corresponding to the storage address is a continuous storage space; and generating the executable file based on the storage address. The method and the device can solve the technical problem that the utilization rate of the storage space of the terminal equipment is low in the current executable file operation process to a certain extent.

Description

Source code compiling method, executable file running method and terminal equipment
Technical Field
The application belongs to the technical field of computers, and particularly relates to a source code compiling method, an executable file running method and terminal equipment.
Background
At present, an executable file stored in a terminal device often has target parameters, the target parameters are only used in a preset stage (for example, an initialization stage) of the operation of the executable file, in the operation process of the executable file, after the preset stage is ended, the target parameters are not used any more, but still occupy a storage space, when the target parameters are multiple, each target parameter is often scattered and stored, even if the terminal device executes a storage space releasing operation, each small block storage space which is scattered and distributed can only be obtained, and subsequent other storage requirements are difficult to meet.
Therefore, the technical problem of low utilization rate of the storage space of the terminal equipment exists in the running process of the current executable file.
Disclosure of Invention
In view of this, the present application provides a source code compiling method, an executable file running method, and a terminal device. The technical problem that the utilization rate of the storage space of the terminal equipment is low in the current executable file operation process can be solved to a certain extent.
In a first aspect, an embodiment of the present application provides a source code compiling method, including:
determining target parameters contained in a source code to be compiled, wherein the target parameters are parameters only used in a preset stage of running of an executable file, and the executable file is a compiled file corresponding to the source code to be compiled;
when the source code to be compiled is compiled, determining a storage address for storing the target parameter when the compiled executable file runs, wherein a storage space corresponding to the storage address is a continuous storage space;
and generating the executable file based on the storage address.
The first aspect provides a source code compiling method, where when a source code to be compiled including an object parameter is compiled, a storage address of a continuous storage space stored by the object parameter needs to be determined when a compiled executable file runs, and then the compiled executable file is generated based on the storage address, where the object parameter is a parameter that is used only at a preset stage (for example, an initialization stage) of the executable file running. Based on the technical scheme provided by the first aspect, the terminal device subsequently running the executable file can store the target parameter into the continuous storage space indicated by the storage address, and the target parameters are prevented from being scattered and stored when a plurality of target parameters are provided, so that the terminal device can conveniently obtain the continuous available storage space with larger storage capacity compared with the prior art when the terminal device executes storage space release operation, and can meet other storage requirements. Therefore, the technical scheme provided by the first aspect can improve the technical problem of low utilization rate of the storage space in the operation process of the executable file to a certain extent.
In a second aspect, an embodiment of the present application provides an executable file running method, including:
acquiring an executable file containing target parameters, wherein the target parameters are parameters used only in a preset stage of running of the executable file, the executable file is used for indicating a storage address used for storing the target parameters when the executable file runs, and a storage space corresponding to the storage address is a continuous storage space;
running the executable file, and storing the target parameter to the continuous storage space based on the storage address in the running process;
and after the preset stage in the running process of the executable file is finished, based on the storage address, releasing the continuous storage space corresponding to the storage address.
The second aspect provides an executable file operating method, first, acquiring an executable file including a target parameter, where the target parameter is a parameter used only in a preset stage (for example, an initialization stage) of the executable file operating, and the executable file is used to indicate a storage address stored in the target parameter, and the storage address corresponds to a continuous storage space; secondly, the executable file is operated, and in the operation process, the target parameters are stored into the continuous storage space based on the storage address; and finally, after the preset stage in the running process of the executable file is finished, releasing the continuous storage space. Therefore, in the operation method provided by the application, for the target parameter used only in the preset stage, the target parameter can be stored in the continuous storage space, and after the preset stage is finished, the continuous storage space is released, so that compared with the prior art, a continuously available storage space with a larger storage capacity can be obtained, so as to meet other subsequent storage requirements, and the technical problem of low utilization rate of the storage space of the terminal equipment in the current executable file operation process can be solved to a certain extent.
In addition, the source code compiling method provided by the first aspect and the executable file running method provided by the second aspect are based on the same inventive concept and are technically related to each other, and both the two methods solve the technical problem of low utilization rate of the storage space of the terminal device in the current executable file running process by the technical means of storing the target parameter into the continuous storage space.
In a third aspect, an embodiment of the present application provides a terminal device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, where the processor implements the steps of the first aspect or the second aspect when executing the computer program.
In a fourth aspect, the present application provides a computer-readable storage medium, which stores a computer program, and the computer program, when executed by a processor, implements the steps of the first aspect or the second aspect.
In a fifth aspect, an embodiment of the present application provides a source code compiling apparatus, including:
the target parameter determining module is used for determining target parameters contained in the source code to be compiled, wherein the target parameters are parameters only used in a preset stage of running of an executable file, and the executable file is a compiled file corresponding to the source code to be compiled;
the storage address determining module is used for determining a storage address for storing the target parameter when the compiled executable file runs when the source code to be compiled is compiled, wherein a storage space corresponding to the storage address is a continuous storage space;
and the executable file generation module is used for generating the executable file based on the storage address.
In a sixth aspect, an embodiment of the present application provides an executable file execution apparatus, including:
the executable file acquisition module is used for acquiring an executable file containing target parameters, wherein the target parameters are parameters only used in a preset stage of running of the executable file, the executable file is used for indicating a storage address used for storing the target parameters when the executable file runs, and a storage space corresponding to the storage address is a continuous storage space;
the storage module is used for operating the executable file and storing the target parameter to the continuous storage space based on the storage address in the operation process;
and the releasing module is used for releasing the continuous storage space corresponding to the storage address based on the storage address after the preset stage in the running process of the executable file is finished.
In a seventh aspect, the present application provides a computer program product, where the computer program product includes a computer program, and the computer program is executed by one or more processors to implement the steps of the first aspect or the second aspect.
It is to be understood that, for the beneficial effects of the third to seventh aspects, reference may be made to the description of the first and second aspects, and details are not described herein again.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present application.
Fig. 1 is a schematic flow chart illustrating an implementation of a source code compiling method according to an embodiment of the present application;
fig. 2 is a schematic flow chart illustrating an implementation of an executable file running method according to a second embodiment of the present application;
fig. 3 is a schematic diagram of an executable file obtaining method according to a second embodiment of the present application;
fig. 4 is a schematic structural diagram of a source code compiling apparatus according to a third embodiment of the present application;
fig. 5 is a schematic structural diagram of an executable file execution apparatus according to a fourth embodiment of the present application;
fig. 6 is a schematic structural diagram of a terminal device according to a fifth embodiment of the present application.
Detailed Description
In the following description, for purposes of explanation and not limitation, specific details are set forth, such as particular system structures, techniques, etc. in order to provide a thorough understanding of the embodiments of the present application. It will be apparent, however, to one skilled in the art that the present application may be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present application with unnecessary detail.
The source code compiling method provided by the embodiment of the present application may be applied to a terminal device, and for example, the terminal device includes but is not limited to: smart phones, tablet computers, notebooks, desktop computers, servers, and the like.
The executable file running method provided by the embodiment of the present application may also be applied to a terminal device, and for example, the terminal device includes but is not limited to: smart phones, tablet computers, notebooks, desktop computers, servers, and the like.
Those skilled in the art will readily understand that the terminal device to which the source code compiling method is applied and the terminal device to which the executable file running method is applied may be the same device or different devices, and the present application is not limited thereto.
It will be understood that the terms "comprises" and/or "comprising," when used in this specification and the appended claims, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
It is also to be understood that the terminology used in the description of the present application herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. As used in the specification of the present application and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.
It should be further understood that the term "and/or" as used in this specification and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.
As used in this specification and the appended claims, the term "if" may be interpreted contextually as "when", "upon" or "in response to a determination" or "in response to a detection". Similarly, the phrase "if it is determined" or "if a [ described condition or event ] is detected" may be interpreted contextually to mean "upon determining" or "in response to determining" or "upon detecting [ described condition or event ]" or "in response to detecting [ described condition or event ]".
In addition, in the description of the present application, the terms "first", "second", and the like are used only for distinguishing the description, and are not intended to indicate or imply relative importance.
In order to explain the technical solution of the present application, the following description will be given by way of specific examples.
Example one
Referring to fig. 1, a source code compiling method according to an embodiment of the present application is described below, where the source code compiling method includes:
in step S101, an object parameter included in a source code to be compiled is determined, where the object parameter is a parameter used only in a preset stage of running an executable file, and the executable file is a compiled file corresponding to the compiled source code.
In the embodiment of the present application, the number of the "target parameters" determined in step S101 may be multiple or one, and the present application does not limit the number of the determined target parameters.
The inventive concept of the embodiment of the application is as follows: parameters used only in a preset stage of running of the executable file are stored continuously, so that after the preset stage is finished, the terminal equipment executing the executable file can obtain relatively large continuous available storage space after the storage space for storing the parameters is released, and further the use efficiency of the storage space is improved. Based on the above inventive concept, embodiments of the present application provide a source code compiling method, so that a compiled executable file can represent a storage address of the target parameter, and the storage address corresponds to a continuous storage space, so that a terminal device executing the executable file can store the target parameter into the continuous storage space based on the storage address represented by the executable file. Therefore, the parameter of interest in the embodiment of the present application is "a parameter used only in the preset phase of the executable file operation", so in step S101, the parameter used only in the preset phase of the executable file operation needs to be determined (for convenience of the following description, the parameter is referred to as a target parameter).
In an embodiment of the present application, the method for determining the target parameter may be: firstly, the target parameter is identified in the source code to be compiled, so that the terminal equipment can determine the target parameter by searching the identified parameter. That is, this step S101 may include:
and acquiring a source code to be compiled, determining the identified parameter in the source code to be compiled based on the source code to be compiled, and determining the identified parameter as the target parameter.
To facilitate those skilled in the art to understand the technical solution of the embodiment of the present application, a section of source code for identifying a target parameter is given as an example as follows:
uint32_t one_data[1024]__SECTION(“.tmp_data”);
the source code segment means: the 32-bit unsigned integer type data parameter one _ data [1024] __ SECTION is identified under the name of.tmp _ data. The terminal device can thereby be enabled to determine the target parameter by the identification ". tmp _ data".
However, it should be easily understood by those skilled in the art that the method for determining the target parameter in the source code to be compiled is not limited to the above-mentioned manner of identifying the target parameter, and may also be: and reminding a compiling operator to directly input the target parameters, and determining the target parameters through the input of the compiling operator. The present application does not limit the specific embodiment of step S101.
In step S102, when the source code to be compiled is compiled, a storage address used for storing the target parameter when the compiled executable file runs is determined, where a storage space corresponding to the storage address is a continuous storage space.
Since the compiled executable file needs to be able to represent the storage address of the target parameter (and the storage address corresponds to the continuous storage space), the storage address corresponding to the continuous storage space needs to be obtained at the source code compiling stage, so that the compiled executable file can be generated based on the storage address (the storage address can be directly written into the compiled executable file). Therefore, in step S102, it is necessary to determine a memory address for storing the target parameter, where the memory address corresponds to a continuous memory space.
In step S103, the executable file is generated based on the storage address.
The executable file is used for indicating that the target parameter is stored to the storage address in the running process of the executable file.
After the storage address for storing the target argument is obtained in step S102, the compiled executable file is generated based on the storage address, and those skilled in the art can easily understand that the storage address can be directly written into the compiled executable file.
In this embodiment of the application, a link script used in the compiling and linking stage may be written so that the link script is used to indicate the storage address of the target parameter determined in step S101, and then the executable file described in step S103 may be generated based on the link script.
For example, if the target argument is identified as.tmp _ data, the link script may set the storage address of the target argument to 0x0000-0x00FF by the following code:
.tmp_data:{*(.tmp_data*)}
the segment code identifies: and storing a parameter marked as ". tmp _ data" into the. tmp _ data section, wherein the storage address corresponding to the. tmp _ data section needs to be predefined as 0x0000-0x00 FF.
Therefore, in this embodiment of the present application, the storage address of the target argument may be determined based on the link script, and the executable file may be generated based on the link script, that is, the step S102 may include: and when the source code to be compiled is compiled, acquiring a link script, wherein the link script is used for indicating the storage address of the target parameter, so that the storage address of the target parameter is determined through the link script. The step S103 may include: and in a link stage of compiling the source code to be compiled, generating the executable file based on the storage address indicated by the link script.
In the embodiment of the present application, the step S102 and the step S103 do not necessarily have to be executed by a linked script, for example, the step S102 and the step S103 may be realized by rewriting a code (a non-linked script) used for compiling in a compiling stage, the present application is not limited to the specific implementation of the step S102 and the step S103, and the executable file generation method using another non-linked script is also within the scope of the present application.
In addition, in this embodiment of the present application, the source code to be compiled may be an os kernel source code, an executable file obtained after the os kernel source code is compiled is an os kernel image file, and all parameters used when the os kernel image file is executed are stored in a memory of a terminal device that executes the kernel image file.
When the source code to be compiled is an os kernel source code, and the preset stage is an initialization stage of the os kernel source code, the source code compiling method according to an embodiment of the present invention may include:
firstly, parameters only used in an initialization stage in kernel source codes of an operating system are identified, and terminal equipment A used for compiling determines the identified parameters as target parameters;
secondly, the terminal device a compiles the kernel source code of the operating system, and uses a link script to associate the target parameter with a continuous memory space (namely, the storage address is equal to the storage address of the determined target parameter, and the storage address corresponds to the continuous memory space) in the compiling process, wherein the continuous memory space is the storage space of the compiled kernel image file of the operating system in the terminal device B when the kernel image file of the operating system runs in the terminal device B;
and finally, generating an operating system kernel image file after associating to the continuous memory space.
The embodiment of the application provides a source code compiling method, based on the source code compiling method, a terminal device which subsequently runs an executable file can store target parameters into a continuous storage space indicated by a storage address, and the scattering storage of each target parameter is avoided when the target parameters are multiple, so that the storage space releasing operation is conveniently and subsequently executed at the terminal device.
In addition, the source code compiling method provided by the application can enable the terminal equipment running the compiled executable file to directly obtain a continuous storage space, and does not need the terminal equipment to perform defragmentation on scattered storage spaces of all storage target parameters in order to obtain a continuous storage space.
Example two
Referring to fig. 2, a method for running an executable file according to a second embodiment of the present application is described below, where the method includes:
in step S201, an executable file including a target parameter is obtained, where the target parameter is a parameter used only in a preset stage of running of the executable file, and the executable file is used to indicate a storage address used for storing the target parameter when the executable file runs, where a storage space corresponding to the storage address is a continuous storage space;
in the second embodiment of the present application, the executable file obtained in step S201 may be obtained through step S103 in the first embodiment, as shown in fig. 3, the terminal device 300 is a terminal device that runs the executable file running method in the second embodiment of the present application, wherein the executable file 301 stored in the terminal device 300 is obtained by compiling the source code 302 to be compiled by using the source code compiling method in the first embodiment.
In the second embodiment of the present application, the executable file may be an operating system kernel image file.
In step S202, the executable file is run, and in the running process, the target parameter is stored in the continuous storage space based on the storage address;
when the terminal device runs the executable file, the target parameter is stored into the continuous storage space based on the storage address indicated by the executable file.
In step S203, after the preset stage in the executable file running process is finished, based on the storage address, performing a release operation on the continuous storage space corresponding to the storage address;
in the second embodiment of the present application, after the preset stage of running the executable file is finished, the release operation is performed on the continuous storage space, and specifically, the release operation may be performed on the continuous storage space by calling a preset operation interface function.
If the executable file is an operating system kernel image file, when the terminal device runs the operating system kernel image file, the boot loader program can be called to load the operating system kernel image file to the memory, and then the boot loader program guides the operating system kernel image file to start. The Boot Loader is a small program which runs before the kernel of the operating system runs. Through the small program, hardware equipment can be initialized, and a mapping chart of a memory space is established, so that the software and hardware environment of the system is brought to a proper state, and a correct environment is prepared for finally calling an operating system kernel.
If the executable file is an operating system kernel image file and the preset stage is an initialization stage, the operating system kernel image file enters the initialization stage after being booted and started by a boot loader, and each subsystem starts to be initialized. The storage space occupied by the kernel image file of the operating system when the kernel image file is started is a memory space, so that the utilization rate of the memory can be improved based on the technical scheme provided by the second embodiment of the application.
In the operation method provided by the second embodiment of the present application, for the target parameter that is used only in the preset stage, the target parameter can be stored in a continuous storage space, and after the preset stage is completed, the continuous storage space is released, so that compared with the prior art, a continuously available storage space with a larger storage capacity can be obtained, so as to meet other subsequent storage requirements, and the technical problem that the utilization rate of the storage space of the terminal device is low in the current executable file operation process can be solved to a certain extent.
EXAMPLE III
As shown in fig. 4, a schematic structural diagram of a source code encoding apparatus according to a third embodiment of the present application is shown, and for convenience of illustration, only a part related to the third embodiment of the present application is shown, where the source code encoding apparatus 400 includes:
a target parameter determining module 401, configured to determine a target parameter included in a source code to be compiled, where the target parameter is a parameter that is only used in a preset stage of running an executable file, and the executable file is a compiled file corresponding to the source code to be compiled;
a storage address determining module 402, configured to determine, when the source code to be compiled is compiled, a storage address used for storing the target parameter when the compiled executable file runs, where a storage space corresponding to the storage address is a continuous storage space;
an executable file generating module 403, configured to generate the executable file based on the storage address.
Optionally, the storage address determining module 402 is specifically configured to:
when the source code to be compiled is compiled, a link script is obtained, wherein the link script is used for indicating the storage address of the target parameter;
accordingly, the executable file generating module 403 is specifically configured to:
and in a link stage of compiling the source code to be compiled, generating the executable file based on the storage address indicated by the link script.
Optionally, the target parameter determining module 401 is specifically configured to:
and acquiring the source code to be compiled, determining the identified parameter in the source code to be compiled based on the source code to be compiled, and determining the identified parameter as the target parameter.
Optionally, the source code to be compiled is an operating system kernel source code to be compiled.
It should be noted that, for the information interaction, the execution process, and other contents between the above-mentioned apparatuses, since the same concept is used as the first embodiment of the method of the present application, specific functions and technical effects thereof can be found in the corresponding method embodiment section, and details are not described here.
Example four
As shown in fig. 5, for a schematic structural diagram of an executable file execution device according to a fourth embodiment of the present application, only parts related to the fourth embodiment of the present application are shown for convenience of description, and the executable file execution device 500 includes:
an executable file obtaining module 501, configured to obtain an executable file including a target parameter, where the target parameter is a parameter used only in a preset stage of running the executable file, and the executable file is configured to indicate a storage address used for storing the target parameter when the executable file runs, where a storage space corresponding to the storage address is a continuous storage space;
a storage module 502, configured to run the executable file, and store the target parameter in the continuous storage space based on the storage address in a running process;
a releasing module 503, configured to, after the preset stage in the executable file running process is ended, perform a releasing operation on the continuous storage space corresponding to the storage address based on the storage address.
Optionally, the releasing module 503 is specifically configured to:
and after the preset stage in the running process of the executable file is finished, releasing the continuous storage space indicated by the storage address based on the storage address by calling a preset operation interface function.
Optionally, the executable file is an operating system kernel image file.
Optionally, the storage module 502 runs the executable file by:
and loading the kernel image file of the operating system to the memory by guiding a boot loader program, and guiding the kernel image file of the operating system to start running after loading the kernel image file to the memory.
It should be noted that, for the information interaction, the execution process, and other contents between the above-mentioned apparatuses, since the second embodiment of the method of the present application is based on the same concept, specific functions and technical effects thereof can be found in the corresponding method embodiment section, and details are not described here.
EXAMPLE five
Fig. 6 is a schematic structural diagram of a terminal device according to a fifth embodiment of the present application. As shown in fig. 6, the terminal device 600 of this embodiment includes: a processor 601, a memory 602, and a computer program 603 stored in the memory 602 and operable on the processor 601. The processor 601, when executing the computer program 603, implements the steps of the first method embodiment or the second method embodiment. Alternatively, the processor 601 may implement the functions of the modules in the third embodiment or the fourth embodiment when executing the computer program 603.
Illustratively, the computer program 603 may be divided into one or more modules, which are stored in the memory 602 and executed by the processor 601 to complete the present application. The one or more modules may be a series of computer program instruction segments capable of performing specific functions, which are used to describe the execution process of the computer program 603 in the terminal device 600. For example, the computer program 603 may include a target parameter determining module, a storage address determining module, and an executable file generating module, and the specific functions of each module are as follows:
determining target parameters contained in a source code to be compiled, wherein the target parameters are parameters only used in a preset stage of running of an executable file, and the executable file is a compiled file corresponding to the source code to be compiled;
when the source code to be compiled is compiled, determining a storage address for storing the target parameter when the compiled executable file runs, wherein a storage space corresponding to the storage address is a continuous storage space;
and generating the executable file based on the storage address.
For another example, the computer program 603 may include an executable file acquiring module, a storage module, and a releasing module, where the specific functions of the modules are as follows:
acquiring an executable file containing target parameters, wherein the target parameters are parameters used only in a preset stage of running of the executable file, the executable file is used for indicating a storage address used for storing the target parameters when the executable file runs, and a storage space corresponding to the storage address is a continuous storage space;
running the executable file, and storing the target parameter to the continuous storage space based on the storage address in the running process;
and after the preset stage in the running process of the executable file is finished, based on the storage address, releasing the continuous storage space corresponding to the storage address.
The terminal device may include, but is not limited to, a processor 601 and a memory 602. Those skilled in the art will appreciate that fig. 6 is merely an example of a terminal device 600 and does not constitute a limitation of terminal device 600 and may include more or less components than those shown, or some components may be combined, or different components, for example, the terminal device may also include input-output devices, network access devices, buses, etc.
The Processor 601 may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic device, discrete hardware component, or the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The storage 602 may be an internal storage unit of the terminal device 600, such as a hard disk or a memory of the terminal device 600. The memory 602 may also be an external storage device of the terminal device 600, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like, which are provided on the terminal device 600. Further, the memory 602 may include both an internal storage unit and an external storage device of the terminal device 600. The memory 602 is used for storing the computer program and other programs and data required by the terminal device. The memory 602 may also be used to temporarily store data that has been output or is to be output.
It will be clear to those skilled in the art that, for convenience and simplicity of description, the foregoing division of the functional modules is merely illustrated, and in practical applications, the above function distribution may be performed by different functional modules according to needs, that is, the internal structure of the apparatus is divided into different functional modules to perform all or part of the above described functions. Each functional module in the embodiments may be integrated in one processing unit, or each unit may exist alone physically, or two or more units are integrated in one unit, and the integrated unit may be implemented in a form of hardware, or in a form of software functional unit. In addition, specific names of the functional modules are only used for distinguishing one functional module from another, and are not used for limiting the protection scope of the application. The specific working process of the modules in the apparatus may refer to the corresponding process in the foregoing method embodiment, and is not described herein again.
In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and reference may be made to the related descriptions of other embodiments for parts that are not described or illustrated in a certain embodiment.
Those of ordinary skill in the art will appreciate that the various illustrative modules and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
The integrated module may be stored in a computer-readable storage medium if it is implemented in the form of a software functional unit and sold or used as a separate product. Based on such understanding, all or part of the processes in the above method embodiments may be implemented by a computer program, which may be stored in a computer readable storage medium and executed by a processor, so as to implement the steps of the above method embodiments. The computer program includes computer program code, and the computer program code may be in a source code form, an object code form, an executable file or some intermediate form. The computer readable medium may include: any entity or device capable of carrying the above-mentioned computer program code, recording medium, usb disk, removable hard disk, magnetic disk, optical disk, computer Memory, Read-Only Memory (ROM), Random Access Memory (RAM), electrical carrier wave signal, telecommunication signal, software distribution medium, etc. It should be noted that the computer readable medium described above may include content that is subject to appropriate increase or decrease as required by legislation and patent practice in jurisdictions, for example, in some jurisdictions, computer readable media that does not include electrical carrier signals and telecommunications signals in accordance with legislation and patent practice.
The above embodiments are only used for illustrating the technical solutions of the present application, and not for limiting the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications and substitutions do not substantially depart from the spirit and scope of the embodiments of the present application and are intended to be included within the scope of the present application.

Claims (10)

1. A method for source code compilation, comprising:
determining target parameters contained in a source code to be compiled, wherein the target parameters are parameters only used in a preset stage of running of an executable file, and the executable file is a compiled file corresponding to the source code to be compiled;
when the source code to be compiled is compiled, determining a storage address for storing the target parameter when the compiled executable file runs, wherein a storage space corresponding to the storage address is a continuous storage space;
and generating the executable file based on the storage address.
2. The method for compiling source code according to claim 1, wherein the determining a storage address for storing the target argument when the compiled executable file runs when compiling the source code to be compiled comprises:
when the source code to be compiled is compiled, a link script is obtained, wherein the link script is used for indicating the storage address of the target parameter;
accordingly, the generating the executable file based on the storage address comprises:
and in a link stage of compiling the source code to be compiled, generating the executable file based on the storage address indicated by the link script.
3. The method for source code compilation according to claim 1, wherein the determining the target arguments contained in the source code to be compiled comprises:
and acquiring the source code to be compiled, determining the identified parameter in the source code to be compiled based on the source code to be compiled, and determining the identified parameter as the target parameter.
4. The method for source code compilation according to any one of claims 1 to 3, wherein the source code to be compiled is an operating system kernel source code to be compiled.
5. An executable file running method, comprising:
acquiring an executable file containing target parameters, wherein the target parameters are parameters used only in a preset stage of running of the executable file, the executable file is used for indicating a storage address used for storing the target parameters when the executable file runs, and a storage space corresponding to the storage address is a continuous storage space;
running the executable file, and storing the target parameter to the continuous storage space based on the storage address in the running process;
and after the preset stage in the running process of the executable file is finished, based on the storage address, releasing the continuous storage space corresponding to the storage address.
6. The executable file running method according to claim 5, wherein after the preset stage in the executable file running process is finished, based on the storage address, the releasing operation is performed on the continuous storage space corresponding to the storage address, and the releasing operation includes:
and after the preset stage in the running process of the executable file is finished, releasing the continuous storage space indicated by the storage address based on the storage address by calling a preset operation interface function.
7. An executable file execution method according to claim 5 or 6, wherein the executable file is an operating system kernel image file.
8. The executable file execution method of claim 7, wherein the executing the executable file comprises:
and loading the kernel image file of the operating system to the memory by guiding a boot loader program, and guiding the kernel image file of the operating system to start running after loading the kernel image file to the memory.
9. A terminal device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the source code compiling method according to any one of claims 1 to 4 or the executable file executing method according to any one of claims 5 to 8 when executing the computer program.
10. A computer-readable storage medium, in which a computer program is stored, which, when being executed by a processor, carries out the steps of a source code compilation method according to any one of claims 1 to 4 or an executable file execution method according to any one of claims 5 to 8.
CN202010603636.0A 2020-06-29 2020-06-29 Source code compiling method, executable file running method and terminal equipment Pending CN111767056A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010603636.0A CN111767056A (en) 2020-06-29 2020-06-29 Source code compiling method, executable file running method and terminal equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010603636.0A CN111767056A (en) 2020-06-29 2020-06-29 Source code compiling method, executable file running method and terminal equipment

Publications (1)

Publication Number Publication Date
CN111767056A true CN111767056A (en) 2020-10-13

Family

ID=72722860

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010603636.0A Pending CN111767056A (en) 2020-06-29 2020-06-29 Source code compiling method, executable file running method and terminal equipment

Country Status (1)

Country Link
CN (1) CN111767056A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112506547A (en) * 2020-12-16 2021-03-16 杭州和利时自动化有限公司 Configuration data downloading method, device, equipment and readable storage medium
CN112650501A (en) * 2020-12-31 2021-04-13 重庆芯讯通无线科技有限公司 Compiling, terminal equipment and compiling link and loading method of client application program thereof
CN112732321A (en) * 2021-01-21 2021-04-30 恒为科技(上海)股份有限公司 Firmware modification method and device, computer readable storage medium and equipment
CN112835543A (en) * 2021-01-11 2021-05-25 上海电气集团股份有限公司 Engineering drawing display method and device

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160062954A1 (en) * 2012-09-15 2016-03-03 Numbergun Llc Flexible high-speed generation and formatting of application-specified strings
CN105513630A (en) * 2015-11-30 2016-04-20 深圳市江波龙电子有限公司 DRAM initialization method and device thereof
US20170076072A1 (en) * 2015-09-11 2017-03-16 Patrick Robert Koren Method and apparatus for preventing and investigating software piracy
CN109739508A (en) * 2018-12-28 2019-05-10 龙芯中科技术有限公司 Compilation of source code method, apparatus, system and storage medium
CN111338640A (en) * 2020-02-15 2020-06-26 苏州浪潮智能科技有限公司 Dynamically adjustable asymmetric command chain connection method and device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160062954A1 (en) * 2012-09-15 2016-03-03 Numbergun Llc Flexible high-speed generation and formatting of application-specified strings
US20170076072A1 (en) * 2015-09-11 2017-03-16 Patrick Robert Koren Method and apparatus for preventing and investigating software piracy
CN105513630A (en) * 2015-11-30 2016-04-20 深圳市江波龙电子有限公司 DRAM initialization method and device thereof
CN109739508A (en) * 2018-12-28 2019-05-10 龙芯中科技术有限公司 Compilation of source code method, apparatus, system and storage medium
CN111338640A (en) * 2020-02-15 2020-06-26 苏州浪潮智能科技有限公司 Dynamically adjustable asymmetric command chain connection method and device

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
伊晓峰: "常驻RAM程序设计方法在编译型PLC中的应用", 信息技术与信息化, no. 04, 15 August 2009 (2009-08-15) *
曾丽芳等: "MPP数据并行FORTRAN汇编代码模拟环境的设计与实现", 国防科技大学学报, no. 01, 25 February 1999 (1999-02-25) *

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112506547A (en) * 2020-12-16 2021-03-16 杭州和利时自动化有限公司 Configuration data downloading method, device, equipment and readable storage medium
CN112650501A (en) * 2020-12-31 2021-04-13 重庆芯讯通无线科技有限公司 Compiling, terminal equipment and compiling link and loading method of client application program thereof
CN112835543A (en) * 2021-01-11 2021-05-25 上海电气集团股份有限公司 Engineering drawing display method and device
CN112835543B (en) * 2021-01-11 2024-04-12 上海电气集团股份有限公司 Engineering drawing display method and device
CN112732321A (en) * 2021-01-21 2021-04-30 恒为科技(上海)股份有限公司 Firmware modification method and device, computer readable storage medium and equipment
CN112732321B (en) * 2021-01-21 2024-02-09 恒为科技(上海)股份有限公司 Firmware modification method, device, computer readable storage medium and equipment

Similar Documents

Publication Publication Date Title
CN111767056A (en) Source code compiling method, executable file running method and terminal equipment
KR101699981B1 (en) Memory optimization of virtual machine code by partitioning extraneous information
CN109062617B (en) Application method of platform supporting multiple types of equipment and mobile terminal
CN107797820B (en) Method and device for generating patch
CN111324396A (en) Block chain intelligent contract execution method, device and equipment
US8935686B2 (en) Error-code and exception-based function dispatch tables
CN112631684B (en) Executable program running method and device, electronic equipment and computer storage medium
US8516455B2 (en) Dynamic loading of kernel extensions
CN114895935A (en) Method and device for flashing vehicle ECU, electronic equipment and storage medium
CN114138363A (en) Program data calling method, device, equipment and storage medium
CN110688320A (en) Global variable detection method and device and terminal equipment
CN112905381B (en) Method, device, equipment and medium for acquiring stack frame information in call stack
CN111796865B (en) Byte code file modification method, device, terminal equipment and medium
US20190065161A1 (en) Supporting compiler variable instrumentation for uninitialized memory references
CN112181538B (en) Diagnostic flow execution method, device, equipment and storage medium
US20170286072A1 (en) Custom class library generation method and apparatus
CN114219091A (en) Network model reasoning acceleration method, device, equipment and storage medium
CN110347471B (en) Hierarchical display component system, display component calling method and device
CN113971019A (en) Data type creating method, device, server and medium
CN113760237A (en) Compiling address updating method and device, terminal equipment and readable storage medium
CN112052051A (en) Plug-in processing method, device, equipment and storage medium
CN113031956A (en) Program compiling method and device and program running method and device
CN112764729A (en) Application software development method and device, computer equipment and readable storage medium
CN111338968A (en) Project function module debugging method, device, medium and electronic equipment
CN111078550A (en) Software testing method and device, computer device and storage medium

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