Bug 206376 - emulators/mednafen: Fix build with clang 3.8.0 or recent versions of GCC
Summary: emulators/mednafen: Fix build with clang 3.8.0 or recent versions of GCC
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Jose Alonso Cardenas Marquez
URL:
Keywords: patch, patch-ready
Depends on:
Blocks:
 
Reported: 2016-01-18 18:54 UTC by Dimitry Andric
Modified: 2016-05-05 13:43 UTC (History)
2 users (show)

See Also:
bugzilla: maintainer-feedback? (acm)
koobs: merge-quarterly?


Attachments
Use local asm labels to prevent problems with unrolling (1.87 KB, patch)
2016-01-18 18:54 UTC, Dimitry Andric
no flags Details | Diff
Upgrade emulators/mednafen to 0.9.38.7 (2.99 KB, patch)
2016-02-19 05:07 UTC, Mikhail Teterin
mi: maintainer-approval? (acm)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dimitry Andric freebsd_committer 2016-01-18 18:54:08 UTC
Created attachment 165773 [details]
Use local asm labels to prevent problems with unrolling

During the exp-run in bug 206074, it was found that emulators/mednafen gives errors with a recent clang 3.8.0 snapshot [1]:

    OwlResampler.cpp:447:39: error: invalid symbol redefinition
    "movups  0(%%" X86_REGC "di), %%xmm0\n\t"
                                      ^
    <inline asm>:7:2: note: instantiated into assembly here
            SSE_Loop:
            ^

This is because a named asm label should not be used in an inline function.  If the function is used while unrolling a loop, as in this case, it will lead to duplicated asm labels.  Note that gcc 4.7 and higher also complain similarly, when used with optimization.

The fix is to use a local label, "1:", and jump to it using "jnz 1b".

[1] http://package18.nyi.freebsd.org/data/headamd64PR206074-default/2016-01-15_15h26m58s/logs/errors/libxul-38.5.2.log
Comment 1 Mikhail Teterin freebsd_committer 2016-02-19 05:07:24 UTC
Created attachment 167165 [details]
Upgrade emulators/mednafen to 0.9.38.7

After upgrading the port to the currently-latest version 0.9.38.7 I was able to build it using clang38 without having to patch the assembly-code.

Not sure, if this really obsoletes Dimitry's patch...
Comment 2 Jose Alonso Cardenas Marquez freebsd_committer 2016-05-05 13:43:26 UTC
emulators/mednafen was updated to 0.9.38.7. Thanks!