This is an archive of the discontinued LLVM Phabricator instance.

[WebAssembly] Symbol changes #4b: export stack-pointer, LLD only
ClosedPublic

Authored by ncw on Jan 18 2018, 2:42 AM.

Details

Summary

Split out of D41955.

This solves the problem that --emit-relocs needs the stack-pointer to be exported, in order to write out any relocations that reference the __stack_pointer symbol by its symbol index.

Rationale: --emit-relocs is only ever going to be used by downstream tools (such as Emscripten's binaryen tools). In particular, we don't expect that the output from --emit-relocs will be sent to browsers without further post-processing. Although browsers don't allow mutable globals to be imported/exported (yet), tools like binaryen do accept it.

Diff Detail

Repository
rLLD LLVM Linker

Event Timeline

ncw created this revision.Jan 18 2018, 2:42 AM
sbc100 accepted this revision.Jan 18 2018, 10:04 AM

Great! Thanks for the small review!

This revision is now accepted and ready to land.Jan 18 2018, 10:04 AM
ncw added a comment.Jan 18 2018, 10:16 AM

Ah! I thought this might be contentious. I guess the --emit-relocs output isn't critical for anything at the moment.

In D42237#980509, @ncw wrote:

Ah! I thought this might be contentious. I guess the --emit-relocs output isn't critical for anything at the moment.

Indeed, I'm not even sure we want to continue support it as a separate options to '-r/--relocatable' (of which --emit-relocs) is a subset. I'm tempted to rip and out and replace Config->EmitRelocs with Config->Relocatable, at least until we can come up with a reasonable use case (I suppose we use it in tests... but that isn't really a good enough motivation).

In any case this change is need for the --relocatable case.

ncw added a comment.Jan 18 2018, 10:35 AM

It's not currently needed for the --relocatable case, since we don't create a stack-pointer symbol at all in that case (it's an import until the "final" link is done).

This revision was automatically updated to reflect the committed changes.