GitXplorerGitXplorer
j

llir3

public
2 stars
1 forks
0 issues

Commits

List of commits on branch master.
Verified
5851f8c8afd892ac03603929668fb0150ba3b956

Add the group attribute definitions

jjustinclift committed 6 years ago
Verified
1fba435f4ebda3fcb5c350574e1eb66253c359fa

Added function attributes

jjustinclift committed 6 years ago
Verified
6274ebb03804a42ab723d0985644df395bb5cc7c

Set Datalayout, TargetTriple, and SourceFilename

jjustinclift committed 6 years ago
Verified
a4b6c10de23a6a5acd2c76d3e9aa8d1515b86772

Added debug target locations to the LLVM IR

jjustinclift committed 6 years ago
Verified
42444c70f743711fd3b8b1ee9ce3a8d17bacfa55

Updated Go code for the target.ll generated on my system

jjustinclift committed 6 years ago
Verified
cd6f54c6a7eb4080115eb291cf314c948654c5e8

Added the initial ll target we're aiming to replicate

jjustinclift committed 6 years ago

README

The README file for this repository.

This is the Go code from Step 3 of:

https://github.com/llir/llvm/issues/86#issuecomment-498357924

Being worked on to add enough DWARF metadata, so that -g on the clang command line works and embeds decent ".debug_*" sections.

When main.go is run, it will generate an LLVM IR file to stdout, so you'll probably want to redirect it to a file:

$ go run main.go > foo.ll

This .ll file can be compiled to a Linux executable using clang:

$ clang --target=x86_64-pc-linux-gnu -g -Wno-override-module -o foo foo.ll

To view the DWARF debugging sections, use llvm-dwarfdump:

$ llvm-dwarfdump -color foo | more

The goal is to add DWARF to Wasm binaries, so a working debugger for Wasm can be created.

A working command to generate Wasm from the .ll is:

$ clang --compile --target=wasm32-unknown-unknown-wasm -g -Wno-override-module -o foo.wasm foo.ll

Note that the --compile option to clang is required. Without it, clang will attempt to link the Wasm for the current system, and fail:

$ clang --target=wasm32-unknown-unknown-wasm -g -Wno-override-module -o foo.wasm foo.ll
wasm-ld: error: unknown file type: /lib/crt1.o
wasm-ld: error: unable to find library -lc
wasm-ld: error: cannot open /opt/llvm8-wasm/lib/clang/8.0.1/lib/libclang_rt.builtins-wasm32.a: No such file or directory
clang-8: error: lld command failed with exit code 1 (use -v to see invocation)