Skip to content

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

Merged
merged 1 commit into from
Jan 20, 2022

Conversation

sbc100
Copy link
Collaborator

@sbc100 sbc100 commented Dec 18, 2019

This doesn't make sense since these imply all functionm are to be
exported.

The test code changes here are just to use @paramaterized.

@sbc100 sbc100 requested a review from kripken December 18, 2019 23:28
@sbc100 sbc100 force-pushed the export_functions_vs_linkable branch from 888d94d to be1a264 Compare December 19, 2019 04:16
@Akaricchi
Copy link
Contributor

Why is this an error? It seems quite benign and warrants a warning at most, IMO.

@kripken
Copy link
Member

kripken commented Dec 19, 2019

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?

@sbc100
Copy link
Collaborator Author

sbc100 commented Dec 19, 2019

OK, I'll make it warning.

We already do use this for static linking to drive the "undefined function" error reporting.

@sbc100
Copy link
Collaborator Author

sbc100 commented Dec 19, 2019

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.

@sbc100
Copy link
Collaborator Author

sbc100 commented Dec 19, 2019

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.

@sbc100 sbc100 force-pushed the export_functions_vs_linkable branch from be1a264 to 4615da6 Compare December 19, 2019 19:14
Copy link
Member

@kripken kripken left a 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']
Copy link
Member

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?

Copy link
Collaborator Author

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

@sbc100
Copy link
Collaborator Author

sbc100 commented Dec 20, 2019

Actually I think I should hold off landing this until we figure out how we want exporting to work with dynamic linking. See #10079

@sbc100 sbc100 closed this Jan 30, 2020
@sbc100 sbc100 reopened this Jan 30, 2020
@sbc100 sbc100 changed the base branch from incoming to master January 30, 2020 20:09
@stale
Copy link

stale bot commented Jan 31, 2021

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.

@stale stale bot added the wontfix label Jan 31, 2021
Base automatically changed from master to main March 8, 2021 23:49
@stale stale bot removed the wontfix label Mar 8, 2021
sbc100 added a commit that referenced this pull request Oct 7, 2021
This setting is meaningless with MAIN_MODULE=1 or SIDE_MODULE=1.
Hopefully this will be a warning soon:
#10075
sbc100 added a commit that referenced this pull request Oct 7, 2021
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.
sbc100 added a commit that referenced this pull request Oct 7, 2021
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.
@sbc100 sbc100 force-pushed the export_functions_vs_linkable branch from 7ec4d05 to 5521e62 Compare October 8, 2021 00:52
@sbc100 sbc100 changed the title Don't allow EXPORTED_FUNCTIONS with MAIN_MODULE=1/SIDE_MODULE=1 Warn if EXPORTED_FUNCTIONS is used with MAIN_MODULE=1/SIDE_MODULE=1 Oct 8, 2021
@sbc100 sbc100 force-pushed the export_functions_vs_linkable branch from 5521e62 to aa1f6c3 Compare October 8, 2021 05:26
sbc100 added a commit that referenced this pull request Oct 8, 2021
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.
@sbc100 sbc100 force-pushed the export_functions_vs_linkable branch from aa1f6c3 to 0c4f6ff Compare October 12, 2021 23:53
@sbc100 sbc100 force-pushed the export_functions_vs_linkable branch from 0c4f6ff to 3410aa7 Compare January 19, 2022 21:48
@sbc100 sbc100 enabled auto-merge (squash) January 19, 2022 21:50
This doesn't make sense since these imply all functionm are to be
exported.
@sbc100 sbc100 force-pushed the export_functions_vs_linkable branch from 3410aa7 to f7f4a56 Compare January 20, 2022 02:28
@sbc100 sbc100 merged commit a77b559 into main Jan 20, 2022
@sbc100 sbc100 deleted the export_functions_vs_linkable branch January 20, 2022 03:48
guijan pushed a commit to guijan/emscripten that referenced this pull request Jan 20, 2022
…mscripten-core#10075)

This doesn't make sense since these imply all symbols are already
exported.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants