diff options
-rwxr-xr-x | emscripten.py | 14 | ||||
-rw-r--r-- | src/intertyper.js | 2 | ||||
-rw-r--r-- | system/include/libc/sys/signal.h | 2 | ||||
-rw-r--r-- | system/include/libc/time.h | 2 | ||||
-rw-r--r-- | system/include/sys/poll.h | 4 | ||||
-rw-r--r-- | tests/cases/unannotated.ll | 2 | ||||
-rw-r--r-- | tools/file2json.py | 6 | ||||
-rw-r--r-- | tools/make_file.py | 3 |
8 files changed, 29 insertions, 6 deletions
diff --git a/emscripten.py b/emscripten.py index b048733b..69e2d8cb 100755 --- a/emscripten.py +++ b/emscripten.py @@ -1,5 +1,19 @@ #!/usr/bin/python +''' +Run with -h to see usage options. + +Notes: + + * Emscripten expects the .ll input to be formatted and annotated the way + + llvm-dis -show-annotations + + does. So if you get .ll from something else, you should run it through + llvm-as (to generate LLVM bitcode) and then llvm-dis -show-annotations + (to get properly formatted and annotated .ll). +''' + import json import optparse import os diff --git a/src/intertyper.js b/src/intertyper.js index 8b889b80..069ef354 100644 --- a/src/intertyper.js +++ b/src/intertyper.js @@ -864,7 +864,7 @@ function intertyper(data, parseFunctions, baseLineNum) { // external function stub substrate.addActor('External', { processItem: function(item) { - if (item.tokens[1].text in LLVM.LINKAGES || item.tokens[1].text in LLVM.PARAM_ATTR || item.tokens[1].text in LLVM.VISIBILITIES || item.tokens[1].text in LLVM.CALLING_CONVENTIONS) { + while (item.tokens[1].text in LLVM.LINKAGES || item.tokens[1].text in LLVM.PARAM_ATTR || item.tokens[1].text in LLVM.VISIBILITIES || item.tokens[1].text in LLVM.CALLING_CONVENTIONS) { item.tokens.splice(1, 1); } var params = parseParamTokens(item.tokens[3].item.tokens); diff --git a/system/include/libc/sys/signal.h b/system/include/libc/sys/signal.h index 8aaf9d58..e1c2b34a 100644 --- a/system/include/libc/sys/signal.h +++ b/system/include/libc/sys/signal.h @@ -135,7 +135,7 @@ int _EXFUN(pthread_sigmask, (int how, const sigset_t *set, sigset_t *oset)); #endif /* protos for functions found in winsup sources for CYGWIN */ -#if defined(__CYGWIN__) || defined(__rtems__) +#if defined(EMSCRIPTEN) || defined(__CYGWIN__) || defined(__rtems__) #undef sigaddset #undef sigdelset #undef sigemptyset diff --git a/system/include/libc/time.h b/system/include/libc/time.h index 019dd872..3f167556 100644 --- a/system/include/libc/time.h +++ b/system/include/libc/time.h @@ -138,7 +138,7 @@ extern __IMPORT char *_tzname[2]; #include <cygwin/time.h> #endif /*__CYGWIN__*/ -#if defined(_POSIX_TIMERS) +#if defined(EMSCRIPTEN) || defined(_POSIX_TIMERS) #include <signal.h> diff --git a/system/include/sys/poll.h b/system/include/sys/poll.h index e72ac26f..55e85237 100644 --- a/system/include/sys/poll.h +++ b/system/include/sys/poll.h @@ -18,7 +18,9 @@ struct pollfd { short revents; }; -int poll(struct pollfd *data, int num, int extra); +typedef unsigned int nfds_t; + +int poll(struct pollfd *data, nfds_t num, int extra); #ifdef __cplusplus } diff --git a/tests/cases/unannotated.ll b/tests/cases/unannotated.ll index 96ce5468..50cd4bf0 100644 --- a/tests/cases/unannotated.ll +++ b/tests/cases/unannotated.ll @@ -4,6 +4,8 @@ target triple = "i386-unknown-linux-gnu" @.str = private unnamed_addr constant [6 x i8] c"test\0A\00" +declare hidden zeroext i1 @_OptionParser(i8*, i8) ; separate test: check that we can compile this line (zeroext confused us) + define i32 @main() nounwind { %1 = alloca i32, align 4 store i32 0, i32* %1 diff --git a/tools/file2json.py b/tools/file2json.py index 65547e72..a1c37244 100644 --- a/tools/file2json.py +++ b/tools/file2json.py @@ -22,5 +22,9 @@ while len(sdata) > 0: if len(sdata) > 0: lined += ['\n'] json = '[' + ''.join(lined) + ']' -print json + +if len(sys.argv) < 3: + print json +else: + print 'var ' + sys.argv[2] + '=' + json + ';' diff --git a/tools/make_file.py b/tools/make_file.py index 9568ff40..6885610d 100644 --- a/tools/make_file.py +++ b/tools/make_file.py @@ -7,8 +7,9 @@ that and make a proper file out of it import os, sys, re data = open(sys.argv[1], 'r').read() -m = re.search('\[[\d, ]*\]', data) +m = re.search('\[[\d, -]*\]', data) data = eval(m.group(0)) +data = [x&0xff for x in data] string = ''.join([chr(item) for item in data]) out = open(sys.argv[1]+'.raw', 'wb') print data[0:80] |