From: Thomas Hellstrom Date: Mon, 8 Nov 2010 16:10:02 +0000 (+0100) Subject: svga/drm: Optionally resolve calls to powf during link-time X-Git-Tag: android-x86-2.2~617 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=0d5b4b320cf1acde5ff02e9fca696239f5dd3fe4;p=android-x86%2Fexternal-mesa.git 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 --- diff --git a/src/gallium/targets/dri-vmwgfx/Makefile b/src/gallium/targets/dri-vmwgfx/Makefile index 97c703b3739..38f78932e13 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 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