(A) Field of the Invention
The present invention relates to a method for making a linker program, e.g., a linker script.
(B) Description of the Related Art
The linker combines input files into a single output file. The output file and each input file are in a special data format known as an object file format. Each file is called an object file. The output file is often called an executable object file. Each object file has, among other things, a list of sections. Sometimes refer to a section in an input file as an input section; similarly, a section in the output file is an output section.
Each section in an object file has a name and a size. Most sections also have an associated block of data, known as the section contents. A section may be marked as loadable, which means that the contents should be loaded into memory when the output file is run. A section with no contents may be allocatable, which means that an area in memory should be set aside, but nothing in particular should be loaded there (in some cases this memory must be zeroed out). A section which is neither loadable nor allocatable typically contains some sort of debugging information.
The linker always uses a linker script. The linker script controls every link. Such a script is written in the linker command language. The main purpose of the linker script is to describe how the sections in the input files should be mapped into the output file, and to control the memory layout of the output file. However, when necessary, the linker script can also direct the linker to perform many other operations, using the linker commands. Linker scripts are text files. A linker script may be a series of commands. Each command is either a keyword, possibly followed by arguments, or an assignment to a symbol.
For linker operation, cache missing may occur while swap in/out. Therefore, the linker script needs to be improved so as to avoid cache missing occurrence.
The present invention is directed to providing a method for making a linker program, e.g., linker script, so as to avoid cache missing and improve operation efficiency for applications using the linker program.
The present application proposes a method for making a linker program. The method comprises the steps of (1) initializing a linker script; (2) selecting functions and sequence of the functions by a user; and (3) sequentially writing the functions to the linker script in accordance with the sequence of the functions.
In an embodiment, the method further comprises the step of inputting a file name for the linker script and checking whether the file name is repeated before initializing the linker.
In another embodiment, the method further comprises the step of checking whether all the functions are written to the linker script. If all the functions are written to the file of the linker script, the linker script is completed. If at least one of the functions is not written to the file of the linker script, a user may determine to either complete the file of linker script or again write the functions to the linker script.
Accordingly, the desired functions and the sequence of the functions are recorded in the linker script, so that the related program for applications, e.g., MP3 or MP4, can be operated more efficient, and cache missing caused by swap in/out can be diminished.
The objectives and advantages of the present invention will become apparent upon reading the following description and upon reference to the accompanying drawings in which:
Next, according to the user's demand, functions and the sequence of the functions are selected or loaded, thereby avoiding cache missing due to swap in/out. The functions includes:
The selected functions are written into the linker script in accordance of the sequence of the functions. If all the selected functions are written in the linker script, the linker script is completed. Otherwise, the user has to determine whether the remaining functions are written in “Linker Script.” If the user would not like to write further functions, the linker script is completed.
Accordingly, because the functions and the sequence are written into the linker script, so that the file can be proceeded faster and cache missing caused by swap in/out can be diminished. As a result, the operation for some video or audio application, e.g., MP3 or MP4, can be proceeded more efficiently, and power consumption can be decreased.
The above-described embodiments of the present invention are intended to be illustrative only. Numerous alternative embodiments may be devised by those skilled in the art without departing from the scope of the following claims.