1From a45f6d49ec090ad94333c0865c378d2d96ab2af4 Mon Sep 17 00:00:00 2001
2From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
3Date: Mon, 15 Feb 2021 20:17:43 +0100
4Subject: [PATCH] orc/orccpu-powerpc.c: fix build with kernel < 4.11
5
6Build with powerpc and kernel < 4.11 is broken since version 0.4.30 and
7https://gitlab.freedesktop.org/gstreamer/orc/-/commit/a999325abea6a5549d60d99ddeb0271d2aa00235:
8
9FAILED: orc/liborc-0.4.so.0.32.0.p/orccpu-powerpc.c.o
10/home/giuliobenetti/autobuild/run/instance-3/output-1/host/bin/powerpc-linux-gcc -Iorc/liborc-0.4.so.0.32.0.p -Iorc -I../orc -I. -I.. -fdiagnostics-color=always -pipe -Wall -Winvalid-pch -std=gnu99 -O3 -DHAVE_CONFIG_H -fvisibility=hidden -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -fPIC -pthread -DORC_ENABLE_UNSTABLE_API -D_GNU_SOURCE -DBUILDING_ORC -MD -MQ orc/liborc-0.4.so.0.32.0.p/orccpu-powerpc.c.o -MF orc/liborc-0.4.so.0.32.0.p/orccpu-powerpc.c.o.d -o orc/liborc-0.4.so.0.32.0.p/orccpu-powerpc.c.o -c ../orc/orccpu-powerpc.c
11../orc/orccpu-powerpc.c: In function 'orc_check_powerpc_proc_auxv':
12../orc/orccpu-powerpc.c:164:21: error: 'AT_L1D_CACHESIZE' undeclared (first use in this function); did you mean 'AT_DCACHEBSIZE'?
13  164 |       if (buf[i] == AT_L1D_CACHESIZE) {
14      |                     ^~~~~~~~~~~~~~~~
15      |                     AT_DCACHEBSIZE
16../orc/orccpu-powerpc.c:164:21: note: each undeclared identifier is reported only once for each function it appears in
17../orc/orccpu-powerpc.c:168:21: error: 'AT_L2_CACHESIZE' undeclared (first use in this function); did you mean 'AT_ICACHEBSIZE'?
18  168 |       if (buf[i] == AT_L2_CACHESIZE) {
19      |                     ^~~~~~~~~~~~~~~
20      |                     AT_ICACHEBSIZE
21../orc/orccpu-powerpc.c:172:21: error: 'AT_L3_CACHESIZE' undeclared (first use in this function); did you mean 'AT_ICACHEBSIZE'?
22  172 |       if (buf[i] == AT_L3_CACHESIZE) {
23      |                     ^~~~~~~~~~~~~~~
24      |                     AT_ICACHEBSIZE
25
26Indeed, AT_{L1D,L2,L3}_CACHESIZE is only defined since kernel 4.11 and
27https://github.com/torvalds/linux/commit/98a5f361b8625c6f4841d6ba013bbf0e80d08147
28
29Fixes:
30 - http://autobuild.buildroot.org/results/0821e96cba3e455edd47b87485501d892fc7ac6a
31
32Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
33[Upstream status:
34https://gitlab.freedesktop.org/gstreamer/orc/-/merge_requests/56]
35---
36 orc/orccpu-powerpc.c | 6 ++++++
37 1 file changed, 6 insertions(+)
38
39diff --git a/orc/orccpu-powerpc.c b/orc/orccpu-powerpc.c
40index 6796f17..340cf05 100644
41--- a/orc/orccpu-powerpc.c
42+++ b/orc/orccpu-powerpc.c
43@@ -161,18 +161,24 @@ orc_check_powerpc_proc_auxv (void)
44         _orc_cpu_name = (char*)buf[i + 1];
45         found++;
46       }
47+#ifdef AT_L1D_CACHESIZE
48       if (buf[i] == AT_L1D_CACHESIZE) {
49         _orc_data_cache_size_level1 = buf[i + 1];
50         found++;
51       }
52+#endif
53+#ifdef AT_L2_CACHESIZE
54       if (buf[i] == AT_L2_CACHESIZE) {
55         _orc_data_cache_size_level2 = buf[i + 1];
56         found++;
57       }
58+#endif
59+#ifdef AT_L3_CACHESIZE
60       if (buf[i] == AT_L3_CACHESIZE) {
61         _orc_data_cache_size_level3 = buf[i + 1];
62         found++;
63       }
64+#endif
65       if (found == 6)
66         break;
67     }
68--
692.30.0
70
71