Test platform is Linux 32 bit.
I use IDA Pro to disassembly the basename from coreutils 8.5 compiled by gcc 4.6.3
Here is a code snippet generated by IDA Pro
call _i686_get_pc_thunk_bx
add ebx, 292Eh
sub esp, 18h
mov eax, ds:(__dso_handle_ptr - 804DFF4h[ebx]
test eax, eax
jz short loc_804B6F8
mov eax, [eax]
loc_804B6DB:
mov [esp+1Ch+var_14], eax
mov eax, [esp+1Ch+arg_0]
mov dword [esp+1Ch+var_18], 0
mov [esp+1Ch+var_1C], eax
call __cxa_atexit
add esp, 18h
pop ebx
retn
loc_804B6F8:
xor eax, eax
jmp short loc_804B6DB
I don't understand this line:
mov eax, ds:(__dso_handle_ptr - 804DFF4h[ebx]
and after searching the code, I can only find this:
__dso_handle dd 0
in the .data section.
So my questions are:
- What is the meaning of this line..? Is it like a version checking stuff..?
- Can I just safely remove this line without affecting the functionality of the code..?
main
of basename?