Skip to content

Commit

Permalink
Add random_get and disable LTO on app for now
Browse files Browse the repository at this point in the history
  • Loading branch information
Namaneo committed Aug 5, 2024
1 parent 3581539 commit 837a32e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions GNUmakefile.common
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ ifeq ($(DEBUG), 1)
DEFINES += -O0 -ferror-limit=0 -DDEBUG
LDFLAGS += -O0 -g -Wl,--error-limit=0
else
DEFINES += -O3 -flto -msimd128
LDFLAGS += -O3 -flto -mavx -mfpu=neon
DEFINES += -O3 -msimd128
LDFLAGS += -O3 -mavx -mfpu=neon
endif

CC := $(WASI_SDK)/bin/clang $(DEFINES)
Expand Down
5 changes: 5 additions & 0 deletions ui/sources/services/wasi.js
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,11 @@ export default class WASI {
sched_yield: () => {
return this.#WASI_ERRNO_SUCCESS;
},
random_get: (buf, buf_len, a) => {
const values = crypto.getRandomValues(new Uint8Array(buf_len));
new Uint8Array(this.#memory.buffer, buf, buf_len).set(values);
return this.#WASI_ERRNO_SUCCESS;
},
};
}
}

0 comments on commit 837a32e

Please sign in to comment.