Skip to content

Utils to manage DWARF information in mutating wasm files

Notifications You must be signed in to change notification settings

yurydelendik/wtmaps-utils

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Set of utils to preserve WebAssembly DWARF information generated by LLVM

Utils

wtmaps

Generate identify .map file based on the wasm file. This file can be used later to append DWARF to the post-processed wasm.

wdwarf-cp

Marges initial DWARF, wasm .map file and placed that into post-processed wasm.

Example

$ cat fib2.c
int fib(int n) {
  int i, t, a = 0, b = 1;
  for (i = 0; i < n; i++) {
    t = a;
    a = b;
    b += t;
  }
  return b;
}

void test() {
  fib(6);
}

# Build wasm file with DWARF info
$ clang -g fib2.c -Wl,-no-entry,--export=test,--export=fib -nostdlib -o fib2.wasm

# Generate identity .map file
$ cargo run --bin wtmaps fib2.wasm -o fib2.map

# Optimize wasm using binaryen, provide initial/identity .map file and produce .map w/post-processed wasm
$ wasm-opt fib2.wasm -o fib2_o.wasm -ism fib2.map -osm fib2_o.map

# Merge post-processed fib2_o.wasm with original DWARF information (from fib2.wasm) trasformed using fib2_o.map. 
$ cargo run --bin wdwarf-cp fib2.wasm -o fib2_t.wasm -m fib2_o.map -w fib2_o.wasm

About

Utils to manage DWARF information in mutating wasm files

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages