On Aug 1, 2018, at 3:20 PM, Chip Davis cdavis@codeweavers.com wrote:
@@ -425,7 +430,15 @@ static void *map_dll( const IMAGE_NT_HEADERS *nt_descr ) delta = (const BYTE *)nt_descr - addr; code_start = page_size; data_start = delta & ~page_mask; +#ifdef __APPLE__
- /* Need the mach_header, not the PE header, to give to getsegmentdata(3) */
- dladdr(addr, &dli);
- code_end = getsegmentdata(dli.dli_fbase, "__DATA", &data_size) - addr;
- data_end = (code_end + data_size + page_mask) & ~page_mask;
+#else
- code_end = delta & ~page_mask;
Perhaps just:
code_end = data_start;
here, to avoid a bit of duplication and make the non-Apple behavior crystal clear.
data_end = (nt->OptionalHeader.SizeOfImage + delta + page_mask) & ~page_mask;
+#endif
fixup_rva_ptrs( &nt->OptionalHeader.AddressOfEntryPoint, addr, 1 );