-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Handle -Wl,--stack-first
being passed explicitly
#21216
Merged
+24
−9
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
In general, you can run into lots of (sometimes subtle) trouble with
-Wl,XYZ
where an-sXYZ
setting also exists and interacts in some way...So I am just curious where has the line in the sand been drawn for such things?
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 agree that we cannot support all possible
-Wl,xx
and-s
settings. I don't have strong opinions on how much effort we should put into supporting the combinations that we can.One alternative version of this PR would simply to be to error out if the user passes
-Wl,--stack-first
. Another would be to do nothing and continue to fail in way that less actionable.I think I'm OK with this best effort level of support we that we seem to have have today.
WDYT?
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 suppose if I were designing
emcc
from zero, I would avoid introducingsXYZ
s where they would in any way overlap with linker settings, and error in cases where the overlap is inevitable. That's not howemcc
is designed though - it's very permissive, which is also a very valid choice given its goal of emulating existing linkers as best as it can.Given this, it seems as fine a strategy as any to do things on an as-users-have-reported-this basis. As you note, it will never be complete. E. g. in this change:
-sSTACK_FIRST=1
does not lead to an error?-Wl,--stack-first
overrides explicit-sSTACK_FIRST=0
.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.
-sSTACK_FIRST
is not a thing. TheSTACK_FIRST
setting is an internal setting, not settable by the user.We do try hard to avoid
-s
settings that overlap with the linker/compiler BTW. We've doing that several times in the past and will continue to to that going forward. Using clang / lld standard flags to always preferable IMHO.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.
👍.
That's an oversight by me, sorry about that.
So that opens the question whether I should rewrite #21071 to use
-Wl,--initial-heap=...
... There is no place to put the documentation, though.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.
That is a good point. Those memory settings, along with
-sGOBAL_BASE
is areas where we do currently override and replace the linker default settings.I think I'm ok with adding
-sINITIAL_MEMORY
for now and then attempting to migrate users to native linker flags later, since there are a bunch of different memory related linker flags today that fall in the same bucket:INITIAL_MEMORY
,MAXIUMUM_MEMORY
,GLOBAL_BASE
,STACK_SIZE
, etc..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.
For background I think one of the reasons these settings evolves the way they did is the emscripten was original written before wasm-ld existed. It implemented the linker itself back then, with its own flags.