Unlike the existing --export option this will not causes errors
or warnings if the specified symbol is not defined.
See: https://github.com/emscripten-core/emscripten/issues/13736
Differential D99887
[lld][WebAssembly] Add `--export-if-defined` sbc100 on Apr 5 2021, 9:02 AM. Authored by
Details Unlike the existing --export option this will not causes errors See: https://github.com/emscripten-core/emscripten/issues/13736
Diff Detail
Event TimelineComment Actions I dont love the name of this option.. but I failed to come up with any thing nicer. I did consider weaking the existing --export to mean "export if defined" and then requiring --require-defined (which is an existing GNU ld option) to get the stronger meaning back.. but that has two disadvantages:
Comment Actions Pre-existing, but what does --export plus --allow-undefined do?
Comment Actions I don't know wasm enough... In ELF, --export-dynamic-symbol only affects defined symbols. --export-dynamic affects all defined symbols. They don't have effect on other symbols. Comment Actions --allow-undefined will not report errors on undefined symbols at all (even those passed via --export). This is true both before and after this change. One of the reasons for this change is that we would like one day to remove --allow-undefined from emscripten by default which exposes the current limitations of --export. Comment Actions Interesting.. aside from not really conveying its meaning clearly --export-dynamic-symbol sounds like it might be what we want here. Comment Actions I think the reason is because for non-defined symbols, there is no point specifically mentioning "exported". An undefined symbol not defined anywhere or defined in a shared object is naturally exported, because otherwise it cannot be resolved to a different module at runtime. Comment Actions Going with this option over re-using --export-dynamic-symbol since the meaning doesn't quite match. |
should this comment no longer say "if its found"? If it's not found, the whole process should error, right?