You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The addresses of the corresponding cstdlib maths functions are not added to FUNCTION_TABLE. This causes any dereferenced function pointer to a cstdlib maths function to die.
$ cat test.c
#include <math.h>#include <stdio.h>
int
main(void) {
float (*fn)(float) = &sqrtf;
printf("fn(10) = %f\n", fn(10));return 0;
}
$ ~/downloads/llvm-gcc-4.2-2.9.source/cbuild/install/bin/llvm-gcc -emit-llvm -c -o test.o test.c
$ ~/downloads/llvm-2.9/cbuild/Release/bin/llvm-link -o test test.o
$ ~/downloads/llvm-2.9/cbuild/Release/bin/llvm-dis -show-annotations test
$ ~/reposs/emscripten/emscripten.py test.ll > test.js
$ ~/downloads/v8/d8 test.js
test.js:727: TypeError: Property 'function sqrt() { [native code] }' of object 0,0 is not a function
var $2=FUNCTION_TABLE[$1](10);
^
TypeError: Property 'function sqrt() { [native code] }' of object 0,0 is not a function
at _main (test.js:727:33)
at Object.callMain (test.js:762:10)
at run (test.js:779:18)
at test.js:790:3
I'm going to guess they're not in FUNCTION_TABLE since they're normally dynamically linked functions. In this case however, since emscripten is providing equivalent functions for these cstdlib function calls, they should be added to FUNCTION_TABLE.
The text was updated successfully, but these errors were encountered:
The addresses of the corresponding cstdlib maths functions are not added to
FUNCTION_TABLE
. This causes any dereferenced function pointer to a cstdlib maths function to die.I'm going to guess they're not in
FUNCTION_TABLE
since they're normally dynamically linked functions. In this case however, since emscripten is providing equivalent functions for these cstdlib function calls, they should be added toFUNCTION_TABLE
.The text was updated successfully, but these errors were encountered: