Question

I was looking into the import section of a Mach-O file and realised that there are 2 different exit system calls (at different addresses) to libSystem.B.dylib? I want to hook onto the exit method which is called. Although I'm aware trial and error works. I want to understand why there are 2 exit calls which libSystem re-exports. Does anyone know why this mach-O file is using 2 different __exit calls from the same libSystem shared library? Thanks.

**0003e6dc: __exit (ord#0)**
0003e6f8: _abort (ord#0)
0003e6fc: _access (ord#0)
0003e700: _atexit (ord#0)
.
.
.
.
**0003e760: _exit (ord#0)**
Was it helpful?

Solution

The first function is _exit and the second is exit. _exit will not call functions registered with atexit(), signal handlers, or flush open streams. It also has different process termination consequences as described in the link.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top