emscripten-core / emscripten-core/emscripten
Could emscripten report the usage of unsupported features in object files?
- Dominant language
- C++
- Stars
- 27.6k
- Forks
- 3.6k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 105
Description
Imagine you have a larger project made up the whole lot of libraries and object files.
If any one of them uses a feature that is not supported by the target engines it would be nice the linker could report it.
The linker (wasm-ld) does support `--features` to limit the features used. Perhaps emsripten could construct a superset of all supported features (based on target engines) and pass that the linker.
For example:
```
$ emcc ~/test/hello.c -Wl,--features=foo
wasm-ld: error: Target feature 'call-indirect-overlong' used by /tmp/emscripten_temp_y8l17itj/hello.o is not allowed.
wasm-ld: error: Target feature 'nontrapping-fptoint' used by /tmp/emscripten_temp_y8l17itj/hello.o is not allowed.
wasm-ld: error: Target feature 'mutable-globals' used by /tmp/emscripten_temp_y8l17itj/hello.o is not allowed.
wasm-ld: error: Target feature 'reference-types' used by /tmp/emscripten_temp_y8l17itj/hello.o is not allowed.
wasm-ld: error: Target feature 'bulk-memory' used by /tmp/emscripten_temp_y8l17itj/hello.o is not allowed.
wasm-ld: error: Target feature 'multivalue' used by /tmp/emscripten_temp_y8l17itj/hello.o is not allowed.
wasm-ld: error: Target feature 'sign-ext' used by /tmp/emscripten_temp_y8l17itj/hello.o is not allowed.
wasm-ld: error: Target feature 'bulk-memory-opt' used by /tmp/emscripten_temp_y8l17itj/hello.o is not allowed.
emcc: error: '/usr/local/google/home/sbc/dev/wasm/llvm-build/bin/wasm-ld -o a.out.wasm /tmp/tmpomytea90libemscripten_js_symbols.so -Bstatic --strip-debug --export=emscripten_stack_get_end --export=emscripten_stack_get_free --export=emscripten_stack_get_base --export=emscripten_stack_get_current --export=emscripten_stack_init --export=_emscripten_stack_alloc --export=__wasm_call_ctors --export=_emscripten_stack_restore --export-if-defined=__start_em_asm --export-if-defined=__stop_em_asm --export-if-defined=__start_em_lib_deps --export-if-defined=__stop_em_lib_deps --export-if-defined=__start_em_js --export-if-defined=__stop_em_js --export-if-defined=main --export-if-defined=__main_argc_argv --export-if-defined=fflush --export-table -z stack-size=65536 --no-growable-memory --initial-heap=16777216 --no-entry --stack-first --table-base=1 /tmp/emscripten_temp_y8l17itj/hello.o --features=foo -L/usr/local/google/home/sbc/dev/wasm/emscripten/cache/sysroot/lib/wasm32-emscripten -L/usr/local/google/home/sbc/dev/wasm/emscripten/src/lib -lGL-getprocaddr -lal -lhtml5 -lstubs-debug -lnoexit -lc-debug -ldlmalloc-debug -lclang_rt.builtins -lc++-debug-noexcept -lc++abi-debug-noexcept -lsockets -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr' failed (returned 1)
```
See https://github.com/WebAssembly/wabt/issues/2779
Contributor guide
Research direction
Start by tracing the emcc linker invocation shown in the issue and how target engines are represented. Read the existing integration with wasm-ld's --features option and determine how a superset of supported features could be passed. Done means object files using unsupported features produce linker diagnostics for the selected target engines.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, wasm
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100