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.