[Mesa-dev] [PATCH 4/9] prog; add weak _mesa_error_no_memory() symbol and add it to libglsl_util
Emil Velikov
emil.l.velikov at gmail.com
Wed Apr 15 07:08:05 PDT 2015
Rather than forcing everyone to provide their own definition of the symbol
provide a common weak one, which anyone can override if needed.
This resolved the build of the standalone pipe-drivers, as it provides a
default symbol which was missing previously.
Cc: Rob Clark <robclark at freedesktop.org>
Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
---
src/Makefile.am | 3 ++-
src/glsl/SConscript | 2 ++
src/mesa/Android.libmesa_glsl_utils.mk | 6 ++++--
src/mesa/program/weak_errors.c | 30 ++++++++++++++++++++++++++++++
4 files changed, 38 insertions(+), 3 deletions(-)
create mode 100644 src/mesa/program/weak_errors.c
diff --git a/src/Makefile.am b/src/Makefile.am
index 18cb4ce..461da27 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -72,4 +72,5 @@ noinst_LTLIBRARIES = libglsl_util.la
libglsl_util_la_SOURCES = \
mesa/main/imports.c \
mesa/program/prog_hash_table.c \
- mesa/program/symbol_table.c
+ mesa/program/symbol_table.c \
+ mesa/program/weak_errors.c
diff --git a/src/glsl/SConscript b/src/glsl/SConscript
index 284b375..d18a8a7 100644
--- a/src/glsl/SConscript
+++ b/src/glsl/SConscript
@@ -71,6 +71,7 @@ env.Command('imports.c', '#src/mesa/main/imports.c', Copy('$TARGET', '$SOURCE'))
env.Prepend(CPPPATH = ['#src/mesa/program'])
env.Command('prog_hash_table.c', '#src/mesa/program/prog_hash_table.c', Copy('$TARGET', '$SOURCE'))
env.Command('symbol_table.c', '#src/mesa/program/symbol_table.c', Copy('$TARGET', '$SOURCE'))
+env.Command('weak_errors.c', '#src/mesa/program/weak_errors.c', Copy('$TARGET', '$SOURCE'))
compiler_objs = env.StaticObject(source_lists['GLSL_COMPILER_CXX_FILES'])
@@ -78,6 +79,7 @@ mesa_objs = env.StaticObject([
'imports.c',
'prog_hash_table.c',
'symbol_table.c',
+ 'weak_errors.c',
])
compiler_objs += mesa_objs
diff --git a/src/mesa/Android.libmesa_glsl_utils.mk b/src/mesa/Android.libmesa_glsl_utils.mk
index a9f6ff5..08786e3 100644
--- a/src/mesa/Android.libmesa_glsl_utils.mk
+++ b/src/mesa/Android.libmesa_glsl_utils.mk
@@ -43,7 +43,8 @@ LOCAL_C_INCLUDES := \
LOCAL_SRC_FILES := \
main/imports.c \
program/prog_hash_table.c \
- program/symbol_table.c
+ program/symbol_table.c \
+ program/weak_errors.c
include $(MESA_COMMON_MK)
include $(BUILD_STATIC_LIBRARY)
@@ -66,7 +67,8 @@ LOCAL_C_INCLUDES := \
LOCAL_SRC_FILES := \
main/imports.c \
program/prog_hash_table.c \
- program/symbol_table.c
+ program/symbol_table.c \
+ program/weak_errors.c
include $(MESA_COMMON_MK)
include $(BUILD_HOST_STATIC_LIBRARY)
diff --git a/src/mesa/program/weak_errors.c b/src/mesa/program/weak_errors.c
new file mode 100644
index 0000000..85c35dc
--- /dev/null
+++ b/src/mesa/program/weak_errors.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright © 2014 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+#include <stdio.h>
+#include "main/errors.h"
+
+__attribute__((weak)) void
+_mesa_error_no_memory(const char *caller)
+{
+ fprintf(stderr, "Mesa error: out of memory in %s", caller);
+}
--
2.3.5
More information about the mesa-dev
mailing list