Nikolay Nikolov
508e0dd01c
* WebAssembly internal linker: refactor writing the name custom section - group
...
generating subsection data with the actual writing of the subsection data
2024-09-21 09:42:17 +03:00
Nikolay Nikolov
1ea876b517
+ add tag names to the WebAssembly name section
2024-09-21 09:40:25 +03:00
Nikolay Nikolov
33a389dfb7
* WebAssembly internal linker: add the data segment names to the name section
2024-09-20 16:28:14 +03:00
Nikolay Nikolov
a46c6229c5
+ WebAssembly interal linker: add global names to the name custom section
2024-09-19 07:00:56 +03:00
Nikolay Nikolov
507e728ee8
+ introduced local method WriteNameMap for writing name maps in the WebAssembly name custom section
2024-09-19 06:48:22 +03:00
Nikolay Nikolov
b5d0cd57ed
+ introduced method TWasmExeOutput.AddToGlobalNameMap
2024-09-19 06:43:52 +03:00
Nikolay Nikolov
7c545cfa8b
+ introduced method TWasmExeOutput.AddToNameMap
2024-09-19 06:42:03 +03:00
Nikolay Nikolov
85143f515d
+ introduced private type TCustomSectionNameMap to class TWasmExeOutput
2024-09-19 06:40:37 +03:00
Nikolay Nikolov
2ee8a59fbd
+ introduced private type TCustomSectionNameMapEntry to class TWasmExeOutput
2024-09-19 06:39:38 +03:00
Nikolay Nikolov
cf7d9fa4c5
+ WebAssembly internal linker: create a name custom section to help debugging
2024-09-17 05:34:20 +03:00
Nikolay Nikolov
aba44452f3
* WebAssembly internal linker: also don't remove unused data sections if
...
smartlinking is turned off.
2024-09-15 08:59:08 +03:00
Nikolay Nikolov
36ecb2b5da
* WebAssembly internal linker: don't remove unused code sections if smartlinking
...
is turned off. This is needed for debugging, because FPC doesn't support debug
info with smartlinking on most platforms, and that includes WebAssembly.
2024-09-15 08:32:35 +03:00
Nikolay Nikolov
562ca0ad80
* WebAssembly internal assembler writer: generate the function locals header
...
when assembling the tai_local directive, instead of injecting them manually in
TWasmObjOutput.WriteFunctionCode. This makes function code offsets correct
and avoids the need to manually adjust relocation fixups by adding the locals
header size. It also fixes relative relocations, used in DWARF debug line
info.
2024-09-15 03:44:14 +03:00
Nikolay Nikolov
80523e192a
* TWasmObjData.DeclareLocal renamed DeclareLocals. No functional changes.
2024-09-15 01:03:56 +03:00
Nikolay Nikolov
b9ca30165c
* WebAssembly: refactored tai_local, so that it is a single directive,
...
containing multiple locals, instead of creating multiple tai_local directives,
each containing a single local. No functional changes.
2024-09-15 00:49:05 +03:00
Nikolay Nikolov
99943610cb
* WebAssembly: generate the final bashB opcode of a function via the
...
end_function instruction, instead of adding it magically in the object writer.
This makes the WebAssembly debug line info more accurate, covering the
end_function instruction as well.
2024-09-11 07:46:23 +03:00
Nikolay Nikolov
d81170ab23
* fix generation of addend for R_WASM_FUNCTION_OFFSET_I32 relocations. This
...
improves code address accuracy for WebAssembly debug line info information.
2024-09-11 04:50:35 +03:00
Nikolay Nikolov
b7742def46
+ WebAssembly internal linker: support the R_WASM_GLOBAL_INDEX_I32 relocation,
...
used for threadvar debug info, among another possible uses.
2024-09-11 00:31:27 +03:00
Nikolay Nikolov
9799c6a5ec
+ support writing R_WASM_GLOBAL_INDEX_I32 relocations in the WebAssembly internal object writer
2024-09-11 00:12:20 +03:00
Nikolay Nikolov
ee98fa8e3f
+ WebAssembly internal linker: support data relocations to threadvars, resolve
...
them as relative values to the beginning of the TLS section. Will be used for
generating debug info for threadvars.
2024-09-10 23:56:00 +03:00
Nikolay Nikolov
424686ce34
* fix warning (second attempt :) )
2024-09-07 18:05:35 +03:00
Nikolay Nikolov
a0cfed14fa
* fix warning
2024-09-07 18:01:23 +03:00
Nikolay Nikolov
2ba0f42508
+ WebAssembly internal assembler and linker: support exporting symbols from
...
debug sections, via a FPC-specific extension. Unfortunately, this is not
supported by the LLVM external assembler and linker.
2024-09-07 17:07:29 +03:00
Nikolay Nikolov
27fd290150
+ WebAssembly object writer: record the custom section index for debug sections
...
in a new field TWasmObjSection.CustomSectionIdx
2024-09-07 04:30:03 +03:00
Nikolay Nikolov
d79c549f03
* WebAssembly internal object writer: generate the symbol table after the
...
section numbers have been calculated. This is preparation for exporting
symbols from debug sections, which will be implemented in the future. No
functional changes.
2024-09-07 04:11:18 +03:00
Nikolay Nikolov
4112318e2f
* WebAssembly internal linker: allow specifying the max memory size also for
...
binaries that don't use threads and shared memory. Unlike the shared memory
case, in this case the max memory limit is optional.
2024-08-22 10:51:02 +03:00
Nikolay Nikolov
44f58c702f
* get rid of WebAssembly constant DefaultMaxMemoryForThreads, because it was
...
repeated twice. Instead, set maxheapsize correctly with the default value in
init_parser.
2024-08-18 10:51:40 +03:00
Nikolay Nikolov
c54d1d4b89
* WebAssembly internal linker: the PageSize constant, which was repeated twice,
...
moved to the class level and renamed WasmPageSize. No functional changes.
2024-08-15 04:47:58 +03:00
Nikolay Nikolov
bf78823e60
+ WebAssembly internal linker: take into account the min heap size (specified
...
with the $M directive), when determining FMinMemoryPages
2024-08-15 04:35:13 +03:00
Nikolay Nikolov
3218f25d13
* WebAssembly internal linker: reduced exe section alignment to 16 bytes
2024-08-11 03:57:05 +03:00
Nikolay Nikolov
f81485a9b1
* WebAssembly threads internal linker: use signed LEB when needed in TWasmExeOutput.GenerateCode_InitTls and TWasmExeOutput.GenerateCode_InitSharedMemory
2024-08-11 02:55:15 +03:00
Nikolay Nikolov
2e2281387c
* WebAssembly threads internal linker: micro optimization in
...
TWasmExeOutput.GenerateCode_InitTls - skip generating instructions that add
zero
2024-08-11 02:44:23 +03:00
Nikolay Nikolov
4adb6b2bee
* WebAssembly threads internal linker: use WriteUleb instead of WriteUleb5 in
...
TWasmExeOutput.GenerateCode_InitTls and TWasmExeOutput.GenerateCode_InitSharedMemory.
This generates equivalent, but shorter code.
2024-08-11 02:37:18 +03:00
Nikolay Nikolov
dfe60b53d1
* WebAssembly threads internal linker: generate data.drop instructions in
...
TWasmExeOutput.GenerateCode_InitSharedMemory. This drops the passive memory
segments, after the memory has been initialized.
2024-08-11 02:30:39 +03:00
Nikolay Nikolov
b985cd0ea5
* WebAssembly threads internal linker: implement memory initialization in TWasmExeOutput.GenerateCode_InitSharedMemory
2024-08-11 02:24:02 +03:00
Nikolay Nikolov
cfa7d6a0c6
* WebAssembly internal linker: moved the DataSections const array from local to
...
the method writeData to local to the class. No functional changes.
2024-08-11 02:14:13 +03:00
Nikolay Nikolov
4d48e7e4d3
* WebAssembly threads internal linker: generate passive data segments, when multithreading is on
2024-08-11 02:12:31 +03:00
Nikolay Nikolov
8648c0353a
+ WebAssembly threads internal linker: partial implementation of TWasmExeOutput.GenerateCode_InitSharedMemory
2024-08-11 02:07:50 +03:00
Nikolay Nikolov
914b1feceb
* WebAssembly threads internal linker: create a startup function for
...
initializing shared memory (dummy for now)
2024-08-11 01:37:50 +03:00
Nikolay Nikolov
b6f60e33ca
* WebAssembly threads internal linker: use imported and shared memory if multithreading is enabled
2024-08-11 01:18:38 +03:00
Nikolay Nikolov
3a473f9148
* WebAssembly threads internal linker: set initial values for __tls_size, __tls_align and __tls_base
2024-08-11 00:56:16 +03:00
Nikolay Nikolov
07b4ceac49
* WebAssembly threads internal linker: set threadvar globals as mutable
2024-08-11 00:44:32 +03:00
Nikolay Nikolov
c9f6b93d22
* WebAssembly threads internal linker: implemented the actual code generation in TWasmExeOutput.GenerateCode_InitTls
2024-08-11 00:41:56 +03:00
Nikolay Nikolov
90a756931e
* WebAssembly threads internal linker: set initial values for threadvar globals
2024-08-11 00:19:53 +03:00
Nikolay Nikolov
a441d8ff28
* WebAssembly threads internal linker: introduced TWasmObjSymbol.TlsDataSym
2024-08-11 00:15:20 +03:00
Nikolay Nikolov
0d5dd4196f
* WebAssembly threads: don't do anything in TWasmExeOutput.SetThreadVarGlobalsInitValues
...
and TWasmExeOutput.GenerateCode_InitTls if threads are disabled
2024-08-11 00:12:37 +03:00
Nikolay Nikolov
334ef633a8
* WebAssembly threads internal linker: starting working on TWasmExeOutput.SetThreadVarGlobalsInitValues
2024-08-11 00:11:29 +03:00
Nikolay Nikolov
39ab212642
* WebAssembly threads internal linker: set MainFuncSymbol of the section of threadvar globals
2024-08-11 00:06:36 +03:00
Nikolay Nikolov
f38b12240d
* WebAssembly threads internal linker: set the global type of threadvar globals to wbt_i32
2024-08-11 00:05:14 +03:00
Nikolay Nikolov
afbc36897d
+ WebAssembly threads internal linker: introduced TWasmExeOutput.GenerateCode_InitTls (not ready, yet, just writes some dummy data)
2024-08-11 00:01:52 +03:00