Skip to content

说说点击App后到main方法经过的步骤 #64

Open
@tbfungeek

Description

  1. 找到镜像激活器,镜像激活器会匹配出当前主程序镜像是单指令镜像,多指令镜像,还是shell脚本。
  2. 对镜像的头部信息进行校验,判断是否与当前平台兼容。
  3. 使用loadCommand 加载主程序镜像LC_LOAD_DYLINKER中的dylinker
  4. dyld加载完成后,进入其入口__dyld_start.通过引导程序进入dyld的main入口。
  5. 将主程序初始化为ImageLoader.
  6. 加载共享库到内存,加载插入的动态库 这时候会调用runtime中的map_image
  7. 链接主程序,链接插入库 这个步骤包括rebase/bind两部分
  8. 初始化主程序,插入库 这时候会调用load 方法
  9. 寻找主程序入口点,跳到main方法执行

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions