Compiler Options

arm-linux-gcc option

C file to go through a 4-step preprocessing, compilation, assembly, and so becomes connected to the executable file.

Pretreatment:

  # Number in the beginning of the command is called the pre-command, such as those containing #include command, the command #define macro definition, conditional compilation command #if, #ifdef like. Pretreatment Kazakhstan is going to hold the file into the source file,

The expanded macro definition, conditional compilation command code to be used according to choice, and finally outputs the code to a ".i" file awaiting further processing . The pretreatment used tool arm-linux-cpp

Compile:

  Compile the code is translated into assembly code, such as the aforementioned ".i" file. The tool is used ccl

compilation:

  The compilation is the output stage of assembly code translated into machine code compiled to meet certain format in linux system to the general performance of the above

ELF object file (OBJ file), the tool used to arm-linux-as

connection:

  The above link is generated OBJ files and system libraries OBJ asked in connection, which eventually can generate platform-specific executable file to run , the tool used to arm-linux-ld

 For the arm-linux-gcc

   Coupled with the -v option, you can watch compiled details

  -c preprocessing, the compiler and assembler source file, but not linking, the compiler generates OBJ files based on the source file.

  -S Stop after compilation, do not assemble

  -E Stop after the preprocessing, do not compile.

  -o file Specifies the output file to file

 

arm-linux-ld for a plurality of object files, executable files connected libraries.

Wherein "-T" option it can be used directly to specify the code segments, data segments, the start address of the bss section, it can also be used to specify a connection script, more complicated address provided in the connection script.

-T option is only used to connect Bootloader, kernel, and so "there is no underlying software support" software; connect applications running on top of the operating system, without specifying the -T option, they use the default connection to connect.

 

-Ttext startaddr snippet actually address startaddr

The starting address of the data segment is -Tdata startaddr startAddr

Start address -Tbss startaddr bss section is startAddr

arm-linux-ld -Ttext 0x00000000 -g led_on.o -o led_on_elf

It indicates the operating code segment for the address 0x00000000, since there is no definition of the data segment, the starting address for the bss section, once they are placed after the code segment.

 

Guess you like

Origin www.cnblogs.com/cheyihaosky/p/11562330.html