-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Warn if EXPORTED_FUNCTIONS is used with MAIN_MODULE=1/SIDE_MODULE=1 #10075
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
888d94d
to
be1a264
Compare
Why is this an error? It seems quite benign and warrants a warning at most, IMO. |
I agree with @Akaricchi that this could be a warning. Perhaps an error in strict mode? Another thought, the list of exported functions is checked against to see if they exist in the output (or we warn with something like "asked to export foo() but it doesn't exist"). That might still be useful for static linking? |
OK, I'll make it warning. We already do use this for static linking to drive the "undefined function" error reporting. |
I think it warrants being at least a warning because its usage normally show a misunderstanding on the part of the user as to how MAIN_MODULE=1 and SIDE_MODULE=1 actually work. |
This kind of check also also helps developers like us to understand the codebase better. It certainly helps me reason about the meaning of EXPORTED_FUNCTIONS + SIDE_MODULE... without this change I would need to do bunch of experiments and reason to figure it out. After this change its super obvious. This is why i'm so keen to adding working when options are used that are not compatible, rather than silently accepting the bad combination. |
be1a264
to
4615da6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I agree it's good to warn about stuff like this, good idea.
tools/shared.py
Outdated
cmd += ['--export', '__wasm_call_ctors'] | ||
|
||
cmd += ['--export', '__data_end'] | ||
cmd += ['--export', '__data_end'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand it's ok to put standalone wasm in the else of LINKABLE, as we don't support linking with that mode. And exported_functions is ok to put in that else because it isn't needed when linkable. However, I'm not sure what this __data_end
thing is?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Basically because LINKABLE added --export-all
there is no point in having any --export=
flag individually. Its redundant to export all then then also export something individually in wasm-ld.
It is more link:
if exporting_everthing:
add_export_all
else:
add_export_specific
Actually I think I should hold off landing this until we figure out how we want exporting to work with dynamic linking. See #10079 |
This issue has been automatically marked as stale because there has been no activity in the past year. It will be closed automatically if no further activity occurs in the next 30 days. Feel free to re-open at any time if this issue is still relevant. |
This setting is meaningless with MAIN_MODULE=1 or SIDE_MODULE=1. Hopefully this will be a warning soon: #10075
This setting is meaningless with MAIN_MODULE=1 or SIDE_MODULE=1. Hopefully this will be a warning soon: #10075 Also avoid using C++ in some tests that don't need it.
This setting is meaningless with MAIN_MODULE=1 or SIDE_MODULE=1. Hopefully this will be a warning soon: #10075 Also avoid using C++ in some tests that don't need it.
7ec4d05
to
5521e62
Compare
5521e62
to
aa1f6c3
Compare
This setting is meaningless with MAIN_MODULE=1 or SIDE_MODULE=1. Hopefully this will be a warning soon: #10075 Also avoid using C++ in some tests that don't need it.
aa1f6c3
to
0c4f6ff
Compare
0c4f6ff
to
3410aa7
Compare
This doesn't make sense since these imply all functionm are to be exported.
3410aa7
to
f7f4a56
Compare
…mscripten-core#10075) This doesn't make sense since these imply all symbols are already exported.
This doesn't make sense since these imply all functionm are to be
exported.
The test code changes here are just to use @paramaterized.