Original works reproduced please specify the source + "Linux kernel analysis" MOOC course http://mooc.study.163.com/course/USTC-1000029000
Topic self-proposed, content revolves around how to load and start an executable program on the Linux kernel
Can be combined with experiments, elf executable file format, user-state related code, etc.
Blog content needs to carefully analyze the execution starting point of the new executable program and the corresponding stack state, etc.
The summary section needs to clarify its understanding of the "Linux kernel load and start an executable program"
Lab Report:
Understand the process of compiling links and the elf executable file format;
- C code--preprocessing--assembly code--Target code--executable file
gcc- e Hello. C- o Hello. I
gcc–s hello.i–o hello.s
Gcc–c < Span class= "Hljs-selector-tag" >hello.s–o hello.O
- Elf executable file format
- Preprocessing is responsible for including the include file and macro replacement work. Hello and hello.o are both Elf-formatted files
- The elf is a relocatable (relocatable) file that holds the code and the appropriate data to be used with other object files to create an executable file or a shared file .
Programming uses the exec* library function to load an executable file, dynamic link is divided into executables when loading dynamic link and runtime dynamic link, programming practice dynamic Link Library of these two ways of use;
- Dynamic Link at load time
- Run-time dynamic linking
Use GDB trace to analyze a EXECVE system call kernel handler function Sys_execve, verify your understanding of the process required to load the executable program for Linux systems, and refer to the third section of this week for details;
Paying particular attention to where the new executable program starts? Why does the new executable program execute smoothly after the EXECVE system call returns? What is the difference between a static-linked executable program and a dynamically-linked executable EXECVE system call return?
Experiment Seven: How the Linux kernel loads and starts an executable program