fpc/utils/wasmbin
nickysn cfc9f2952f [PATCH 061/188] initial support for assembler symbols
From b44f2ceda7be1d4708374dcd07b3a17a1917e8f0 Mon Sep 17 00:00:00 2001
From: Dmitry Boyarintsev <skalogryz.lists@gmail.com>
Date: Tue, 3 Mar 2020 10:34:57 -0500

git-svn-id: branches/wasm@46057 -
2020-08-03 12:59:49 +00:00
..
lebutils.pas [PATCH 007/188] convenience functions for leb128 2020-08-03 12:58:49 +00:00
parseutils.pas [PATCH 056/188] fix comments scanning 2020-08-03 12:59:45 +00:00
README.md [PATCH 029/188] Update README.md 2020-08-03 12:59:14 +00:00
wasmbin.pas [PATCH 048/188] update writing binaries 2020-08-03 12:59:36 +00:00
wasmbincode.pas [PATCH 050/188] commenting 2020-08-03 12:59:39 +00:00
wasmbindebug.pas [PATCH 003/188] starting on linking utils 2020-08-03 12:58:44 +00:00
wasmbinwriter.pas [PATCH 055/188] update writing symbol linking information 2020-08-03 12:59:44 +00:00
wasmld.lpi [PATCH 048/188] update writing binaries 2020-08-03 12:59:36 +00:00
wasmld.lpr [PATCH 021/188] trying to predict the symbol flag based on the symbol 2020-08-03 12:59:06 +00:00
wasmlink.pas [PATCH 054/188] writing relocation information 2020-08-03 12:59:43 +00:00
wasmlinkchange.pas [PATCH 018/188] allow flags to be set as a string rather than 2020-08-03 12:59:03 +00:00
wasmmodule.pas [PATCH 055/188] update writing symbol linking information 2020-08-03 12:59:44 +00:00
wasmtext.pas [PATCH 050/188] commenting 2020-08-03 12:59:39 +00:00
wasmtool.lpi [PATCH 013/188] update command line processing 2020-08-03 12:58:57 +00:00
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 058/188] hidding EParserError class into the implementation 2020-08-03 12:59:47 +00:00
watscanner.pas [PATCH 061/188] initial support for assembler symbols 2020-08-03 12:59:49 +00:00
wattest.lpi [PATCH 037/188] adding wattest 2020-08-03 12:59:23 +00:00
wattest.lpr [PATCH 060/188] adding a traverse command 2020-08-03 12:59:48 +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.