[PATCH] D91870: [WebAssembly] Add support for table linking to wasm-ld

Sam Clegg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 1 12:13:25 PST 2020


sbc100 added inline comments.


================
Comment at: lld/wasm/SyntheticSections.h:156
-    //     a validation error to include a call_indirect instruction if there
-    //     is not table.
-    return !config->importTable;
----------------
How is (2) handled after this change?

Imagine a program that contains just this code:

```
EXPORT_OR_OTHERWISE_KEEP_ALIVE
 void call_func(func_ptr f) {
    f()
}
```

Now we a call_indirect instruction but no TABLE_INDEX relocations.

In fact we have no relocations at all, but the resulting program needs to have a table in order to validate.

I guess once you move to new relocation model to call_indirect this program *will* have a TABLE_NUMBER relocation.    But we need to support the case where this code was compiled with the old model too.

The change to lld/test/wasm/stack-pointer.ll looks a little suspicious because it removes the table from the object file which would potentially make it fail to validate.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D91870/new/

https://reviews.llvm.org/D91870



More information about the llvm-commits mailing list