mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-14 11:50:49 +00:00
- fixed incorrect autosegs section addresses on macOS
It appeared that getsectbyname() returns address stored in executable header as is, i.e. without adjusting it for ASLR
This commit is contained in:
parent
36479b623d
commit
07eeba88fa
1 changed files with 6 additions and 3 deletions
|
@ -49,6 +49,7 @@
|
||||||
#include <dbghelp.h>
|
#include <dbghelp.h>
|
||||||
#elif defined __MACH__
|
#elif defined __MACH__
|
||||||
#include <mach-o/getsect.h>
|
#include <mach-o/getsect.h>
|
||||||
|
#include <mach-o/ldsyms.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -101,10 +102,12 @@ void FAutoSeg::Initialize()
|
||||||
|
|
||||||
#elif defined __MACH__
|
#elif defined __MACH__
|
||||||
|
|
||||||
if (const struct section_64 *const section = getsectbyname(AUTOSEG_MACH_SEGMENT, name))
|
unsigned long size;
|
||||||
|
|
||||||
|
if (uint8_t *const section = getsectiondata(&_mh_execute_header, AUTOSEG_MACH_SEGMENT, name, &size))
|
||||||
{
|
{
|
||||||
begin = reinterpret_cast<void **>(section->addr);
|
begin = reinterpret_cast<void **>(section);
|
||||||
end = reinterpret_cast<void **>(section->addr + section->size);
|
end = reinterpret_cast<void **>(section + size);
|
||||||
}
|
}
|
||||||
|
|
||||||
#else // Linux and others with ELF executables
|
#else // Linux and others with ELF executables
|
||||||
|
|
Loading…
Reference in a new issue