[Bug 196014] New: [patch] unbreak graphics/OpenEXR build when CPUTYPE is set when building with gcc on i386

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Tue Dec 16 08:29:20 UTC 2014


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=196014

            Bug ID: 196014
           Summary: [patch] unbreak graphics/OpenEXR build when CPUTYPE is
                    set when building with gcc on i386
           Product: Ports Tree
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: Individual Port(s)
          Assignee: mandree at FreeBSD.org
          Reporter: truckman at FreeBSD.org
          Assignee: mandree at FreeBSD.org
             Flags: maintainer-feedback?(mandree at FreeBSD.org)

Created attachment 150626
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=150626&action=edit
patch to unbreak graphics/OpenEXR build when CPUTYPE is set

If CPUTYPE is set in make.conf to a value that enables SSE2 when building
graphics/OpenEXR with gcc on i386, the build fails with this error:

gcc48 -MT ImfSystemSpecific.lo -MD -MP -MF .deps/ImfSystemSpecific.Tpo -c
ImfSystemSpecific.cpp  -fPIC -DPIC -o .libs/ImfSystemSpecific.o
libtool: compile:  g++48 -DHAVE_CONFIG_H -I. -I../config -I.. -I../config
-pthread -I/usr/local/include/OpenEXR -I. -I../IlmImf -pipe -O2 -pipe
-march=pentium-m -Wl,-rpath=/usr/local/lib/gcc48 -fno-strict-aliasing
-Wl,-rpath=/usr/local/lib/gcc48 -MT ImfCompositeDeepScanLine.lo -MD -MP -MF
.deps/ImfCompositeDeepScanLine.Tpo -c ImfCompositeDeepScanLine.cpp -o
ImfCompositeDeepScanLine.o >/dev/null 2>&1
ImfSystemSpecific.cpp: In constructor 'Imf_2_2::CpuId::CpuId()':
ImfSystemSpecific.cpp:51:29: error: inconsistent operand constraints in an
'asm'
             : /* Clobber */);
                             ^
ImfSystemSpecific.cpp:51:29: error: inconsistent operand constraints in an
'asm'
             : /* Clobber */);
                             ^
Makefile:669: recipe for target 'ImfSystemSpecific.lo' failed
gmake[2]: *** [ImfSystemSpecific.lo] Error 1


The problem is in this block of code:

#if defined(IMF_HAVE_SSE2) &&  defined(__GNUC__)

    // Helper functions for gcc + SSE enabled
    void cpuid(int n, int &eax, int &ebx, int &ecx, int &edx)
    {
        __asm__ __volatile__ (
            "cpuid"
            : /* Output  */ "=a"(eax), "=b"(ebx), "=c"(ecx), "=d"(edx)
            : /* Input   */ "a"(n)
            : /* Clobber */);
    }

#else // IMF_HAVE_SSE2 && __GNUC__

The problem is that this code is clobbering the ebx register which is reserved
for the global offset table when compiling -fPIC on i386.

The attached patch reimplments the cpuid() function using __cpuid() from the
gcc include file <cpuid.h> in place of the inline asm.

See also: <https://github.com/openexr/openexr/issues/128>

--- Comment #1 from Bugzilla Automation <bugzilla at FreeBSD.org> ---
Auto-assigned to maintainer mandree at FreeBSD.org

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-ports-bugs mailing list