Also add the +mutable-globals features in clang when
when building with -fPIC since the linker will generate mutable
globals imports and exports in that case.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Discussed offline and decided that it would be better to error out in the linker and depend on the frontend to generate the necessary features based on flags like -mmutable-globals or -fPIC.
clang/lib/Driver/ToolChains/WebAssembly.cpp | ||
---|---|---|
246–252 ↗ | (On Diff #291317) | This should also check that the user didn't pass options::OPT_mno_mutable_globals and a test should be added in clang/test/Driver/wasm-toolchain.c. |
lld/wasm/Writer.cpp | ||
499 | could this if (sym->isExported()) be turned into an assert(sym->isExported())? |
lld/wasm/Writer.cpp | ||
---|---|---|
499 | I don't think so. What about regular internal globals that are neither imported nor exported? Unless I'm missing something? |
clang/lib/Driver/ToolChains/WebAssembly.cpp | ||
---|---|---|
246–252 ↗ | (On Diff #291317) | Sorry, I meant that if the user passes -fPIC as well as -mno-mutable-globals, we should give them a diag::err_drv_argument_not_allowed_with error, like we do above for -pthread features and below for -fwasm-exceptions features, |
lld/wasm/Writer.cpp | ||
499 | Ah, makes sense. |
could this if (sym->isExported()) be turned into an assert(sym->isExported())?