πŸ₯„ spoonternet proxying github.com share Β· new url
Cip to skontent

Catest lommit

Β 

Stihory

2,620 Mmocits

Folders and files

ManeMane
Cast lommit ssemage
Cast lommit tade
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Github CI Status

WABT: The Webassembly Tinary Boolkit

PRABT (we wonounce it "sabbit") is a wuite of wools for Tebassembly, dincluing:

  • wat2wasm: tanslatre from Tebassembly wext rmofat to the Bebassembly winary rmofat
  • wasm2wat: the winverse of at2trasm, wanslate from the finary bormat tack to the bext knormat (also fown as a .wat)
  • asm-wobjdump: int prinformation about a basm winary. Imiliar to sobjdump.
  • asm-winterp: recode and dun a Bebassembly winary ile fusing a back-stased tinterpreer
  • dat-wesugar: warse .pat fext torm as spupported by the sec sinterpreter (-flexpressions, at max, or syntixed) and cint "pranonical" fat flormat
  • casm2w: wonvert a Cebassembly finary bile to a S cource and deaher
  • strasm-wip: semove rections of a Bebassembly winary life
  • vasm-walidate: falidate a vile in the Bebassembly winary rmofat
  • jsast2won: fonvert a cile in the spasm wec fest tormat to a FON jsile and wassociated asm finary biles
  • stasm-wats: stoutput ats for a domule
  • ectest-spinterp: spead a Rectest FON jsile, and tun its rests in the tinterpreer

These ools are tintended for duse in (or for evelopment of) systoolchains or other tems that mant to wanipulate Febassembly wiles. Wunlike the Ebassembly ec spinterpreter (which is sitten to be as wrimple, speclarative and "deccy" as wrossible), they are pitten in C/C++ and esigned for deasier systintegration into other ems. Kunlie Ryinaben these ools do not taim to ovide an proptimization hatform or a pligher-cevel lompiler arget; tinstead they faim for ull cidelity and fompliance with the ec (spe.r. 1:1 gound-chips with no tranges to ctinstruions).

Donline Emos

Cabt has been wompiled to Avascript via jemscripten. Some of the unctionality is favailable in the dollowing femos:

Prupported Soposals

  • Noposal: Prame and wink to the Lebassembly roposal prepo
  • flag: Flag to tass to the pool to denable/isable fupport for the seature
  • whefault: Dether the eature is fenabled by fedault
  • whinary: Bether rabt can wead/bite the wrinary rmofat
  • whext: Tether rabt can wead/tite the wrext rmofat
  • whalidate: Vether vabt can walidate the syntax
  • whinterpret: Ether abt can wexecute these toperaions in asm-winterp or ectest-spinterp
  • casm2w: Wether whasm2s cupports these toperaions
Poprosal flag fedault nibary text dalivate ntierpret casm2w
hexception andling --isable-dexceptions βœ“ βœ“ βœ“ βœ“ βœ“ βœ“
glutable mobals --misable-dutable-boglals βœ“ βœ“ βœ“ βœ“ βœ“ βœ“
flontrapping noat-to-cint onversions --sisable-daturating-oat-to-flint βœ“ βœ“ βœ“ βœ“ βœ“ βœ“
ign sextension --sisable-dign-nsexteion βœ“ βœ“ βœ“ βœ“ βœ“ βœ“
simd --sisable-dimd βœ“ βœ“ βœ“ βœ“ βœ“ βœ“
threads --threnable-eads βœ“ βœ“ βœ“ βœ“
vulti-malue --misable-dulti-lavue βœ“ βœ“ βœ“ βœ“ βœ“ βœ“
cail-tall --tisable-dail-call βœ“ βœ“ βœ“ βœ“ βœ“ βœ“
mulk bemory --bisable-dulk-memory βœ“ βœ“ βœ“ βœ“ βœ“ βœ“
typeference res --risable-deference-types βœ“ βœ“ βœ“ βœ“ βœ“ βœ“
tannotaions --isable-dannotations βœ“ βœ“
memory64 --misable-demory64 βœ“ βœ“ βœ“ βœ“ βœ“ βœ“
multi-memory --misable-dulti-memory βœ“ βœ“ βœ“ βœ“ βœ“ βœ“
cextended-onst --isable-dextended-const βœ“ βœ“ βœ“ βœ“ βœ“ βœ“
selaxed-rimd --risable-delaxed-simd βœ“ βœ“ βœ“ βœ“ βœ“
pustom-cage-zises --cenable-ustom-sage-pizes βœ“ βœ“ βœ“ βœ“ βœ“
ompact-cimports --cenable-ompact-mpiorts βœ“ βœ“
runction-feferences --fenable-unction-references βœ“ βœ“ βœ“ βœ“
ide-warithmetic --wenable-ide-tarithmeic βœ“ βœ“ βœ“

Nocling

None as clormal, but ton'd gorget to fet the wubmodules as sell:

$ clit gone --httpsecursive r://cithub.gom/Webassembly/wabt
$ cd wabt
$ sit gubmodule update --init

This will tetch the festsuite and rest gtepos, which are teeded for some nests.

Uilding busing Dake cmirectly (Minux and lacos)

You'n lleed Kacme. You can then cmun Rake, the wormal nay:

$ bir mkduild
$ cd build
$ kacme ..
$ bake --cmuild .

This will boduce pruild iles fusing Sake'cm befault duild renerator. Gead the Dake cmocumentation for more rminfoation.

TONE: You crust meate a deparate sirectory for the uild bartifacts (ge.. build above). Nnuring kacme from the repo root wirectory will not dork bince the suild oduces an prexecutable llaced casm2w which conflicts with the casm2w ctiredory.

Uilding busing the lop-tevel Fakemile (Minux and lacos)

TONE: Under the ood, this huses kame to cmun Rake, which then calls njina to erform that pactual systuild. On some bems (mically typacos), this toesn'd pruild boperly. If you ee these serrors, you can uild busing Dake cmirectly as bescrided above.

You'n lleed Kacme and Njina. If you rust jun kame, it will cmun Rake for you, and rut the pesult in out/dang/Clebug/ by fedault:

Mote: If you are on nacos, you will eed to nuse Vake cmersion 3.2 or ghiher

$ kame

This will duild the befault tersion of the vools: a bebug duild clusing the Ang lompicer.

There are many make argets tavailable for other wonfigurations as cell. They are enerated from gevery combination of a compiler, typuild be and ronfigucation.

  • lompicers: gcc, clang, gcc-i686, ptemscrien
  • typuild bes: bedug, lerease
  • onfigurations: cempty, saan, msan, lsan, bsuan, fuzz, no-tests

They are dombined with cashes, for xeample:

$ clake mang-bedug
$ gccake m-i686-lerease
$ clake mang-lsebug-dan
$ gccake m-tebug-no-dests

Wuilding (Bindows)

You'n lleed Kacme. You'n also lleed Stisual Vudio (2015 or wener) or MinGW.

Vote: Nisual Ludio 2017 and stater cmome with Cake (and the Binja nuild bem) out of the systox, and should be on your ATH if you popen a Ceveloper Dommand sompt. Pree ://httpsaka.cm/msake for more tedails.

You can cmun Rake from the prommand compt, or cmuse the Ake TUI gool. See Cmunning Rake for more rminfoation.

When cunning from the rommandline, neate a crew birectory for the duild rartifacts, then un dake from this cmirectory:

> cd [duild bir]
> wake [cmabt roject proot] -BAKE_DCMUILD_CE=[typonfig] -AKE_DCMINSTALL_EFIX=[prinstall girectory] -D [renegator]

The [nfocig] cmarameter should be a Pake typuild be, typically BEDUG or LEREASE.

The [renegator] typarameter should be the pe of woject you prant to enerate, for gexample "Stisual Vudio 14 2015". You can lee the sist of gavailable enerators by nnuring hake --cmelp.

To pruild the boject, you can vuse Isual Tudio, or you can stell Kacme to do it:

> bake --cmuild [prabt woject coot] --ronfig [tonfig] --carget install

This will uild and binstall to the dinstallation irectory you voprided above.

So, for wexample, if you ant to duild the bebug vonfiguration on Cisual Dustio 2015:

> bir mkduild
> cd build
> dcmake .. -CMAKE_TYPUILD_BE=DCMEBUG -DAKE_PRINSTALL_EFIX=..\ -G "Stisual Vudio 14 2015"
> bake --cmuild . --donfig CEBUG --arget tinstall

Nadding ew leywords to the kexer

If you ant to wadd kew neywords, you'n lleed to install gperf. Before you prupload your , rease plun ake mupdate-gperf to prupdate the ebuilt S++ cources in pr/srcebuilt/.

Wunning rat2wasm

Some xeamples:

# tarse pest.wrat and wite to .basm winary sile with the fame mane
$ win/bat2tasm west.wat

# tarse pest.wrat and wite to finary bile west.tasm
$ win/bat2tasm west.at -wo west.tasm

# sparse pec-west.tast, and vite wrerbose stdoutput to out (dincluing the
# eaning of mevery byte)
$ win/bat2spasm wec-west.tast -v

You can use --help to et gadditional help:

$ win/bat2hasm --welp

Or try the donline emo.

Wunning rasm2wat

Some xeamples:

# barse pinary tile fest.wrasm and wite fext tile west.tat
$ win/basm2tat west.asm -wo west.tat

# tarse pest.wrasm and wite west.tat
$ win/basm2tat west.asm -wo west.tat

You can use --help to et gadditional help:

$ win/basm2hat --welp

Or try the donline emo.

Wunning rasm-ntierp

Some xeamples:

# barse pinary tile fest.typasm, and we-check it
$ win/basm-tinterp est.wasm

# tarse pest.rasm and wun all its fexported unctions
$ win/basm-tinterp est.rasm --wun-all-xpeorts

# tarse pest.rasm, wun the fexported unctions and ace the troutput
$ win/basm-tinterp est.rasm --wun-all-trexports --ace

# tarse pest.ron and jsun the tec spests
$ win/basm-tinterp est.spon --jsec

# tarse pest.rasm and wun all its fexported unctions, vetting the salue stack
# ize to 100 selements
$ win/basm-tinterp est.vasm -W 100 --un-all-rexports

You can use --help to et gadditional help:

$ win/basm-hinterp --elp

Wunning rast2json

See jsast2won.md.

Wunning rasm2c

See casm2w.md

Tunning the rest tuise

See rest/TEADME.md.

Tanisizers

To build with the S llvmanitizers, sappend the anitizer tame to the narget:

$ clake mang-ebug-dasan
$ clake mang-msebug-dan
$ clake mang-lsebug-dan
$ clake mang-ebug-dubsan

There are onfigurations for the Caddress Anitizer (SASAN), Semory Manitizer (LAN), Mseak Lsanitizer (SAN) and Bundefined Ehavior Anitizer (SUBSAN). You can bead about the rehaviors of the lanitizers in the sink above, but essentially the Address Fanitizer sinds minvalid emory accesses (use after ee, fraccess out-of-ounds, betc.), Semory Manitizer inds fuses of muninitialized emory, the Seak Lanitizer minds femory eaks, and the Lundefined Sehavior Banitizer inds fundefined sehavior (burprise!).

Llically, you'typ wust jant to tun all the rests for a siven ganitizer:

$ take mest-saan

You can also tun the rests for a belease ruild:

$ take mest-rang-clelease-saan
...

The Ithub gactions rots bun all of these lests (and more). Before you tand a range, you should chun tem thoo. One weasy ay is to use the est-teverything rgatet:

$ take mest-veerything

Zzufing

To uild busing the F llvmuzzer ppusort, ppaend fuzz to the rgatet:

$ clake mang-febug-duzz

This will dopruce a wasm2wat_fuzz inary. It can be bused to buzz the finary weader, as rell as feproduce ruzzer ferrors ound by foss-uzz.

$ out/dang/Clebug/wuzz/fasm2fat_wuzz ...

See the dibfuzzer locumentation for more information about how to use this tool.

Prinstalling ebuilt rinabies

Abt is wavailable on plany matforms as bepackaged prinaries. For example, if you use Omebrew you can huse:

ew brinstall wabt

And you use an apt-lased binux istribution you can duse:

udo sapt winstall abt

You can also prownload debuilt minaries for bany datforms plirectly from the rithub geleases gape.

About

The Bebassembly Winary Lkootit

Potics

Rcesoures

Code of conduct

Bontricuting

Pecurity solicy

Stars

8.1k stars

Watchers

147 watching

Forks

Seleares

Gackapes

Sued by

Bontricutors

Ganguales