Skip to content

Split linker code into a separate file. NFC #20717

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
Nov 16, 2023

Conversation

sbc100
Copy link
Collaborator

@sbc100 sbc100 commented Nov 15, 2023

This change moves more than half of the code in emcc.py which is used only for linking into its own file (link.py). This makes reasoning about the code easier and paves the way for a fast path then only compiling (e.g. this code shouldn't even need to be imported when only compiling). See #20577.

@sbc100 sbc100 requested a review from RReverser November 15, 2023 04:16
@sbc100 sbc100 requested a review from kripken November 15, 2023 04:20
@sbc100
Copy link
Collaborator Author

sbc100 commented Nov 15, 2023

I've been meaning to do this for years, and finally its seems do-able without any major changes. 99.99% of this change is just moving code from one file to another.

@sbc100 sbc100 force-pushed the split_linker_code branch 2 times, most recently from 58146d5 to 70f38d2 Compare November 15, 2023 18:01
@sbc100
Copy link
Collaborator Author

sbc100 commented Nov 15, 2023

@kripken I'd like to land this quickly (i.e. today) if possible to avoid having to update it as other PRs land against the old emcc.py.

DYNAMICLIB_ENDINGS = ['.dylib', '.so']
STATICLIB_ENDINGS = ['.a']

run_via_emxx = False
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a little odd in shared I think? It only matters for emcc?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is used by both emcc.py and link.py.. it also need to be settabe from em++.py.

We could change thins into a function that checks sys.argv[0] I guess?

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.

lgtm, good to reduce the size of emcc.py, my one comment can be considered separately.

This change moves more than half of the code in emcc.py which is used
only for linking into its own file (link.py).  This makes reasoning
about the code easier and paves the way for a fast path then only
compiling (e.g. this code shouldn't even need to be imported when only
compiling).  See emscripten-core#20577.
@sbc100 sbc100 enabled auto-merge (squash) November 16, 2023 19:42
@sbc100 sbc100 merged commit 1ead8f3 into emscripten-core:main Nov 16, 2023
@sbc100 sbc100 deleted the split_linker_code branch November 16, 2023 20:38
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