[Bug 14920] Win16 programs crash with Wine built with newer XCode on Mac OS X

wine-bugs at winehq.org wine-bugs at winehq.org
Sat Jul 25 18:09:05 CDT 2009


http://bugs.winehq.org/show_bug.cgi?id=14920





--- Comment #29 from Charles Davis <cdavis at mines.edu>  2009-07-25 18:08:57 ---
Created an attachment (id=22618)
 --> (http://bugs.winehq.org/attachment.cgi?id=22618)
Patch to fix Apple linker bug

Here's a patch that fixes the linker bug. After you untar the ld64 package (it
has to be ld64, NOT cctools), copy this file into the directory that was
created (typically ld64-<version>), then from that directory do:

 $ patch -p0 <ld64-16b-fix.patch
 $ xcodebuild ld64.xcodeproj

That will build a version of the linker with the linker bug fixed. If you then
install the linker, and reconfigure Wine (with ./configure from the Wine source
directory), it should work. (In particular, you need to make sure that the
version in /usr/libexec/gcc/<gnu-platform-id>/<version> is the fixed one.
<gnu-platform-id> will be something like i686-apple-darwin9.)

Short explanation: I had a hunch about what went wrong. I took AJ's example and
added a third NOP. Instead of going to the wrong label, it went exactly two
bytes away from the correct label. I then tracked the bug down to this line in
src/MachOReaderRelocatable.hpp:

  pointerValue = srcAddr + (int16_t)E::get16(*((uint16_t*)fixUpPtr)) +
sizeof(uint16_t);

I changed it to this:

  pointerValue = srcAddr + (int16_t)E::get16(*((uint16_t*)fixUpPtr)) +
sizeof(uint32_t);

and now it works. Notice that the fixed version adds 4 bytes (the size of a
uint32_t) instead of 2.

I encourage you to try this and see if this helps. (I really need to send this
to Apple...)

-- 
Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email
Do not reply to this email, post in Bugzilla using the
above URL to reply.
------- You are receiving this mail because: -------
You are watching all bug changes.



More information about the wine-bugs mailing list