summaryrefslogtreecommitdiffstats
path: root/src/gallium/targets/dri-vmwgfx/vmw_powf.c
diff options
context:
space:
mode:
authorThomas Hellstrom <[email protected]>2010-11-08 17:10:02 +0100
committerThomas Hellstrom <[email protected]>2010-11-09 12:31:25 +0100
commit0d5b4b320cf1acde5ff02e9fca696239f5dd3fe4 (patch)
treec4faef8774d953b54ef392b7ecce2ad13d8eb648 /src/gallium/targets/dri-vmwgfx/vmw_powf.c
parent8e630fad7260ea9e0c2792f4424a0c1ab0353cc9 (diff)
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 <[email protected]>
Diffstat (limited to 'src/gallium/targets/dri-vmwgfx/vmw_powf.c')
-rw-r--r--src/gallium/targets/dri-vmwgfx/vmw_powf.c17
1 files changed, 17 insertions, 0 deletions
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 00000000000..ca5e39b389a
--- /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