[PATCH] D43391: [WebAssembly] Separate out InputGlobal from InputChunk

Nicholas Wilson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 16 08:05:23 PST 2018


ncw created this revision.
ncw added reviewers: sbc100, ruiu.
Herald added subscribers: llvm-commits, sunfish, aheejin, jgravelle-google, dschuff, jfb.

This is a follow-up to https://reviews.llvm.org/D43264, or maybe Sam could take this apply and merge into https://reviews.llvm.org/D43264?

This is a follow-on from the discussion in that issue.

I've tried to separate out InputGlobal from InputChunk, so that it doesn't derive from it (since InputChunk has relocations, but InputGlobal doesn't). This change ripples out and impacts the rest of the code a bit.

Rejected alternative:

  InputGlobal (not derived from anything, this duplicates/complicates too much code)
  InputChunk
    -> InputFunction
    -> InputSegment

What I've done here:

  InputChunk
    -> InputSection - new class, all the relocation stuff and section offsets
                      moved from InputChunk to here
      -> InputFunction
      -> InputSegment
    -> InputGlobal

As part of that, I had a re-jigg of the handling of the function/global signature on the FunctionSymbol/GlobalSymbol objects, and discovered a bug! The current handling of undefined function signatures is wrong, oops, as evidenced by the fact that one of tests provides `__cxa_at_exit` with the wrong signature, yet the test passes. I discovered this when my refactoring broke the test, and then I realised I'd accidentally fixed a bug.

Other small fixes, while I was at it (should surely be rolled into https://reviews.llvm.org/D43264):

- Fixed MarkLive to log the InputGlobals that are discarded
- Fixed Symbol::hasOutputIndex for globals
- Added missing DefinedGlobal::classof! Yikes.


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D43391

Files:
  test/wasm/gc-sections.ll
  test/wasm/init-fini.ll
  wasm/InputChunks.cpp
  wasm/InputChunks.h
  wasm/InputFiles.cpp
  wasm/InputFiles.h
  wasm/MarkLive.cpp
  wasm/OutputSections.cpp
  wasm/SymbolTable.cpp
  wasm/Symbols.cpp
  wasm/Symbols.h
  wasm/Writer.cpp
  wasm/WriterUtils.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D43391.134623.patch
Type: text/x-patch
Size: 37287 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180216/3a478a45/attachment.bin>


More information about the llvm-commits mailing list