+
+ // Allow writing to read-only segments, just in case they need to be relocated
+ // - Will be reversed at the end of the function
+ for( i = 0; i < iSegmentCount; i ++ )
+ {
+ if(phtab[i].Type == PT_LOAD && !(phtab[i].Flags & PF_W) ) {
+ uintptr_t addr = phtab[i].VAddr + iBaseDiff;
+ uintptr_t end = addr + phtab[i].MemSize;
+ for( ; addr < end; addr += PAGE_SIZE )
+ SysSetMemFlags(addr, 0, 1); // Unset RO
+ }
+ }
+