[PATCH] D42867: [WebAssembly] Add _edata, _end and other link-sythentic symbols

Sam Clegg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 2 16:01:24 PST 2018


sbc100 added a comment.

In https://reviews.llvm.org/D42867#996916, @sunfish wrote:

> I'm nervous about adding all these symbols. I like ELF features when they make sense, but for some of these symbols here, it's difficult to think of even hypothetical valid use cases.
>
> Adding these features could make it harder for us to change how we lay out memory in the future. For example, if we want to move where the stack is, or do things with the memory of dynamic libraries present at startup time, it may be harder if we have to consider whether someone might be using `_end` or other things and depending on memory having a particular layout.


Well, we have a user that needs to know where the application data ends.  Emscripten is currently using the "linking" metadata section and the DataSize for this.   This change move that from the custom field in the custom section to regulare symbol which as several advantages:

1. Its more in line with the existing stardards.
2. I mean we don't need to write the "linking" metadata when we write out executable (executable shouldn't needs such a thing).
3. I means emscriptne doesn't need to know about the linking metadata.

I'm happy to only add `_end` for now, and we could rename it to `__wasm_data_end` if you prefer something more explicit.  I just liked the simplicity of `_end` since it is already a thing in ELF.


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D42867





More information about the llvm-commits mailing list