fpc/utils/wasmbin
nickysn b828875a43 [PATCH 146/188] update writing globals section
From cabd10e07f9794a473b12411a1c527f423c6c5b6 Mon Sep 17 00:00:00 2001
From: Dmitry Boyarintsev <skalogryz.lists@gmail.com>
Date: Wed, 25 Mar 2020 14:45:43 -0400

git-svn-id: branches/wasm@46142 -
2020-08-03 13:01:39 +00:00
..
testscan [PATCH 120/188] adding test call_indirect using index reference 2020-08-03 13:01:13 +00:00
lebutils.pas [PATCH 086/188] extend utils for writing LEB values 2020-08-03 13:00:19 +00:00
parseutils.pas [PATCH 128/188] adding number format support 2020-08-03 13:01:22 +00:00
README.md
wasmbin.pas [PATCH 048/188] update writing binaries 2020-08-03 12:59:36 +00:00
wasmbincode.pas [PATCH 138/188] extending of offset align support 2020-08-03 13:01:32 +00:00
wasmbindebug.pas
wasmbinwriter.pas [PATCH 146/188] update writing globals section 2020-08-03 13:01:39 +00:00
wasmld.lpi [PATCH 048/188] update writing binaries 2020-08-03 12:59:36 +00:00
wasmld.lpr
wasmlink.pas [PATCH 102/188] using R_WASM_TABLE_INDEX_SLEB for i32.const as a 2020-08-03 13:00:50 +00:00
wasmlinkchange.pas
wasmmodule.pas [PATCH 145/188] updating normalization of global variables 2020-08-03 13:01:38 +00:00
wasmtext.pas [PATCH 134/188] adding legacy memory.size instruction 2020-08-03 13:01:28 +00:00
wasmtool.lpi
wasmtool.lpr [PATCH 057/188] adding an option to mark global variable as weak 2020-08-03 12:59:46 +00:00
wasmtoolutils.pas [PATCH 057/188] adding an option to mark global variable as weak 2020-08-03 12:59:46 +00:00
watparser.pas [PATCH 142/188] adding mutable flag for global variables 2020-08-03 13:01:35 +00:00
watscanner.pas [PATCH 140/188] scanning for align keyword 2020-08-03 13:01:33 +00:00
wattest.lpi [PATCH 069/188] downshift the version of the project for 2.0.6 2020-08-03 12:59:56 +00:00
wattest.lpr [PATCH 068/188] explicit normalization 2020-08-03 12:59:55 +00:00

wasmbin

Collection of WebAssembly binary utils

wasmtool

wasmtool is an utility that allows to modify wasm binary linking information. wat2wasm util is capable of generating binaries with relocation information. However the symbol flags are setup in the manner that final binaries cannot be linked by wasm-ld utility. (i.e. non setting weak symbols).

command

Only one command should be specified per call

exportrename

--exportrename inputfile

The option allow to change the export name. The reasoning for that is wasm-ld behavior of renaming the export from the declared name to the symbol name.

The input file can be either a text file, containing a list of oldname new name values:

OldExportName=NewExportName

or the input file can point to an object file. The object file's export section is parsed for the desired export names.

symbolflag

--symbolflag inputfile

The action allows to modify flags for the specified symbols. The input file specified must contain the pairs of symbolname + desired flags.

$TESTUNIT_$$_ADD$LONGINT$LONGINT$$LONGINT=WH

The desired flag is a string (or a character) that should consists of the following characters. Each character corresponds to a certain symbol linking flag:

  • W - WASM_SYM_BINDING_WEAK

  • H - WASM_SYM_VISIBILITY_HIDDEN

  • L - WASM_SYM_BINDING_LOCAL

  • D - removes flag WASM_SYM_BINDING_LOCAL

Multiple characters can be specified per flag.

symbolauto

 --symbolauto

The flags for each symbol updated and is determined based of the symbol use: if a function is a stub function (the only code is "unreachable"), the status given "weak" (it's a reference function elsewhere)

if a function is located in the function table, then the status given is
"hidden" (do not add to the final linked executable)

if a function is not located in the function table, the status given is:
"hidden"+"local" (local means the function can be used only in this object file)

Imported and exported functions are left unmodified.