A source code compiling method, an executable file running method and a terminal device

By determining and storing the continuous storage addresses of target parameters during source code compilation, the problem of low storage space usage during the running of executable files in terminal devices is solved, and efficient utilization and defragmentation of storage space are achieved.

CN111767056BActive Publication Date: 2024-09-27GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202010603636.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-06-29
Publication Date
2024-09-27
Estimated Expiration
2040-06-29

AI Technical Summary

Technical Problem

Executable files stored in terminal devices have the problem of low storage space usage during operation, especially because the target parameters still occupy storage space after the preset stage is over and cannot be released in time, resulting in fragmentation of storage space and difficulty in meeting other needs. Storage requirements.

Method used

By determining and storing the continuous storage addresses of the target parameters during the source code compilation process, the compiled executable file is generated so that the parameters used only in the preset phase are stored in the continuous space, and the space is released after the preset phase ends. Thereby optimizing storage space utilization.

Benefits of technology

It improves the storage space usage of terminal equipment, avoids scattered storage of target parameters, ensures that subsequent storage needs are met, and reduces the operating burden of terminal equipment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN111767056B
    Figure CN111767056B
Patent Text Reader

Abstract

The present application provides a source code compilation method, an executable file running method and a terminal device. The source code compilation method includes: determining a target parameter contained in the source code to be compiled, the target parameter is a parameter used only in a preset stage of the executable file running, and the executable file is a compiled file corresponding to the source code to be compiled; when compiling the source code to be compiled, determining a storage address for storing the target parameter when the compiled executable file is running, wherein the storage space corresponding to the storage address is a continuous storage space; based on the storage address, generating the executable file. The present application can solve the technical problem of low utilization rate of storage space of terminal devices in the current executable file running process to a certain extent.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of computer technology, and in particular, relates to a source code compiling method, an executable file running method and a terminal device. Background Art

[0002] At present, the executable files stored in the terminal devices often have target parameters, which are only used in the preset stage (for example, the initialization stage) of the executable file. During the running of the executable file, when the above preset stage ends, the target parameter is no longer used, but it will still occupy the storage space. When there are multiple target parameters, the target parameters are often stored in a scattered manner. Even if the terminal device executes a storage space release operation, it can only obtain scattered small blocks of storage space, which makes it difficult to meet other subsequent storage needs.

[0003] Therefore, during the current execution of executable files, there is a technical problem of low utilization rate of storage space of terminal devices. Summary of the invention

[0004] In view of this, the embodiments of the present application provide a source code compilation method, an executable file running method and a terminal device, which can solve the technical problem of low terminal device storage space utilization rate in the current executable file running process to a certain extent.

[0005] In a first aspect, an embodiment of the present application provides a source code compilation method, comprising:

[0006] Determine a target parameter contained in the source code to be compiled, wherein the target 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 source code to be compiled;

[0007] When compiling the source code to be compiled, determining a storage address for storing the target parameter when the compiled executable file is running, wherein the storage space corresponding to the storage address is a continuous storage space;

[0008] Based on the storage address, the executable file is generated.

[0009] The first aspect provides a source code compilation method. When compiling a source code to be compiled containing a target parameter, it is necessary to determine the storage address of the continuous storage space where the target parameter is stored when the compiled executable file is running, and then generate the compiled executable file based on the storage address, wherein the target parameter is a parameter used only in a preset stage (such as an initialization stage) of the executable file running. Based on the technical solution provided by the first aspect, the terminal device that subsequently runs the executable file can store the target parameter in the continuous storage space indicated by the storage address, avoiding the scattered storage of each target parameter when there are multiple target parameters, so that when the terminal device performs a storage space release operation later, compared with the prior art, it is possible to obtain a continuous available storage space with a larger storage capacity, thereby meeting other storage requirements. Therefore, the technical solution provided by the first aspect can improve the technical problem of low storage space utilization during the operation of the executable file to a certain extent.

[0010] In a second aspect, an embodiment of the present application provides a method for running an executable file, comprising:

[0011] Acquire an executable file containing a target parameter, wherein the target parameter is a parameter used only in a preset stage of the execution of the executable file, and the executable file is used to indicate a storage address for storing the target parameter when the executable file is executed, wherein the storage space corresponding to the storage address is a continuous storage space;

[0012] Running the executable file, and during the running process, storing the target parameter in the continuous storage space based on the storage address;

[0013] After the preset stage in the running process of the executable file ends, based on the storage address, the continuous storage space corresponding to the storage address is released.

[0014] The second aspect provides an executable file running method, first, obtaining an executable file containing a target parameter, wherein the target parameter is a parameter used only in a preset stage (e.g., an initialization stage) of the executable file running, and the executable file is used to indicate a storage address where the target parameter is stored, and the storage address corresponds to a continuous storage space; secondly, running the executable file, and during the running process, based on the storage address, storing the target parameter in the continuous storage space; finally, after the preset stage in the running process of the executable file ends, releasing the continuous storage space. It can be seen that in the running method provided by the present application, for the target parameter used only in the preset stage, the target parameter can be stored in a continuous storage space, and after the preset stage ends, the continuous storage space is released, so that compared with the prior art, a continuous available storage space with a larger storage capacity can be obtained, so as to meet other subsequent storage requirements, and to a certain extent solve the technical problem of low utilization rate of storage space of terminal devices in the current executable file running process.

[0015] In addition, the source code compilation method provided in the first aspect and the executable file running method provided in the second aspect are based on the same inventive concept and are technically related to each other. Both of them solve the technical problem of low utilization rate of terminal device storage space during the current executable file running process by storing target parameters in continuous storage space.

[0016] In a third aspect, an embodiment of the present application provides 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 described in the first aspect or the second aspect when executing the computer program.

[0017] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps described in the first aspect or the second aspect are implemented.

[0018] In a fifth aspect, an embodiment of the present application provides a source code compiling device, including:

[0019] A target parameter determination module, used to determine a target parameter contained in the source code to be compiled, wherein the target parameter is a parameter used only in a preset stage of the execution of an executable file, and the executable file is a compiled file corresponding to the source code to be compiled;

[0020] A storage address determination module, used for determining, when compiling the source code to be compiled, a storage address for storing the target parameter when the compiled executable file is running, wherein the storage space corresponding to the storage address is a continuous storage space;

[0021] An executable file generating module is used to generate the executable file based on the storage address.

[0022] In a sixth aspect, an embodiment of the present application provides an executable file running device, including:

[0023] An executable file acquisition module is used to acquire an executable file containing a target parameter, wherein the target parameter is a parameter used only in a preset stage of the execution of the executable file, and the executable file is used to indicate a storage address for storing the target parameter when the executable file is executed, wherein the storage space corresponding to the storage address is a continuous storage space;

[0024] A storage module, used for running the executable file and storing the target parameter in the continuous storage space based on the storage address during the running process;

[0025] The release module is used to release 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 ends.

[0026] In a seventh aspect, an embodiment of the present application provides a computer program product, wherein the computer program product includes a computer program, and when the computer program is executed by one or more processors, the steps described in the first aspect or the second aspect are implemented.

[0027] It can be understood that the beneficial effects of the third to seventh aspects mentioned above can be found in the relevant descriptions of the first and second aspects mentioned above, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application.

[0029] Figure 1 This is a schematic diagram of the implementation process of a source code compilation method provided in Example 1 of the present application;

[0030] Figure 2 This is a schematic diagram of the implementation flow of an executable file running method provided in Example 2 of the present application;

[0031] Figure 3This is a schematic diagram of a method for obtaining an executable file provided in Example 2 of the present application;

[0032] Figure 4 It is a structural diagram of a source code compiling device provided in Embodiment 3 of the present application;

[0033] Figure 5 It is a structural diagram of an executable file running device provided in Embodiment 4 of the present application;

[0034] Figure 6 This is a structural diagram of a terminal device provided in Example 5 of the present application. DETAILED DESCRIPTION

[0035] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.

[0036] The source code compilation method provided in the embodiment of the present application can be applicable to terminal devices. For example, the terminal devices include but are not limited to: smart phones, tablet computers, notebooks, desktop computers, servers, etc.

[0037] The executable file running method provided in the embodiment of the present application can also be applied to terminal devices. For example, the terminal devices include but are not limited to: smart phones, tablet computers, notebooks, desktop computers, servers, etc.

[0038] It is easy for a person skilled in the art to understand that the terminal device applicable to the above-mentioned source code compilation method and the terminal device applicable to the above-mentioned executable file running method can be the same device or different devices, and this application does not limit this.

[0039] It should be understood that when used in this specification and the appended claims, the term "comprising" indicates the presence of described features, integers, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or groups thereof.

[0040] It should also be understood that the terms used in this application specification are only for the purpose of describing specific embodiments and are not intended to limit the application. As used in this application specification and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an" and "the" are intended to include plural forms.

[0041] It should be further understood that the term “and / or” used in the specification and appended claims refers to any combination and all possible combinations of one or more of the associated listed items, and includes these combinations.

[0042] As used in this specification and the appended claims, the term "if" may be interpreted as "when" or "upon" or "in response to determining" or "in response to detecting," depending on the context. Similarly, the phrases "if it is determined" or "if [described condition or event] is detected" may be interpreted as meaning "upon determination" or "in response to determining" or "upon detection of [described condition or event]" or "in response to detecting [described condition or event]," depending on the context.

[0043] In addition, in the description of the present application, the terms "first", "second", etc. are only used to distinguish the description and cannot be understood as indicating or implying relative importance.

[0044] In order to illustrate the above technical solution of the present application, a specific embodiment is provided below for illustration.

[0045] Embodiment 1

[0046] The following describes a source code compilation method provided in Example 1 of the present application. Figure 1 , the source code compilation method includes:

[0047] In step S101, the target parameter contained in the source code to be compiled is determined, wherein the target parameter is a parameter used only in a preset stage of the execution of the executable file, and the executable file is a compiled file corresponding to the compiled source code.

[0048] In the embodiment of the present application, the number of "target parameters" determined in step S101 can be multiple or one, and the present application does not limit the number of the above-mentioned target parameters determined.

[0049] The inventive concept of the embodiment of the present application is: the parameters used only in the preset stage of the executable file are continuously stored, so that after the preset stage ends, the terminal device executing the executable file can obtain a relatively large continuous available storage space after releasing the storage space storing the parameter, thereby improving the efficiency of the use of the storage space. Based on the above-mentioned inventive concept, the embodiment of the present application provides a source code compilation method, that is, the compiled executable file can characterize the storage address of the above-mentioned target parameter, and the storage address corresponds to the continuous storage space, so that the terminal device executing the executable file can store the above-mentioned target parameter in the continuous storage space based on the storage address characterized by the executable file. Therefore, the parameter that the embodiment of the present application focuses on is "the parameter used only in the preset stage of the executable file running", so in this step S101, it is necessary to determine the parameter used only in the preset stage of the executable file running (for the convenience of subsequent description, the parameter is called the target parameter).

[0050] In the 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 device can determine the target parameter by finding the identified parameter. That is, step S101 may include:

[0051] The source code to be compiled is obtained, and based on the source code to be compiled, a parameter identified in the source code to be compiled is determined, and the identified parameter is determined as the target parameter.

[0052] To facilitate those skilled in the art to understand the technical solution of the embodiment of the present application, the following example provides a source code for identifying the target parameter:

[0053] uint32_t one_data

[1024] __SECTION(".tmp_data");

[0054] This source code means: the data parameter one_data

[1024] __SECTION of the 32-bit unsigned integer type is identified with the identification name .tmp_data. This allows the terminal device to determine the target parameter by identifying ".tmp_data".

[0055] However, those skilled in the art should easily understand that the method for determining the target parameter in the source code to be compiled is not limited to the above method of identifying the target parameter, and can also be: reminding the compilation operator to directly input the target parameter, and determining the target parameter through the input of the compilation operator. The present application does not limit the specific implementation of step S101.

[0056] In step S102, when the source code to be compiled is compiled, a storage address for storing the target parameter when the compiled executable file is run is determined, wherein the storage space corresponding to the storage address is a continuous storage space.

[0057] Since the present application requires that the compiled executable file can represent the storage address of the above-mentioned target parameter (and the storage address corresponds to a continuous storage space), it is necessary to obtain the storage address corresponding to the continuous storage space during the source code compilation 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 the storage address for storing the above-mentioned target parameter, wherein the storage address corresponds to a continuous storage space.

[0058] In step S103, the executable file is generated based on the storage address.

[0059] The executable file is used to indicate that during the execution of the executable file, the target parameter is stored in the storage address.

[0060] After obtaining the storage address for storing the target parameter in step S102, a compiled executable file is generated based on the storage address. Those skilled in the art will readily understand that the storage address may be directly written into the compiled executable file.

[0061] In an embodiment of the present application, a link script used in the compilation and linking stage can 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 the above step S103 can be generated based on the link script.

[0062] For example, if the target parameter is identified as .tmp_data, the link script can set the storage address of the target parameter to 0x0000-0x00FF through the following code:

[0063] .tmp_data:{*(.tmp_data*)}

[0064] This code segment indicates: the parameter marked as ".tmp_data" is stored in the .tmp_data segment, where the storage address corresponding to the .tmp_data segment needs to be pre-defined as 0x0000-0x00FF.

[0065] Therefore, in the embodiment of the present application, the storage address of the target parameter can be determined based on the link script, and the executable file can be generated based on the link script, that is, the above step S102 can include: when compiling the source code to be compiled, obtaining a link script, the link script is used to indicate the storage address of the target parameter, so as to determine the storage address of the target parameter through the link script. The above step S103 can include: in the linking stage of compiling the source code to be compiled, based on the storage address indicated by the link script, generating the executable file.

[0066] In addition, in the embodiments of the present application, it is not necessary to execute the above steps S102 and S103 through a link script. For example, the code (non-link script) used for compilation in the compilation stage can be rewritten to implement the above steps S102 and S103. The present application does not limit the specific implementation methods of the above steps S102 and S103. The above executable file generation method using other non-link scripts is also within the protection scope of the present application.

[0067] In addition, in an embodiment of the present application, the source code to be compiled may be an operating system kernel source code, and the executable file obtained after compiling the operating system kernel source code is an operating system kernel image file. When the operating system kernel image file is executed, the parameters used are all stored in the memory of the terminal device that executes the kernel image file. Therefore, based on the technical solution provided in the first embodiment of the present application, the target parameters can be stored in the continuous storage space in the memory, so that when the memory space is released subsequently, a relatively large continuous storage space can be obtained, thereby improving the utilization rate of the memory.

[0068] When the source code to be compiled is the operating system kernel source code, and the above-mentioned preset stage is the initialization stage of the operating system kernel source code, the source code compilation method of the first embodiment of the present application may include:

[0069] First, the parameters in the operating system kernel source code that are only used in the initialization phase are identified, and the terminal device A used for compilation determines the identified parameters as target parameters;

[0070] Secondly, the terminal device A compiles the operating system kernel source code, and during the compilation process, uses a link script to associate the target parameter with a continuous memory space (that is, it is equivalent to determining the storage address of the target parameter, and the storage address corresponds to the continuous memory space). The continuous memory space is the storage space of the target parameter in the terminal device B when the compiled operating system kernel image file is running in the terminal device B;

[0071] Finally, after being associated with the above-mentioned continuous memory space, an operating system kernel image file is generated.

[0072] Embodiment 1 of the present application provides a source code compilation method. Based on the source code compilation method, a terminal device that subsequently runs the executable file can store the target parameters in the continuous storage space indicated by the above-mentioned storage address, thereby avoiding the scattered storage of each target parameter when there are multiple target parameters. This makes it easier to obtain continuous available storage space with a larger storage capacity than the prior art when the terminal device performs a storage space release operation, thereby meeting other storage requirements and improving the technical problem of low storage space utilization during the execution of the executable file to a certain extent.

[0073] In addition, the source code compilation method provided by the present application can enable the terminal device running the compiled executable file to directly obtain a continuous storage space, without the need for the terminal device to defragment the scattered storage space of each storage target parameter in order to obtain a continuous storage space. Therefore, the technical solution provided by the present application can also reduce the operating burden of the terminal device.

[0074] Embodiment 2

[0075] The following describes the executable file running method provided in the second embodiment of the present application. Figure 2 , the operation method includes:

[0076] In step S201, an executable file containing a target parameter is obtained, wherein the target parameter is a parameter used only in a preset stage of the execution of the executable file, and the executable file is used to indicate a storage address for storing the target parameter when the executable file is running, wherein the storage space corresponding to the storage address is a continuous storage space;

[0077] In the second embodiment of the present application, the executable file obtained in the above step S201 can be obtained by the step S103 in the above embodiment 1, such as Figure 3 As shown, the terminal device 300 is a terminal device that runs the executable file running method described in Example 2 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 using the source code compilation method described in Example 1.

[0078] In the second embodiment of the present application, the above executable file may be an operating system kernel image file.

[0079] In step S202, the executable file is run, and during the running process, the target parameter is stored in the continuous storage space based on the storage address;

[0080] When the terminal device runs the above executable file, it will store the above target parameter in the above continuous storage space based on the storage address indicated by the executable file.

[0081] In step S203, after the preset stage in the running process of the executable file ends, based on the storage address, the continuous storage space corresponding to the storage address is released;

[0082] In the second embodiment of the present application, after the preset stage of the execution of the executable file ends, the continuous storage space is released. Specifically, the continuous storage space can be released by calling a preset operation interface function.

[0083] If the above executable file is an operating system kernel image file, when the terminal device runs the operating system kernel image file, it can load the operating system kernel image file into the memory by calling the boot loader program, and then the boot loader program guides the operating system kernel image file to start. Among them, Boot Loader is a small program that runs before the operating system kernel runs. Through this small program, we can initialize the hardware devices and establish a mapping map of the memory space, so as to bring the system's hardware and software environment to a suitable state, so as to prepare the correct environment for the final call to the operating system kernel.

[0084] If the executable file is an operating system kernel image file, and the preset stage is the initialization stage, the operating system kernel image file enters the initialization stage after being booted by the boot loader, and starts to initialize each subsystem. After the initialization is completed, the continuous storage space for target parameter storage can be released to the system by calling the preset operation interface function, so as to be used for subsequent storage. The storage space occupied by the operating system kernel image file at startup is the memory space. Therefore, based on the technical solution provided in the second embodiment of the present application, the utilization rate of the memory can be improved.

[0085] In the operating method provided in the second embodiment of the present application, for the target parameters used only in the preset stage, the target parameters can be stored in a continuous storage space, and after the preset stage ends, the continuous storage space is released. Therefore, compared with the prior art, a continuous available storage space with a larger storage capacity can be obtained to meet other subsequent storage needs, and to a certain extent, it can solve the technical problem of low utilization rate of terminal device storage space during the current executable file operation process.

[0086] Embodiment 3

[0087] like Figure 4FIG. 4 is a schematic diagram of the structure of a source code compiling device provided in Embodiment 3 of the present application. For the sake of convenience, only the part related to the embodiment of the present application is shown. The source code compiling device 400 includes:

[0088] The target parameter determination module 401 is used to determine the target parameter contained in the source code to be compiled, wherein the target parameter is a parameter used only in a preset stage of the execution of the executable file, and the executable file is a compiled file corresponding to the source code to be compiled;

[0089] A storage address determination module 402 is used to determine, when compiling the source code to be compiled, a storage address for storing the target parameter when the compiled executable file is running, wherein the storage space corresponding to the storage address is a continuous storage space;

[0090] The executable file generating module 403 is used to generate the executable file based on the storage address.

[0091] Optionally, the storage address determination module 402 is specifically used for:

[0092] When compiling the source code to be compiled, obtaining a link script, wherein the link script is used to indicate the storage address of the target parameter;

[0093] Accordingly, the executable file generation module 403 is specifically used for:

[0094] In the linking stage of compiling the source code to be compiled, the executable file is generated based on the storage address indicated by the linking script.

[0095] Optionally, the target parameter determination module 401 is specifically used for:

[0096] The source code to be compiled is obtained, and based on the source code to be compiled, a parameter identified in the source code to be compiled is determined, and the identified parameter is determined as the target parameter.

[0097] Optionally, the source code to be compiled is an operating system kernel source code to be compiled.

[0098] It should be noted that the information interaction, execution process and other contents between the above-mentioned devices are based on the same concept as the first embodiment of the method of the present application. Their specific functions and technical effects can be found in the corresponding method embodiment part and will not be repeated here.

[0099] Embodiment 4

[0100] like Figure 5As shown, it is a structural schematic diagram of an executable file running device provided in Embodiment 4 of the present application. For the convenience of description, only the part related to the embodiment of the present application is shown. The executable file running device 500 includes:

[0101] The executable file acquisition module 501 is used to acquire an executable file containing a target parameter, wherein the target parameter is a parameter used only in a preset stage of the execution of the executable file, and the executable file is used to indicate a storage address for storing the target parameter when the executable file is executed, wherein the storage space corresponding to the storage address is a continuous storage space;

[0102] A storage module 502, used for running the executable file and storing the target parameter in the continuous storage space based on the storage address during the running process;

[0103] The release module 503 is used to release 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 ends.

[0104] Optionally, the release module 503 is specifically used for:

[0105] After the preset stage in the running process of the executable file ends, a release operation is performed on the continuous storage space indicated by the storage address based on the storage address by calling a preset operation interface function.

[0106] Optionally, the above executable file is an operating system kernel image file.

[0107] Optionally, the storage module 502 runs the executable file by the following operations:

[0108] The operating system kernel image file is loaded into the memory by booting the boot loader program, and the operating system kernel image file is guided to start running after being loaded into the memory.

[0109] It should be noted that the information interaction, execution process and other contents between the above-mentioned devices are based on the same concept as the second embodiment of the method of the present application. Their specific functions and technical effects can be found in the corresponding method embodiment part and will not be repeated here.

[0110] Embodiment 5

[0111] Figure 6 Schematic diagram of the structure of the terminal device provided in Embodiment 5 of the present application. Figure 6As shown, 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 executable on the processor 601. When the processor 601 executes the computer program 603, the steps in the method embodiment 1 or the method embodiment 2 are implemented. Alternatively, when the processor 601 executes the computer program 603, the functions of each module in the device embodiment 3 or the device embodiment 4 are implemented.

[0112] Exemplarily, the computer program 603 may be divided into one or more modules, and the one or more modules 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 completing specific functions, and the instruction segments 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 determination module, a storage address determination module, and an executable file generation module, and the specific functions of each module are as follows:

[0113] Determine a target parameter contained in the source code to be compiled, wherein the target 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 source code to be compiled;

[0114] When compiling the source code to be compiled, determining a storage address for storing the target parameter when the compiled executable file is running, wherein the storage space corresponding to the storage address is a continuous storage space;

[0115] Based on the storage address, the executable file is generated.

[0116] For another example, the computer program 603 may include an executable file acquisition module, a storage module, and a release module, and the specific functions of each module are as follows:

[0117] Acquire an executable file containing a target parameter, wherein the target parameter is a parameter used only in a preset stage of the execution of the executable file, and the executable file is used to indicate a storage address for storing the target parameter when the executable file is executed, wherein the storage space corresponding to the storage address is a continuous storage space;

[0118] Running the executable file, and during the running process, storing the target parameter in the continuous storage space based on the storage address;

[0119] After the preset stage in the running process of the executable file ends, based on the storage address, the continuous storage space corresponding to the storage address is released.

[0120] 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 Figure 6 It is only an example of the terminal device 600 and does not constitute a limitation of the terminal device 600. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, the terminal device may also include input and output devices, network access devices, buses, etc.

[0121] The processor 601 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.

[0122] The memory 602 may be an internal storage unit of the terminal device 600, such as a hard disk or 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 card, etc. equipped on the terminal device 600. Further, the memory 602 may also include both an internal storage unit of the terminal device 600 and an external storage device. The memory 602 is used to store 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.

[0123] Those skilled in the art can clearly understand that, for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example for illustration. In practical applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the above-mentioned device can be divided into different functional modules to complete all or part of the functions described above. The functional modules in the embodiment can be integrated into a processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the modules in the above-mentioned device can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.

[0124] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0125] Those of ordinary skill in the art will appreciate that the modules and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0126] If the above integrated module is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned various method embodiments, and can also be completed by instructing the relevant hardware through a computer program. The above-mentioned computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the above-mentioned computer program includes computer program code, and the above-mentioned computer program code can be in source code form, object code form, executable file or some intermediate form. The above-mentioned computer-readable medium may include: any entity or device capable of carrying the above-mentioned computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electric carrier signal, telecommunication signal and software distribution medium. It should be noted that the content contained in the above-mentioned computer-readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electric carrier signals and telecommunication signals.

[0127] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the above embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the above embodiments, or replace some of the technical features therein by equivalents. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.

Claims

1. A source code compilation method, It is characterized in that include: Determine a target parameter contained in the source code to be compiled, wherein the target 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 source code to be compiled; When compiling the source code to be compiled, determining a storage address for storing the target parameter when the compiled executable file is running, wherein the storage space corresponding to the storage address is a continuous storage space; Based on the storage address, generating the executable file; Wherein, when compiling the source code to be compiled, determining the storage address for storing the target parameter when the compiled executable file is running includes: When compiling the source code to be compiled, obtaining a link script, wherein the link script is used to indicate the storage address of the target parameter; Accordingly, generating the executable file based on the storage address includes: In the linking stage of compiling the source code to be compiled, the executable file is generated based on the storage address indicated by the linking script.

2. The source code compiling method according to claim 1, It is characterized in that The step of determining the target parameter contained in the source code to be compiled includes: The source code to be compiled is obtained, and based on the source code to be compiled, a parameter identified in the source code to be compiled is determined, and the identified parameter is determined as the target parameter.

3. The source code compiling method according to any one of claims 1 to 2, It is characterized in that The source code to be compiled is the operating system kernel source code to be compiled.

4. A method for running an executable file, It is characterized in that include: Acquire an executable file containing a target parameter, wherein the target parameter is a parameter used only in a preset stage of the execution of the executable file, and the executable file is used to indicate a storage address for storing the target parameter when the executable file is executed, wherein the storage space corresponding to the storage address is a continuous storage space; Running the executable file, and during the running process, storing the target parameter in the continuous storage space based on the storage address; After the preset stage in the process of running the executable file ends, based on the storage address, releasing the continuous storage space corresponding to the storage address; Wherein, after the preset stage in the process of running the executable file ends, based on the storage address, releasing the continuous storage space corresponding to the storage address includes: After the preset stage in the running process of the executable file ends, a release operation is performed on the continuous storage space indicated by the storage address based on the storage address by calling a preset operation interface function.

5. The executable file running method according to claim 4, It is characterized in that The executable file is an operating system kernel image file.

6. The executable file running method according to claim 5, It is characterized in that The running of the executable file comprises: The operating system kernel image file is loaded into the memory by booting the boot loader program, and the operating system kernel image file is guided to start running after being loaded into the memory.

7. A terminal device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, It is characterized in that When the processor executes the computer program, the processor implements the steps of the source code compiling method according to any one of claims 1 to 3 or the executable file running method according to any one of claims 4 to 6.

8. A computer-readable storage medium storing a computer program. It is characterized in that When the computer program is executed by a processor, the steps of the source code compiling method according to any one of claims 1 to 3 or the executable file running method according to any one of claims 4 to 6 are implemented.