This is an archive of the discontinued LLVM Phabricator instance.

[WebAssembly][lld] Fix segfault on .bss sections in mapfile
ClosedPublic

Authored by tlively on May 21 2021, 4:01 PM.

Details

Summary

When memory is declared in the Wasm module, we rely on the implicit zero
initialization behavior and do not explicitly output .bss sections. The means
that they do not have associated outputSec entries, which was causing
segfaults in the mapfile support. Fix the issue by guarding against null
outputSec and falling back to using a zero offset.

Diff Detail

Event Timeline

tlively created this revision.May 21 2021, 4:01 PM
tlively requested review of this revision.May 21 2021, 4:01 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 21 2021, 4:01 PM

@sbc100 Is there anything better to do here besides falling back and emitting 0 as the offset?

It does seem a little unfortunate that we can't report that offset correctly here. I would expect to see my bss always following by non-bss data. Let me take a look at see if we are relying on the null outputSec ...

sbc100 accepted this revision.Jul 7 2021, 4:25 PM

Lets land this!

This revision is now accepted and ready to land.Jul 7 2021, 4:25 PM