The cirros image was rebuilt against the 3.13.0-83 kernel, drivers e1000e, igbvf...
[packages/trusty/cirros-testvm.git] / cirros-testvm / src-cirros / buildroot-2015.05 / package / x11r7 / xserver_xorg-server / 1.17.1 / 0001-backtrace.c-Fix-word-cast-to-a-pointer.patch
1 backtrace.c: Fix word cast to a pointer
2
3 This patch fixes a compilation problem of Xorg + libunwind support when
4 building it on MIPS variants with 32-bit pointers.
5
6 Related:
7
8   http://lists.busybox.net/pipermail/buildroot/2014-December/114404.html
9
10 Patch submitted upstream:
11
12   http://lists.x.org/archives/xorg-devel/2015-January/045226.html
13
14 Patch reviewed by an Xorg developer:
15
16   http://lists.x.org/archives/xorg-devel/2015-January/045383.html
17
18 Signed-off-by: Vicente Olivert Riera <Vincent.Riera@imgtec.com>
19
20 From 84f04e0274661401a91efd4e9b21dccc1396e1d6 Mon Sep 17 00:00:00 2001
21 From: Vicente Olivert Riera <Vincent.Riera@imgtec.com>
22 Date: Wed, 3 Dec 2014 11:34:47 +0000
23 Subject: [PATCH] backtrace.c: Fix word cast to a pointer
24
25 backtrace.c uses a word size provided by libunwind. In some
26 architectures like MIPS, libunwind makes that word size 64-bit for all
27 variants of the architecture.
28
29 In the lines #90 and #98, backtrace.c tries to do a cast to a pointer,
30 which fails in all MIPS variants with 32-bit pointers, like MIPS32 or
31 MIPS64 n32, because it's trying to do a cast from a 64-bit wide variable
32 to a 32-bit pointer:
33
34 Making all in os
35 make[2]: Entering directory
36 `/home/test/test/1/output/build/xserver_xorg-server-1.15.1/os'
37   CC     WaitFor.lo
38   CC     access.lo
39   CC     auth.lo
40   CC     backtrace.lo
41 backtrace.c: In function 'xorg_backtrace':
42 backtrace.c:90:20: error: cast to pointer from integer of different size
43 [-Werror=int-to-pointer-cast]
44          if (dladdr((void *)(pip.start_ip + off), &dlinfo) &&
45 dlinfo.dli_fname &&
46                     ^
47 backtrace.c:98:13: error: cast to pointer from integer of different size
48 [-Werror=int-to-pointer-cast]
49              (void *)(pip.start_ip + off));
50              ^
51 cc1: some warnings being treated as errors
52 make[2]: *** [backtrace.lo] Error 1
53 make[2]: *** Waiting for unfinished jobs....
54
55 Making the cast to a pointer-sized integer, and then to a pointer fixes
56 the problem.
57
58 Related:
59   https://bugs.freedesktop.org/show_bug.cgi?id=79939
60
61 Signed-off-by: Vicente Olivert Riera <Vincent.Riera@imgtec.com>
62 ---
63  os/backtrace.c |    4 ++--
64  1 files changed, 2 insertions(+), 2 deletions(-)
65
66 diff --git a/os/backtrace.c b/os/backtrace.c
67 index 3d1195b..fd129ef 100644
68 --- a/os/backtrace.c
69 +++ b/os/backtrace.c
70 @@ -87,7 +87,7 @@ xorg_backtrace(void)
71              procname[1] = 0;
72          }
73  
74 -        if (dladdr((void *)(pip.start_ip + off), &dlinfo) && dlinfo.dli_fname &&
75 +        if (dladdr((void *)(uintptr_t)(pip.start_ip + off), &dlinfo) && dlinfo.dli_fname &&
76                  *dlinfo.dli_fname)
77              filename = dlinfo.dli_fname;
78          else
79 @@ -95,7 +95,7 @@ xorg_backtrace(void)
80  
81          ErrorFSigSafe("%u: %s (%s%s+0x%x) [%p]\n", i++, filename, procname,
82              ret == -UNW_ENOMEM ? "..." : "", (int)off,
83 -            (void *)(pip.start_ip + off));
84 +            (void *)(uintptr_t)(pip.start_ip + off));
85  
86          ret = unw_step(&cursor);
87          if (ret < 0)
88 -- 
89 1.7.1
90