This is an archive of the discontinued LLVM Phabricator instance.

[lld][WebAssembly] Set memory limits correctly for PIC + shared memory
ClosedPublic

Authored by sbc100 on Dec 2 2020, 5:24 PM.

Details

Summary

Don't early return from layoutMemory in PIC mode before we have set the
memory limits.

This matters in particular with shared-memory + PIC because shared
memories require maximum size.

Secondly, when we need a maximum, but the user does not supply one,
default to MAX_INT rather than 0 (defaulting to zero is completely
useless and means that building with -shared didn't previously work at
all without --maximum-memory, because zero is never big enough).

This is part of an ongoing effort to enable dynamic linking with
threads in emscripten.

See https://github.com/emscripten-core/emscripten/issues/3494

Diff Detail

Event Timeline

sbc100 created this revision.Dec 2 2020, 5:24 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 2 2020, 5:24 PM
sbc100 requested review of this revision.Dec 2 2020, 5:24 PM
sbc100 updated this revision to Diff 309318.Dec 3 2020, 11:10 AM
  • rebase
tlively accepted this revision.Dec 3 2020, 4:00 PM
This revision is now accepted and ready to land.Dec 3 2020, 4:00 PM