Questions about Staging patch for Mac preloader

Ken Thomases ken at codeweavers.com
Wed Nov 21 15:48:11 CST 2018


Hi,

I'm looking into getting the Mac preloader patches <https://github.com/wine-staging/wine-staging/tree/master/patches/loader-OSX_Preloader> upstreamed.  The patches are mostly good as-is, but I have some things I'd like clarified, if possible.

* There's a configure check for "-Wl,--export-dynamic".  As near as I can tell, the Mac linker doesn't and has never supported that option.  The check seems to have been copied from the Linux and Android checks, but is apparently useless on macOS.  What was the intent?  Is there a chance that the patch is failing to ensure something necessary and it only works by luck?

There is a similarly-named option, "-export_dynamic" (only one leading dash, underscore instead of internal dash), in recent versions of the Mac linker but I'm not sure that it would achieve the intended purpose, since I'm not sure what that purpose is.

* There's a comment in the code:

	/* there is no way to translate the dlopen handle to the mach header :-( */

and it uses a function find_executable() to search for the executable.  I believe it should be possible to use dladdr(wine_main_preload_info, …) to find it.  The dli_fbase field of the Dl_info struct is documented in the man page as pointing to the Mach header.  Then, dyld exports __dyld_get_image_slide(const struct mach_header*) via _dyld_func_lookup().

So, the question is, was this considered and rejected?  Or just not considered?  If it was rejected, why?

Thanks,
Ken




More information about the wine-devel mailing list