maloader
maloader copied to clipboard
Port to FreeBSD
Tested with FreeBSD 10 and 11.
Includes pull request #25 for correct building for FreeBSD i386.
Major changes/fixes:
- FreeBSD have their own
runetype.h
, renamed Darwin-specificrunetype.h
tomac-runetype.h
just likemac-ctype.h
, alone with associated identifiers, to avoid conflicts. - Neither FreeBSD kernel nor C library provide
*stat64
,*statfs64
andfseeko64
, avoid using them in such case. - Implements getting executable file path using sysctl(3), in addition to the Linux-specific
/proc/self/exe
. - Handles some differences in pthread-related macros between GNU and FreeBSD.
- qsort_r(3) has different prototype between GNU and FreeBSD, handled it accordingly.
- Function
MachOLoader::loadSegments(const MachO &, intptr *, intptr *)
contains a bug where it calls mmap(2) withMAP_ANON
but0
asfd
, this is invalid, as kindly pointed out by FreeBSD kernel by aEINVAL
.