maloader icon indicating copy to clipboard operation
maloader copied to clipboard

Port to FreeBSD

Open Low-power opened this issue 2 years ago • 0 comments

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-specific runetype.h to mac-runetype.h just like mac-ctype.h, alone with associated identifiers, to avoid conflicts.
  • Neither FreeBSD kernel nor C library provide *stat64, *statfs64 and fseeko64, 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) with MAP_ANON but 0 as fd, this is invalid, as kindly pointed out by FreeBSD kernel by a EINVAL.

Low-power avatar Nov 29 '22 04:11 Low-power