This is an archive of the discontinued LLVM Phabricator instance.

[WebAssembly] Error on R_WASM_MEMORY_ADDR relocations against undefined data symbols.
ClosedPublic

Authored by sbc100 on Mar 13 2019, 3:32 PM.

Details

Summary

For these types of relocations an absolute memory address is
required which is not possible for undefined data symbols. For symbols
that can be undefined at link time (i.e. external data symbols in
shared libraries) a different type of relocation (i.e. via a GOT) will
be needed.

Event Timeline

sbc100 created this revision.Mar 13 2019, 3:32 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 13 2019, 3:32 PM
sbc100 updated this revision to Diff 190524.Mar 13 2019, 3:37 PM

Add test

ruiu added inline comments.Mar 13 2019, 4:10 PM
lld/wasm/Writer.cpp
1038

This function is getting longer. I wonder if you can move this lambda out of this function.

sbc100 updated this revision to Diff 190650.Mar 14 2019, 9:21 AM
  • fix error
sbc100 marked an inline comment as done.Mar 15 2019, 10:48 AM
sbc100 added inline comments.
lld/wasm/Writer.cpp
1038

Ok to do that in a follow up?

ruiu accepted this revision.Mar 15 2019, 4:23 PM

LGTM

lld/wasm/Writer.cpp
1038

I'd personally like to do beforehand so that the code is cleaner at any point of time, but a follow-up patch is OK.

This revision is now accepted and ready to land.Mar 15 2019, 4:23 PM
sbc100 updated this revision to Diff 190933.Mar 15 2019, 6:15 PM
sbc100 marked an inline comment as done.
  • split out lambda
sbc100 added inline comments.Mar 15 2019, 6:17 PM
lld/wasm/Writer.cpp
1038

OK I did with this CL.

This revision was automatically updated to reflect the committed changes.