main_arm64

用MachOView去查看这个main_arm64: Mach-O 64-bit executable arm64

Mach64 Header

machoview_main_arm64_header

内容:

  • Mach64 Header
    • MH_MAGIC_64
    • CPU_TYPE_ARM64
    • CPU_SUBTYPE_ARM64_ALL
    • MH_EXECUTE
    • Number for Load Commands: 17
    • Flags
      • MH_NOUNDEFS
      • MH_DYLDLINK
      • MH_TWOLEVEL
      • MH_PIC
    • Reserved: 0

Load Commands

machoview_main_arm64_load_commands

LC_SEGMENT_64 (__PAGEZERO)

machoview_main_command_pagezero

LC_SEGMENT_64 (__TEXT)

machoview_main_command_text_sections

__TEXT,__text

machoview_main_text_text

__TEXT,__stubs

machoview_main_text_stubs

__TEXT,__stub_helper

machoview_main_text_stub_helper

__TEXT,__cstring

machoview_main_text_cstring

__TEXT,__unwind_info

machoview_main_text_unwind_info

LC_SEGMENT_64 (__DATA_CONST)

machoview_main_command_data_const_sections

__DATA_CONST,__got

machoview_main_data_const_got

LC_SEGMENT_64 (__DATA)

machoview_main_command_data_sections

__DATA,__la_symbol_ptr

machoview_main_data_la_symbol_ptr

__DATA,__data

machoview_main_data_data

__DATA,__common

machoview_main_data_common

LC_SEGMENT_64 (__LINKEDIT)

machoview_main_command_linkedit

LC_DYLD_INFO_ONLY

machoview_main_command_lc_dyld_info_only

LC_SYMTAB

machoview_main_command_lc_symtab

LC_DYSYMTAB

machoview_main_command_lc_dysymtab

LC_LOAD_DYLINKER

machoview_main_command_lc_load_dylinker

LC_UUID

machoview_main_command_lc_uuid

??? (unsupported)

machoview_main_command_unsupported

LC_SOURCE_VERSION

machoview_main_command_lc_source_version

LC_MAIN

machoview_main_command_lc_main

估计就是 入口函数 入口地址 = 一般叫做 main函数的 地方了

LC_LOAD_DYLIB (libSystem.B.dylib)

machoview_main_command_lc_load_dylib

LC_FUNCTION_STARTS

machoview_main_command_lc_function_starts

好像是:需要启动运行的函数的列表?

LC_DATA_IN_CODE

machoview_main_command_lc_data_in_code

LC_CODE_SIGNATURE

machoview_main_command_lc_code_signature

Sections

Section64 (__TEXT,__text)

  • machoview_main_sections_text_text
    • Assembly
      • machoview_main_sections_text_text_assembly_1
      • machoview_main_sections_text_text_assembly_2

Section64 (__TEXT,__stubs)

  • machoview_main_sections_text_stubs
    • Symbol Stubs
      • machoview_main_sections_text_stubs_symbol_stubs

好像是:

stub=表示 桩 ,地基

表示,代码运行前,要打地基 = 做好准备

所以此处表示:所引用的外部的函数

此处分别是:

  • ___strcpy_chk
  • _free
  • _malloc
  • _printf

Section64 (__TEXT,__stub_helper)

  • machoview_main_sections_text_stub_helper
    • Assembly
      • machoview_main_sections_text_stub_helper_assembly

Section64 (__TEXT,__cstring)

  • machoview_main_sections_text_cstring
    • C String Literals
      • machoview_main_sections_text_cstring_c_string_literals_1
      • machoview_main_sections_text_cstring_c_string_literals_2

Section64 (__TEXT,__unwind_info)

  • machoview_main_sections_text_unwind_info

Section64 (__DATA_CONST,__got)

  • machoview_main_sections_data_const_got
    • Non-Lazy Symbol Pointers
      • machoview_main_sections_data_const_got_non_lazy_symbols_pointers

Section64 (__DATA,__la_symbol_ptr)

  • machoview_main_sections_data_la_symbol_ptr
    • Lazy Symbol Pointers
      • machoview_main_sections_data_lazy_symbol_pointers

Section64 (__DATA,__data)

  • machoview_main_sections_data_data

Dynamic Loader Info

  • machoview_main_dynamic_loader_info
    • Rebase Info
      • machoview_main_dynamic_loader_info_rebase_info
      • Opcodes
        • machoview_main_dynamic_loader_info_rebase_info_opcodes
      • Actions
        • machoview_main_dynamic_loader_info_rebase_info_actions
    • Binding Info
      • machoview_main_dynamic_loader_info_binding_info
        • Opcodes
          • machoview_main_dynamic_loader_info_binding_info_opcodes
      • Actions
        • machoview_main_dynamic_loader_info_binding_info_actions
    • Lazy Binding Info
      • machoview_main_dynamic_loader_info_lazy_binding_info
        • Opcodes
          • machoview_main_dynamic_loader_info_lazy_binding_info_opcodes
      • Actions
        • machoview_main_dynamic_loader_info_lazy_binding_info_actions
    • Export Info
      • machoview_main_dynamic_loader_info_export_info
        • Opcodes
          • machoview_main_dynamic_loader_info_export_info_opcodes_1
          • machoview_main_dynamic_loader_info_export_info_opcodes_2
      • Actions
        • machoview_main_dynamic_loader_info_export_info_actions

对应原先代码中的,全局变量:

// demo Data segment
const char* gAuthor = "crifan"; // demo const string, place where?
char* gFullName = "CrifanLi"; // demo non-const string, place where?
int gInputArgsCount; // demo uninitialized data
int gCurDate = 20230419;  // demo initialized data

好像还额外去导出了这些全局变量?

Function Starts

  • machoview_main_function_starts
    • Functions
      • machoview_main_function_starts_functions

Symbol Table

  • machoview_main_symbol_table
    • Symbols
      • machoview_main_symbol_table_symbols_1
      • machoview_main_symbol_table_symbols_2
      • machoview_main_symbol_table_symbols_3
      • machoview_main_symbol_table_symbols_4

Data in Code Entries

  • machoview_main_data_in_code_entries

Dynamic Symbol Table

  • machoview_main_dynamic_symbol_table
    • Indirect Symbols
      • machoview_main_dynamic_symbol_table_indirect_symbols

String Table

  • machoview_main_dynamic_string_table
    • Strings Parse
      • machoview_main_dynamic_string_table_strings_parse

Code Signature

  • machoview_main_code_signature

results matching ""

    No results matching ""