Discussion:
[Pixman] [Patch] Fix pixman build with clang
Manoj Gupta
2017-12-08 23:32:41 UTC
Permalink
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.

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)
{

Thanks,
Manoj
Emil Velikov
2017-12-12 15:26:58 UTC
Permalink
Post by Manoj Gupta
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
Manoj Gupta
2017-12-12 22:27:01 UTC
Permalink
Thanks Emil,

I see that this is indeed fixed in master. There is another problem with
__builtin_shuffle though which clang doesn't support.
Post by Emil Velikov
Post by Manoj Gupta
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
Loading...