You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Linking.md
+46-40Lines changed: 46 additions & 40 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -752,8 +752,8 @@ Relocations are represented as WebAssembly annotations of the form
752
752
|`i64`|`R_WASM_*_I64`| 8-byte [uint64]|
753
753
|`leb`|`R_WASM_*_LEB`| 5-byte [varuint32]|
754
754
|`sleb`|`R_WASM_*_SLEB`| 5-byte [varint32]|
755
-
|`leb64`|`R_WASM_*_LEB`| 10-byte [varuint64]|
756
-
|`sleb64`|`R_WASM_*_SLEB`| 10-byte [varint64]|
755
+
|`leb64`|`R_WASM_*_LEB64`| 10-byte [varuint64]|
756
+
|`sleb64`|`R_WASM_*_SLEB64`| 10-byte [varint64]|
757
757
758
758
-`method` describes the type of relocation, so what kind of symbol we are relocating against and how to interpret that symbol.
759
759
@@ -790,10 +790,10 @@ Symbol kinds marked with `*` are considered *primary*.
790
790
|`<labeluse>`| Byte offest to label |`method` allows addend and `method` is either `text` or `section`|
791
791
792
792
-`symbol` describes the symbol against which to perform relocation.
793
-
- For `funcsec` relocation metod, this is the function id, so that if the addend is zero, the relocation points to the first instruction of that function.
794
-
- For `datasec` relocation metod, this is the data segment id, so that if the addend is zero, the relocation points to the first byte of data in that segment.
795
-
- For `customsec` relocation metod, this is the name of the custom section, so that if the addend is zero, the relocation points to the first byte of data in that segment.
796
-
- For other relocation metods, this denotes the symbol in the scope of that symbol kind.
793
+
- For `funcsec` relocation method, this is the function id, so that if the addend is zero, the relocation points to the first instruction of that function.
794
+
- For `datasec` relocation method, this is the data segment id, so that if the addend is zero, the relocation points to the first byte of data in that segment.
795
+
- For `customsec` relocation method, this is the name of the custom section, so that if the addend is zero, the relocation points to the first byte of data in that segment.
796
+
- For other relocation methods, this denotes the symbol in the scope of that symbol kind.
797
797
798
798
The relocation type is looked up from the combination of `format`, `method`, and `modifier`. If no relocation type exists, an error is raised.
799
799
@@ -807,11 +807,11 @@ If all components of a relocation annotation are skipped, the annotation may be
807
807
808
808
### Instruction relocations
809
809
810
-
For every usage of an `typeidx`, `funcidx`, `globalidx`, `tagidx`, a relocation annotation is added afterwards, with `format` predefined as `leb`, `method` predefined as the *primary* method for that type, and `symbol` defaulted as the *primary* symbol of that `idx`
810
+
For every usage of `typeidx`, `funcidx`, `globalidx`, `tagidx`, a relocation annotation is added afterwards, with `format` predefined as `leb`, `method` predefined as the *primary* method for that type, and `symbol` defaulted as the *primary* symbol of that `idx`
811
811
812
-
For the `i32.const` instruction, a relocation annotation is added after the integer literal operand, with `format` predefined as `sleb`, and `method` is allowed to be either `data` or `functable`.
813
-
For the `i64.const` instruction, a relocation annotation is added after the integer literal operand, with `format` predefined as `sleb64`, and `method` is allowed to be either `data` or `functable`.
814
-
For the `i{32,64}.{load,store}*` instructions, a relocation annotation is added after the offset operand, with `format` predefined as `leb` if the *memory* being referenced is 32-bit, and `leb64` otherwise, and `method` predefined as `data`.
812
+
-For the `i32.const` instruction, a relocation annotation is added after the integer literal operand, with `format` predefined as `sleb`, and `method` is allowed to be either `data` or `functable`.
813
+
-For the `i64.const` instruction, a relocation annotation is added after the integer literal operand, with `format` predefined as `sleb64`, and `method` is allowed to be either `data` or `functable`.
814
+
-For the `i{32,64}.{load,store}*` instructions, a relocation annotation is added after the offset operand, with `format` predefined as `leb` if the *memory* being referenced is 32-bit, and `leb64` otherwise, and `method` predefined as `data`.
815
815
816
816
### Data relocations
817
817
@@ -838,29 +838,29 @@ Data imports represented as WebAssembly annotations of the form
838
838
839
839
-`qualifier` is one of the allowed qualifiers on a symbol declaration. Qualifiers may not repeat.
@@ -870,7 +870,7 @@ declares 3 symbols: one primary symbol with the name of the index of the functio
870
870
### Data symbols
871
871
872
872
Data symbol annotations can be interleaved into the data string sequence. When that happens, relocations are situated before the first byte of the value being defined.
873
-
For example, declaration of a 32-bit global by with the name `$foo` and linkage name "foo" would look like following:
873
+
For example, a declaration of a 32-bit global with the name `$foo` and linkage name "foo" would look like following:
@@ -891,22 +891,28 @@ COMDAT declarations occur in the same place as module fields.
891
891
892
892
## Labels
893
893
894
-
For some relocation types, an offset into a section/function is necessary. For these cases, lablels exsist.
894
+
For some relocation types, an offset into a section/function is necessary. For these cases, labels exsist.
895
895
Labels are represented as WebAssembly annotations of the form
896
896
```wat
897
897
(@sym.label <id>)
898
898
```
899
899
900
900
### Function labels
901
-
Function labels occur in the same place as instructions. A label always denotes the first byte of the next instruction, or the byte after end of function's instruction stream if there isn't a next instruction
901
+
Function labels occur in the same place as instructions.
902
+
A label always denotes the first byte of the next instruction, or the byte after the end of the function's instruction stream, if there isn't a next instruction.
903
+
902
904
Function label names are local to the function in which they occur.
903
905
904
906
### Data labels
905
-
Data labels can be interleaved into the data string sequence. When that happens, relocations are situated after the last byte of the value being relocated.
907
+
Data labels can be interleaved into the data string sequence.
908
+
When that happens, relocations are situated after the last byte of the value being relocated.
909
+
906
910
Data label names are local to the data segment in which they occur.
907
911
908
912
### Custom labels
909
-
Custom labels can be interleaved into the data string sequence. When that happens, relocations are situated after the last byte of the value being relocated.
913
+
Custom labels can be interleaved into the data string sequence.
914
+
When that happens, relocations are situated after the last byte of the value being relocated.
915
+
910
916
Custom label names are local to the custom section in which they occur.
911
917
912
918
## Data segment flags
@@ -917,13 +923,13 @@ Data segment flags are represented as WebAssembly annotations of the form
917
923
918
924
-`qualifier` is one of the allowed qualifiers on a data segment declaration. Qualifiers may not repeat.
0 commit comments