[PATCH] D80361: [WebAssembly] Convert more lld and MC tests to assembly

Sam Clegg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 21 14:38:56 PDT 2020


sbc100 marked an inline comment as done.
sbc100 added inline comments.


================
Comment at: lld/test/wasm/Inputs/call-indirect.s:28
+
+  .functype foo () -> (i32)
----------------
aardappel wrote:
> tlively wrote:
> > Do I understand correctly that the `.int32 foo` declares a symbol `foo` and `.functype foo () -> (i32)` makes it a function symbol with that type?
> `.int32` doesn't declare anything, it simply adds static data to the current segment, in this case a relocatable index to `foo`.
> 
> `.functype` associates signature information with an existing (or new) symbol/label (since signatures are not traditionally part of asm).
The functype is what declares the functions.


`.int32` is a data directive.   `.int32 <symbolname>` means insert the 32-bit address of the symbol. 

So `.int32  foo` is effectively taking the address (table offset) of function foo and storing it in static/global data.

The result will be an object file with a relocation of type R_WASM_TABLE_INDEX_I32 pointing to this location in the data section.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80361





More information about the llvm-commits mailing list