diff options
author | Khem Raj <raj.khem@gmail.com> | 2016-07-29 21:50:46 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-08-04 15:22:21 +0100 |
commit | d4040da8bc23e6c289cc8f2ca6d43deb06acf7d6 (patch) | |
tree | 8839ad18670bd33550379f04f9517e7bb3e44ec8 /meta/recipes-graphics/mesa | |
parent | 50008ffeb95901a430160003c5823676b52615a6 (diff) | |
download | poky-d4040da8bc23e6c289cc8f2ca6d43deb06acf7d6.tar.gz |
mesa: Fix build when cross compiling with clang
(From OE-Core rev: 69e9b190ff0e8b963bbaea8365917218cf3c2558)
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-graphics/mesa')
3 files changed, 147 insertions, 0 deletions
diff --git a/meta/recipes-graphics/mesa/files/clang-compile-PR89599.patch b/meta/recipes-graphics/mesa/files/clang-compile-PR89599.patch new file mode 100644 index 0000000000..48bd32567c --- /dev/null +++ b/meta/recipes-graphics/mesa/files/clang-compile-PR89599.patch | |||
@@ -0,0 +1,116 @@ | |||
1 | From 5ec140c17b54c25920091501b665b9aa809cc5e8 Mon Sep 17 00:00:00 2001 | ||
2 | From: Matt Turner <mattst88@gmail.com> | ||
3 | Date: Mon, 11 Jul 2016 10:44:25 -0700 | ||
4 | Subject: mapi: Massage code to allow clang to compile. | ||
5 | MIME-Version: 1.0 | ||
6 | Content-Type: text/plain; charset=UTF-8 | ||
7 | Content-Transfer-Encoding: 8bit | ||
8 | |||
9 | According to https://llvm.org/bugs/show_bug.cgi?id=19778#c3 this code | ||
10 | was violating the spec, resulting in it failing to compile. | ||
11 | |||
12 | Cc: mesa-stable@lists.freedesktop.org | ||
13 | Co-authored-by: Tomasz Paweł Gajc <tpgxyz@gmail.com> | ||
14 | Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89599 | ||
15 | Reviewed-by: Emil Velikov <emil.velikov@collabora.com> | ||
16 | |||
17 | Upstream-Status: Backport | ||
18 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
19 | |||
20 | diff --git a/configure.ac b/configure.ac | ||
21 | index 3799d8d..1ca8359 100644 | ||
22 | --- a/configure.ac | ||
23 | +++ b/configure.ac | ||
24 | @@ -226,6 +226,7 @@ AX_GCC_FUNC_ATTRIBUTE([packed]) | ||
25 | AX_GCC_FUNC_ATTRIBUTE([pure]) | ||
26 | AX_GCC_FUNC_ATTRIBUTE([returns_nonnull]) | ||
27 | AX_GCC_FUNC_ATTRIBUTE([unused]) | ||
28 | +AX_GCC_FUNC_ATTRIBUTE([visibility]) | ||
29 | AX_GCC_FUNC_ATTRIBUTE([warn_unused_result]) | ||
30 | AX_GCC_FUNC_ATTRIBUTE([weak]) | ||
31 | |||
32 | diff --git a/src/mapi/entry_x86-64_tls.h b/src/mapi/entry_x86-64_tls.h | ||
33 | index 38faccc..c5262a1 100644 | ||
34 | --- a/src/mapi/entry_x86-64_tls.h | ||
35 | +++ b/src/mapi/entry_x86-64_tls.h | ||
36 | @@ -25,6 +25,11 @@ | ||
37 | * Chia-I Wu <olv@lunarg.com> | ||
38 | */ | ||
39 | |||
40 | +#ifdef HAVE_FUNC_ATTRIBUTE_VISIBIITY | ||
41 | +#define HIDDEN __attribute__((visibility("hidden"))) | ||
42 | +#else | ||
43 | +#define HIDDEN | ||
44 | +#endif | ||
45 | |||
46 | __asm__(".text\n" | ||
47 | ".balign 32\n" | ||
48 | @@ -54,8 +59,8 @@ entry_patch_public(void) | ||
49 | { | ||
50 | } | ||
51 | |||
52 | -static char | ||
53 | -x86_64_entry_start[]; | ||
54 | +extern char | ||
55 | +x86_64_entry_start[] HIDDEN; | ||
56 | |||
57 | mapi_func | ||
58 | entry_get_public(int slot) | ||
59 | diff --git a/src/mapi/entry_x86_tls.h b/src/mapi/entry_x86_tls.h | ||
60 | index 46d2ece..231b409 100644 | ||
61 | --- a/src/mapi/entry_x86_tls.h | ||
62 | +++ b/src/mapi/entry_x86_tls.h | ||
63 | @@ -27,6 +27,12 @@ | ||
64 | |||
65 | #include <string.h> | ||
66 | |||
67 | +#ifdef HAVE_FUNC_ATTRIBUTE_VISIBIITY | ||
68 | +#define HIDDEN __attribute__((visibility("hidden"))) | ||
69 | +#else | ||
70 | +#define HIDDEN | ||
71 | +#endif | ||
72 | + | ||
73 | __asm__(".text"); | ||
74 | |||
75 | __asm__("x86_current_tls:\n\t" | ||
76 | @@ -71,8 +77,8 @@ __asm__(".text"); | ||
77 | extern unsigned long | ||
78 | x86_current_tls(); | ||
79 | |||
80 | -static char x86_entry_start[]; | ||
81 | -static char x86_entry_end[]; | ||
82 | +extern char x86_entry_start[] HIDDEN; | ||
83 | +extern char x86_entry_end[] HIDDEN; | ||
84 | |||
85 | void | ||
86 | entry_patch_public(void) | ||
87 | diff --git a/src/mapi/entry_x86_tsd.h b/src/mapi/entry_x86_tsd.h | ||
88 | index ea7bacb..03d9735 100644 | ||
89 | --- a/src/mapi/entry_x86_tsd.h | ||
90 | +++ b/src/mapi/entry_x86_tsd.h | ||
91 | @@ -25,6 +25,11 @@ | ||
92 | * Chia-I Wu <olv@lunarg.com> | ||
93 | */ | ||
94 | |||
95 | +#ifdef HAVE_FUNC_ATTRIBUTE_VISIBIITY | ||
96 | +#define HIDDEN __attribute__((visibility("hidden"))) | ||
97 | +#else | ||
98 | +#define HIDDEN | ||
99 | +#endif | ||
100 | |||
101 | #define X86_ENTRY_SIZE 32 | ||
102 | |||
103 | @@ -58,8 +63,8 @@ __asm__(".balign 32\n" | ||
104 | #include <string.h> | ||
105 | #include "u_execmem.h" | ||
106 | |||
107 | -static const char x86_entry_start[]; | ||
108 | -static const char x86_entry_end[]; | ||
109 | +extern const char x86_entry_start[] HIDDEN; | ||
110 | +extern const char x86_entry_end[] HIDDEN; | ||
111 | |||
112 | void | ||
113 | entry_patch_public(void) | ||
114 | -- | ||
115 | cgit v0.10.2 | ||
116 | |||
diff --git a/meta/recipes-graphics/mesa/files/disable-asm-on-non-gcc.patch b/meta/recipes-graphics/mesa/files/disable-asm-on-non-gcc.patch new file mode 100644 index 0000000000..d2d67558b6 --- /dev/null +++ b/meta/recipes-graphics/mesa/files/disable-asm-on-non-gcc.patch | |||
@@ -0,0 +1,29 @@ | |||
1 | Configure checks for compiler to be gcc and then it enables asm_offsets | ||
2 | generation. see | ||
3 | |||
4 | https://cgit.freedesktop.org/mesa/mesa/commit/?id=73c9b4b0e05fc66629ba250846948dc55c0e7a0d | ||
5 | |||
6 | However, we missed the check when enabling this on cross compilation | ||
7 | when architecture for both host and target is x86 | ||
8 | |||
9 | Fixes errors like | ||
10 | ./gen_matypes > matypes.h | ||
11 | /bin/bash: ./gen_matypes: No such file or directory | ||
12 | |||
13 | -Khem | ||
14 | |||
15 | Upstream-Status: Submitted | ||
16 | |||
17 | Index: mesa-12.0.1/configure.ac | ||
18 | =================================================================== | ||
19 | --- mesa-12.0.1.orig/configure.ac | ||
20 | +++ mesa-12.0.1/configure.ac | ||
21 | @@ -732,7 +732,7 @@ test "x$enable_asm" = xno && AC_MSG_RESU | ||
22 | if test "x$enable_asm" = xyes -a "x$cross_compiling" = xyes; then | ||
23 | case "$host_cpu" in | ||
24 | i?86 | x86_64 | amd64) | ||
25 | - if test "x$host_cpu" != "x$target_cpu"; then | ||
26 | + if test "x$host_cpu" != "x$target_cpu" -o "x$acv_mesa_CLANG" = xyes; then | ||
27 | enable_asm=no | ||
28 | AC_MSG_RESULT([no, cross compiling]) | ||
29 | fi | ||
diff --git a/meta/recipes-graphics/mesa/mesa_12.0.1.bb b/meta/recipes-graphics/mesa/mesa_12.0.1.bb index ad872b38ec..80189e3ff1 100644 --- a/meta/recipes-graphics/mesa/mesa_12.0.1.bb +++ b/meta/recipes-graphics/mesa/mesa_12.0.1.bb | |||
@@ -2,6 +2,8 @@ require ${BPN}.inc | |||
2 | 2 | ||
3 | SRC_URI = "ftp://ftp.freedesktop.org/pub/mesa/${PV}/mesa-${PV}.tar.xz \ | 3 | SRC_URI = "ftp://ftp.freedesktop.org/pub/mesa/${PV}/mesa-${PV}.tar.xz \ |
4 | file://replace_glibc_check_with_linux.patch \ | 4 | file://replace_glibc_check_with_linux.patch \ |
5 | file://clang-compile-PR89599.patch \ | ||
6 | file://disable-asm-on-non-gcc.patch \ | ||
5 | " | 7 | " |
6 | 8 | ||
7 | SRC_URI[md5sum] = "972fd5ad5a63aeabf173fb9adefc6522" | 9 | SRC_URI[md5sum] = "972fd5ad5a63aeabf173fb9adefc6522" |