Skip to content

Commit 20339b5

Browse files
authored
Merge pull request #98 from WebAssembly/bulk-memory-linking
Handle mixing memories and segment types
2 parents f8fcf1a + 6266b3d commit 20339b5

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

Linking.md

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,8 @@ The current list of valid `type` codes are:
150150
- `5 / WASM_SEGMENT_INFO` - Extra metadata about the data segments.
151151

152152
- `6 / WASM_INIT_FUNCS` - Specifies a list of constructor functions to be called
153-
at startup time.
153+
at startup. These constructors will be called in priority order after memory
154+
has been initialized.
154155

155156
- `7 / WASM_COMDAT_INFO` - Specifies the COMDAT groups of associated linking
156157
objects, which are linked only once and all together.
@@ -359,7 +360,8 @@ linked output.
359360

360361
Segments are merged according their type: segments with a common prefix such as
361362
`.data` or `.rodata` are merged into a single segment in the output data
362-
section.
363+
section. It is an error if this behavior would merge shared and unshared
364+
segments.
363365

364366
The output data section is formed, essentially, by concatenating the data
365367
sections of the input files. Since the final location in linear memory of any
@@ -370,10 +372,21 @@ which reference a data symbol.
370372
Segments are linked as a whole, and a segment is either entirely included or
371373
excluded from the link.
372374

373-
Mergin Custom Sections
375+
Merging Memory Sections
376+
-----------------------
377+
378+
It is an error to link together object files with shared and unshared
379+
memories. Object files with unshared memories are produced by tools that are not
380+
aware of WebAssembly threads or are configured to produce code for a
381+
single-threaded environment. These objects may have been compiled from
382+
thread-aware source code but had their atomic operations stripped, so it would
383+
be dangerous to allow users to accidentally link these objects together with
384+
properly thread-aware objects.
385+
386+
Merging Custom Sections
374387
----------------------
375388

376-
Mergin of custom sections is performed by concatenating all payloads for the
389+
Merging of custom sections is performed by concatenating all payloads for the
377390
customs sections with the same name. The section symbol will refer the resulting
378391
section, this means that the relocation entries addend that refer
379392
the referred custom section fields shall be adjusted to take new offset

0 commit comments

Comments
 (0)