[PATCH] D43946: [WebAssembly] Reorder reloc sections to come after symtab

Nicholas Wilson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 1 09:58:18 PST 2018


ncw added inline comments.


================
Comment at: wasm/Writer.cpp:637
-    createRelocSections();
+  if (Config->Relocatable)
     createLinkingSection();
-  }
----------------
sbc100 wrote:
> ncw wrote:
> > sbc100 wrote:
> > > Why not just swap these two lines?   I'm not sure we should care about where these sections come relative the name section.   
> > It's easier to have the name section come before the reloc section - it just makes the yaml2wasm logic a bit simpler. That's not really a good reason is it :( But it would be an extra few lines of code to have "name" come after "reloc".
> > 
> > You're right we do have free choice on that ordering; all the other orderings are driven by decent reasons.
> Can you remind me why it makes yaml2wasm simpler?b
Sure, it's silly really, but yaml2wasm currently just iterates over all the sections and writes them out to Wasm - then does a second loop to catch the relocations and writes those out (since they're stored on the section to which the relocations apply).

So writing out relocs in between the "linking" and "name" section would just make the diff there fatter, so I took the line of least resistance. If there's some aesthetic or other reason to put "name" at the end I can do that though.


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D43946





More information about the llvm-commits mailing list