---Type <return> to continue, or q <return> to quit--- 0xb7e11811 < libc_start_main+385>: mov %eax,(%esp) 0xb7e11814 < libc_start_main+388>: call *%ecx 0xb7e11816 < libc_start_main+390>: mov -0x44(%ebp),%ecx 0xb7e11819 < libc_start_main+393>: mov 0x1c0(%ecx),%edx 0xb7e1181f < libc_start_main+399>: add $0x1,%esi 0xb7e11822 < libc_start_main+402>: mov 0x20(%edi),%edi 0xb7e11825 < libc_start_main+405>: cmp %edx,%esi 0xb7e11827 < libc_start_main+407>: jb 0xb7e11800 < libc_start_main+368> 0xb7e11829 < libc_start_main+409>: jmp 0xb7e11720 < libc_start_main+144> 0xb7e1182e < libc_start_main+414>: mov 0x10(%ebp),%ecx 0xb7e11831 < libc_start_main+417>: mov (%ecx),%eax 0xb7e11833 < libc_start_main+419>: mov %eax,0x4(%esp) 0xb7e11837 < libc_start_main+423>: lea -0x1f3b8(%ebx),%eax 0xb7e1183d < libc_start_main+429>: mov %eax,(%esp) 0xb7e11840 < libc_start_main+432>: call *0x194(%edx) 0xb7e11846 < libc_start_main+438>: jmp 0xb7e116ed < libc_start_main+93> End of assembler dump. 省略了很多,代码太多,去研究比较麻烦,但毕竟这是在 LINUX 下,我们可以找下 glibc 的源代码, libc_start_main 位于 glibc 库 csu 目录下 libc_start.c 文件,我们看一下 代码,如下所示: 019 #include <stdlib.h> 020 #include <stdio.h> 021 #include <unistd.h> 022 #include <ldsodefs.h> 023 #include <bp-start.h> 024 #include <bp-sym.h> 025 026 extern void libc_init_first (int argc, char **argv, char **envp); 027 028 extern int libc_multiple_libcs; 029 030 #include <tls.h> 031 #ifndef SHARED 032 # include <dl-osinfo.h> 033 extern void pthread_initialize_minimal (void); 034 # ifndef THREAD_SET_STACK_GUARD 035 /** Only exported for architectures that don't store the stack guard canary 036 in thread local area. */ 037 uintptr_t stack_chk_guard attribute_relro; 038 # endif 039 #endif 040 041 #ifdef HAVE_PTR_NTHREADS 042 /** We need atomic operations. */ 043 # include <atomic.h> 044 #endif 045 046 047 #ifdef LIBC_START_MAIN 048 # ifdef LIBC_START_DISABLE_INLINE 049 # define STATIC static 050 # else 051 # define STATIC static inline attribute ((always_inline)) 052 # endif 053 #else 054 # define STATIC 055 # define LIBC_START_MAIN BP_SYM ( libc_start_main) 056 #endif 057 058 #ifdef MAIN_AUXVEC_ARG 059 /** main gets passed a pointer to the auxiliary. */ 060 # define MAIN_AUXVEC_DECL , void * 061 # define MAIN_AUXVEC_PARAM , auxvec 062 #else 063 # define MAIN_AUXVEC_DECL 064 # define MAIN_AUXVEC_PARAM 065 #endif 066 067 STATIC int LIBC_START_MAIN (int (*main) (int, char **, char ** 068 MAIN_AUXVEC_DECL), 069 int argc, 070 char *__unbounded * unbounded ubp_av, 071 #ifdef LIBC_START_MAIN_AUXVEC_ARG 072 ElfW(auxv_t) * unbounded auxvec, 073 #endif 074 typeof (main) init, |