ghc-toolchain: Javascript configuration differences
When configuring using ghc-toolchain we report the following differences.
< { ccLinkProgram = Program {prgPath = "/emsdk/upstream/emscripten/emcc", prgFlags = []}
---
> { ccLinkProgram = Program {prgPath = "/emsdk/upstream/emscripten/emcc", prgFlags = ["--target=javascript-unknown-ghcjs","-fuse-ld=gold"]}
24c24
< , ccLinkIsGnu = True
---
> , ccLinkIsGnu = False
-
ccLinkIsGnu
is reported differently because ghc-toolchain checks the flag by passing-Wl,--version
to the C compiler. In the configure script $LD is invoked directly, which also resolves toemcc
and so produces different output which mentions GNU.
ghc@bc33db5c0df4:~/ghc$ /emsdk/upstream/emscripten/emcc --version
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.40 (5c27e79dd0a9c4e27ef2326841698cdd4f6b5784)
Copyright (C) 2014 the Emscripten authors (see AUTHORS.txt)
This is free and open source software under the MIT license.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
ghc@bc33db5c0df4:~/ghc$ /emsdk/upstream/emscripten/emcc -Wl,--version
LLD 17.0.0
- With
configure
we conclude thatemcc
doesn't support--target
when used as a linker
ghc@bc33db5c0df4:~/ghc$ /emsdk/upstream/emscripten/emcc -Werror --target=javascript-unknown-ghcjs -o test test.o main.o -v
"/emsdk/upstream/bin/clang" --version
"/emsdk/upstream/bin/wasm-ld" -o test.wasm test.o main.o -L/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten -lGL -lal -lhtml5 -lstubs-debug -lnoexit -lc-debug -ldlmalloc -lcompiler_rt -lc++-noexcept -lc++abi-debug-noexcept -lsockets -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr /tmp/tmpcvkawm1glibemscripten_js_symbols.so --strip-debug --export-if-defined=main --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_argc_argv --export-if-defined=fflush --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=stackSave --export=stackRestore --export=stackAlloc --export=__errno_location --export=__get_temp_ret --export=__set_temp_ret --export=__wasm_call_ctors --export-table -z stack-size=65536 --initial-memory=16777216 --no-entry --max-memory=16777216 --stack-first
"/emsdk/upstream/bin/wasm-emscripten-finalize" --dyncalls-i64 --pass-arg=legalize-js-interface-exported-helpers test.wasm -o test.wasm --detect-features
"/emsdk/node/15.14.0_64bit/bin/node" /emsdk/upstream/emscripten/src/compiler.js /tmp/tmpbdm72vdi.json
"/emsdk/upstream/bin/llvm-objcopy" test.wasm test.wasm --remove-section=.debug* --remove-section=producers
but the flag seems to just be ignored. With configure we just check whether the C compiler supports -target
, (which does produce an error).