[Mesa-dev] [PATCH 2/5] android: radeonsi: fix building error in si_shader.c

Mauro Rossi issor.oruam at gmail.com
Mon Feb 1 22:37:41 UTC 2016


Bionic does not support strchrnul() function,
causing the following building error:

external/mesa/src/gallium/drivers/radeonsi/si_shader.c:3863: error: undefined reference to 'strchrnul'
collect2: error: ld returned 1 exit status

This patch embeds the code of strchrnul() in si_shader.c,
in the same way described here:

http://lists.freedesktop.org/archives/piglit/2013-February/004798.html
---
 src/gallium/drivers/radeonsi/si_shader.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c
index 2192b21..3717cfa 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -49,6 +49,24 @@
 
 #include <errno.h>
 
+#if defined(__ANDROID__)
+/*
+ * Android Bionic has no strchrnul, which is used in si_shader_dump_disassembly(),
+ * so we must fill in an implementation.
+ */
+char *
+strchrnul(const char *s, int c)
+{
+	char * result = strchr(s, c);
+
+	if (result == NULL) {
+		result = s + strlen(s);
+	}
+
+	return result;
+}
+#endif /* __ANDROID__ */
+
 static const char *scratch_rsrc_dword0_symbol =
 	"SCRATCH_RSRC_DWORD0";
 
-- 
2.5.0



More information about the mesa-dev mailing list