Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tools/building.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ def lld_flags_for_executable(external_symbols):
cmd.append('--max-memory=%d' % settings.INITIAL_MEMORY)
elif settings.MAXIMUM_MEMORY != -1:
cmd.append('--max-memory=%d' % settings.MAXIMUM_MEMORY)
if not settings.RELOCATABLE:
if settings.GLOBAL_BASE != 1024 and not settings.RELOCATABLE:
Copy link
Member

Choose a reason for hiding this comment

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

Is it worth baking in current defaults of wasm-ld here? I worry about them changing. It seems safer to me to keep passing this.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, you are probably right there.

I guess part of my intention here is to express that case when the user doesn't care about the global base at all.. which is the normal case.

On the other hand, since you described the low memory optimization that binaryen does I think emscripten does actually care in more cases than I had thought.

I guess what I want here is to say "If the user specified a specific global base, or if emscripten want to run the low memory optimization, then pass an explictic stack base... otherwise we don't care and wasm-ld can choose whatever it wants"

Copy link
Member

Choose a reason for hiding this comment

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

I see. Yeah, that makes sense. How about having a place that decides whether we use the low-memory optimization, and it sets GLOBAL_BASE if so? (to 1024) And if not it would be null. Then we could avoid passing null to wasm-ld.

cmd.append('--global-base=%s' % settings.GLOBAL_BASE)

return cmd
Expand Down