[PATCH] D54249: [WebAssembly] Initial support for shared objects (-shared)

Sam Clegg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 13 18:27:55 PST 2018


sbc100 added inline comments.


================
Comment at: wasm/OutputSections.cpp:141
+    if (Config->Pic) {
+      assert(Segments.size() <= 1 &&
+             "Currenly only a single data segment is supported in PIC mode");
----------------
dschuff wrote:
> Can this be a `report_fatal_error` or something even more friendly instead of an assert, since this could happen as the result of user input?
This should not be able to occur due to user input since we only ever create a single segment in Writer.cpp if Config->Pic, so this is really just an internal check.


================
Comment at: wasm/Writer.cpp:712
   // Known sections
+  if (Config->Pic)
+    createDylinkSection();
----------------
dschuff wrote:
> shouldn't this go after the data section since it's a custom section?
No, this section actually always comes first in the entire file to make dll's easy to detect.

The "spec" says: `The "dylink" section should be the very first section in the module; this allows detection of whether a binary is a dynamic library without having to scan the entire contents.`


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D54249





More information about the llvm-commits mailing list