Mesa (7.9): svga/drm: Optionally resolve calls to powf during link-time

Thomas Hellstrom thomash at kemper.freedesktop.org
Tue Nov 23 11:05:16 UTC 2010


Module: Mesa
Branch: 7.9
Commit: 75065b0b5581a60bdc99b890c54c9731c75eac8e
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=75065b0b5581a60bdc99b890c54c9731c75eac8e

Author: Thomas Hellstrom <thellstrom at vmware.com>
Date:   Mon Nov  8 17:10:02 2010 +0100

svga/drm: Optionally resolve calls to powf during link-time

When linked with certain builds of libstdc++, it appears like powf is resolved
by a symbol in that library. Other builds of libstdc++ doesn't contain that
symbol resulting in a linker / loader error. Optionally
resolve that symbol and replace it with calls to logf and expf.

Signed-off-by: Thomas Hellstrom <thellstrom at vmware.com>

---

 src/gallium/targets/dri-vmwgfx/Makefile   |    1 +
 src/gallium/targets/dri-vmwgfx/vmw_powf.c |   17 +++++++++++++++++
 2 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/src/gallium/targets/dri-vmwgfx/Makefile b/src/gallium/targets/dri-vmwgfx/Makefile
index 97c703b..38f7893 100644
--- a/src/gallium/targets/dri-vmwgfx/Makefile
+++ b/src/gallium/targets/dri-vmwgfx/Makefile
@@ -12,6 +12,7 @@ PIPE_DRIVERS = \
 
 C_SOURCES = \
 	target.c \
+	vmw_powf.c \
 	$(COMMON_GALLIUM_SOURCES)
 
 DRIVER_DEFINES = \
diff --git a/src/gallium/targets/dri-vmwgfx/vmw_powf.c b/src/gallium/targets/dri-vmwgfx/vmw_powf.c
new file mode 100644
index 0000000..ca5e39b
--- /dev/null
+++ b/src/gallium/targets/dri-vmwgfx/vmw_powf.c
@@ -0,0 +1,17 @@
+/**
+ * Powf may leave an unresolved symbol pointing to a libstdc++.so powf.
+ * However, not all libstdc++.so include this function, so optionally
+ * replace the powf function with calls to expf and logf.
+ */
+
+#ifdef VMW_RESOLVE_POWF
+
+extern float expf(float x);
+extern float logf(float x);
+extern float powf(float x, float y);
+
+float powf(float x, float y) {
+    return expf(logf(x)*y);
+}
+
+#endif




More information about the mesa-commit mailing list