No love for PowerPC from MAME


MAME, the famous multi-system emulator, has been broken on Power ISA since around 0.194 due to a long-standing gcc bug with 128-bit long double. This bug hasn't been paid attention to in 12 years, and is rather beyond my personal ken to take a whack at as well. Near as I can determine, the issue affects every Power ISA platform with such a datatype including 32-bit, 64-bit and 64-bit little-endian.

Besides a minor fix for one of their upstream libraries on little-endian PowerPC, the most straightforward workaround to get MAME up on the Talos II is to simply use 64-bit long doubles by setting the compiler flag -mlong-double-64. This is admittedly a non-standard ABI option but appears to work just fine as the screenshot demonstrates. However, rather than allow this (hopefully temporary) workaround to fix the platform given that the gcc issue is longstanding and apparently difficult to resolve, the MAME team decided not to allow any such workaround even given that it clearly wouldn't affect anything else. It's their project, but I really think that sucks, because it means MAME won't build on any PowerPC system out of the box for the foreseeable near future.

You have two options. The first is to change the makefile and/or set the appropriate compile-time options to use clang instead of gcc. I haven't tested this and clang isn't my preferred compiler on Power ISA as it's less mature on this architecture, but it is a supported compiler at least for MAME on macOS, so it should work. You'll still need the bx patch below right now (read on) if you're building on ppc64le.

Otherwise, you can apply the patch that was rejected to get gcc builds working. You'll still need the bx portion of this diff right now for either compiler on little-endian systems, though hopefully at some future point the bx patch will be accepted upstream and merged back to MAME. Again, as a non-standard ABI there is the potential for conflict with code that may not expect the altered datatype, but this is the build I currently use myself and at least as of this writing seems to work.

Comments

  1. Note that musl *always* uses -mlong-double-64, so this should not need any compiler flags nor hacking on Adélie Linux.

    ReplyDelete
  2. https://twitter.com/gnutools/status/1076293409336451072

    ReplyDelete
    Replies
    1. Very nice. Updated and I did a successive post after a little more research based on the reply you got.

      Delete

Post a Comment

Comments are subject to moderation. Be nice.