Fix pixman build with clang

Submitted by Manoj Gupta on Dec. 8, 2017, 11:32 p.m.

Details

Message ID CAAMbb07om=e8y8HY9UQOS-r2VjcocJGcCSq7fX41OvmAWMSncg@mail.gmail.com
State New
Headers show
Series "Fix pixman build with clang" ( rev: 1 ) in Pixman

Not browsing as part of any series.

Commit Message

Manoj Gupta Dec. 8, 2017, 11:32 p.m.
Hi,

I am encountering a build issue in pixman when compiling with with clang.

pixman-mmx.c:100:20: error: constraint 'K' expects an integer constant
expression
        : "y" (__A), "K" (__N)

The error happens because __N is a function parameter and clang does not
process it as an integer literal by design. Note that even gcc cannot
handle it in -O0 mode.

This can be fixed  by forcing the macro version of the function which
exposes __N value
as an integer literal. I am making it #if 0 but it might be worthwhile to
delete the function declaration since there is no much to lose here given
all the function does is  inline asm.

 {

Thanks,
Manoj

Patch hide | download patch | download mbox

diff -Nuar old/pixman/pixman-mmx.c new/pixman/pixman-mmx.c
--- old/pixman/pixman-mmx.c
+++ new/pixman/pixman-mmx.c
@@ -89,7 +89,7 @@ 
     return __A;
 }

-#  ifdef __OPTIMIZE__
+#  if 0
 extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__,
__artificial__))
 _mm_shuffle_pi16 (__m64 __A, int8_t const __N)

Comments

On 8 December 2017 at 23:32, Manoj Gupta <manojgupta@chromium.org> wrote:
> Hi,
>
> I am encountering a build issue in pixman when compiling with with clang.
>
> pixman-mmx.c:100:20: error: constraint 'K' expects an integer constant
> expression
>         : "y" (__A), "K" (__N)
>
Seems like you guys are building some pretty old stuff ;-)

The issue was resolved upstream back in 2015 [1] and there has been a
release with said fix [2].

-Emil

[1] https://cgit.freedesktop.org/pixman/commit/?id=d24b415f3e2753a588759d028b811e1ce38fea6c
[2] https://lists.x.org/archives/xorg-announce/2015-December/002666.html
Thanks Emil,

I see that this is indeed fixed in master. There is another problem with
__builtin_shuffle though which clang doesn't support.

On Tue, Dec 12, 2017 at 7:26 AM, Emil Velikov <emil.l.velikov@gmail.com>
wrote:

> On 8 December 2017 at 23:32, Manoj Gupta <manojgupta@chromium.org> wrote:
> > Hi,
> >
> > I am encountering a build issue in pixman when compiling with with clang.
> >
> > pixman-mmx.c:100:20: error: constraint 'K' expects an integer constant
> > expression
> >         : "y" (__A), "K" (__N)
> >
> Seems like you guys are building some pretty old stuff ;-)
>
> The issue was resolved upstream back in 2015 [1] and there has been a
> release with said fix [2].
>
> -Emil
>
> [1] https://cgit.freedesktop.org/pixman/commit/?id=
> d24b415f3e2753a588759d028b811e1ce38fea6c
> [2] https://lists.x.org/archives/xorg-announce/2015-December/002666.html
>