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

Method and system for simplifying executable files

A technology for executing files and compiling files, applied in the field of basic research of linux system, can solve the problems of wasting flash space and memory space, increasing the size of executable files, etc.

Inactive Publication Date: 2020-08-14
FENGHUO COMM SCI & TECH CO LTD
View PDF1 Cites 3 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

Executable files need to link some static libraries. Usually, not all the functions and symbols in the static libraries are used, only a few of them are used, but the system will automatically link all the static libraries to the executable file by default, resulting in The size of the executable file is greatly increased, wasting flash space and memory space; for example, all functions or symbols (function) in a certain .c program are added to the same section (section), if the .o generated by this .c is used Any one of the functions, all functions (symbols) must be added to it
In order to reduce the size of the single-disk software package, it can be realized by streamlining the executable file, but there is still a lack of a simple and effective method for streamlining the executable file

Method used

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

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • Method and system for simplifying executable files

Examples

Experimental program
Comparison scheme
Effect test

Embodiment 1

[0036] This embodiment provides a method for streamlining an executable file, the method comprising the following steps:

[0037] Based on the functionality of the executable, determine the number and types of global variables that the executable needs to define.

[0038] During the coding phase, reduce the number of global variable initializations when defining global variables.

[0039] Optimize the makefile compilation file during the compilation phase, identify each function and / or symbol during compilation, and remove unnecessary functions and / or symbols based on the identification during linking.

[0040] A program is essentially composed of BSS segment, data segment, and text segment. This is a very important basic concept in current computer programming, and it is also very important in the design of embedded systems. It involves the allocation of memory size when the embedded system is running, and the size of the storage unit.

[0041] In this embodiment, by analyz...

Embodiment 2

[0049] As a better alternative, on the basis of Embodiment 1, this embodiment does not initialize a global variable first when defining a global variable, so as to reduce the number of global variable initializations when defining a global variable.

[0050] When defining a global variable, if the global variable is not initialized first, the system will automatically initialize the global variable.

[0051] Further, for the controllability of the coding stage, in this embodiment, when defining a global variable, the global variable is not initialized first, and the initialization value is assigned when the global variable is used, so as to reduce the initialization of the global variable when defining the global variable. quantity. For example, assign an initialization value of 0 to the global variable, so that the global variable is within a controllable range.

[0052] Because it is initialized in the definition, it belongs to the data segment; it is not initialized in the...

Embodiment 3

[0055] As a better alternative, on the basis of Example 1, when optimizing the makefile to compile files:

[0056] During compilation, use -ffunction-sections to create a corresponding section for each function function, and / or use -fdata-sections to create a corresponding section for each symbol data, and match the corresponding section name with function and / or The data name remains consistent;

[0057] During the linking phase, use -Wl,--gc-sections to remove unused sections to remove unneeded functions and / or symbols.

[0058] The link operation of GCC (GNU Compiler Suite, GNU Compiler Collection) uses section as the smallest processing unit. As long as a certain symbol is referenced in a section, the section will be added to the executable file. For example, if a function or symbol in a c source program is added to a section, if the program uses this function or symbol in the executable file generated by the c source program, all functions or symbols will be added to it,...

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

PUM

No PUM Login to View More

Abstract

The invention discloses a method and system for simplifying executable files, and relates to the field of linux system basic research. The method comprises the following steps: determining the numberand type of global variables required to be defined by the executable file based on the function of the executable file; in the encoding stage, defining the number of initialized global variables is reduced when the global variables; optimizing the makefile compiling file in the compiling stage, identifying each function and / or symbol during compiling, and removing unwanted functions and / or symbols based on the identifiers during linking. According to the method for simplifying the executable files, the size of the executable files can be effectively reduced.

Description

technical field [0001] The invention relates to the field of linux system basic research, in particular to a method and system for streamlining executable files. Background technique [0002] The single-disk software package in the communication equipment is getting larger and larger, resulting in an increasing package of the whole machine. The main control device does not have enough space to store the single-disk software package. resulting in insufficient storage space. This seriously affects the utilization efficiency of the equipment under the condition that the storage space of the embedded system is very precious. [0003] A single-disk software package usually includes multiple executable files, and an executable file (executable file) refers to a file that can be loaded and executed by an operating system. Executable files need to link some static libraries. Usually, not all the functions and symbols in the static libraries are used, only a few of them are used, b...

Claims

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

Application Information

Patent Timeline
no application Login to View More
Patent Type & Authority Applications(China)
IPC IPC(8): G06F8/41G06F8/71G06F11/36
CPCG06F8/41G06F8/71G06F11/362
Inventor 邓凯叶俊
Owner FENGHUO COMM SCI & TECH CO LTD