0x00 Assembly Initial Entry-pre-preparation one. Assembly Tools
The common compiler for Linux is as as, the connector is LD, the text editor used is vim, and the assembly syntax is ATT
Here are some tools:
Addr2line convert address to file name and line number
AR Create, modify and expand File archive
As Assembler
C++filt Restore C + + symbol filters
GPROF Display Program profile information
LD links the target code file
Nlmconv Convert the target code to the NetWare loadable module format
NM lists the symbols in the destination file
Objcopy copying and translating target files
Objdump displaying information from the target file
Ranlib index of the generated archive file
Readelf displaying information from the target file in elf format
Size lists the length of the destination file or archive file
strings displaying printable strings in the destination file
Strip Discard Symbols
Windres compiling Windows Resource files
Above is the GNU Development Kit Binutils Tools, we mainly use as and LD these two tools, also can directly use GCC, we use GDB for debugging.
Two. Basics of the use of assembler tools
1. Using AS and LD
A Use as to convert the assembly file into a target file, with the following basic usage:
1 as-- -o xxx.o xxx.s
Where--32 is to tell the assembler to generate 32-bit target files, if the system is 32 bits can not add this parameter, 64-bit system please add this.
b Use the LD to connect to the target file with the following basic usage:
1 ld -m elf_i386-o xxx xxx.
Where-M elf_i386 is also due to the 32-bit system.
2. Using GCC
We can write a simple HelloWorld.
1 #include <stdio.h> 23int main () 4{ 5 printf ("Hello world!\n"); 6 return0; 7 }
Save the file as HELLOWORLD.C, and use the following command to get its assembly code
1 gcc -S HELLOWORLD.C
Compile the file with the following command
1 gcc helloworld.c-o HelloWorld
3. Using GDB
We can use GDB to debug the program, you can load the file using the following command (using gdb debug file, you must add-G this parameter at compile time)
1 gdb-q xxx
Or already started GDB, we can use file xxx
The common commands of GDB are as follows:
Break Set breakpoints
Watch set monitoring point
Info Observing System elements
X Check memory location
Print Display variable values
Run Running the program
List lists the specified function or row
Next executes the next instruction
Step executes the next instruction
Cont resumes execution from the stopped position
Until run the program until the specified line
4. Using Objdump
This tool I often use can be disassembled, it is easy to get the program assembly code
1 objdump-d xxx
Three. End
I didn't write Helloword's blog directly. When I started, I prepared to write the second one, I think "工欲善其事, its prerequisite", first write related tools used better. As for what assembly, and the computer principle behind, continue to study slowly ^_^ at least has begun to learn!!!
Initial entry of 0x00linux32 bit assembly-pre-preparation