Experiment Seven: How the Linux kernel loads and starts an executable program

Source: Internet
Author: User

Original works reproduced please specify the source + "Linux kernel analysis" MOOC course http://mooc.study.163.com/course/USTC-1000029000

    1. Topic self-proposed, content revolves around how to load and start an executable program on the Linux kernel

    2. Can be combined with experiments, elf executable file format, user-state related code, etc.

    3. Blog content needs to carefully analyze the execution starting point of the new executable program and the corresponding stack state, etc.

    4. The summary section needs to clarify its understanding of the "Linux kernel load and start an executable program"

Lab Report:

  1. Understand the process of compiling links and the elf executable file format;

    1. C code--preprocessing--assembly code--Target code--executable file
    2. 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

      1. Elf executable file format
      2. Preprocessing is responsible for including the include file and macro replacement work. Hello and hello.o are both Elf-formatted files
      3. 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 .
  2. 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;

    1. Dynamic Link at load time
    2. Run-time dynamic linking
  3. 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;

  4. 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.