Firstly you won't want to be using `--target=wasm64` at all right now, it
is experimental and not supported by any engines yet.    Lucky `em++
--cflags` is going to contain its own `--target=wasm32-unknown-emscripten`
so that is probably unrelated to your current failure.

Secondly, if you want emcc to produce bitcode you can simply add
`-emit-llvm` to you normal emcc command:
  em++ -c -emit-llvm -S <file>.cpp -o <file>.ll
or
  em++ -c -emit-llvm <file>.cpp -o <file>.bc

If you want to combine the bitcode files into a single large bitcode file
we do also still have legacy support for that via the `-r` + `-flto` flags.

  em++ -r -flto  <file1>.bc <file2>.bc -o whole-program.bc

But this kind of bitcode linking has some caveats and I would not
recommend it.  Avoid it if you can.

cheers,
sam



On Tue, Nov 3, 2020 at 4:36 PM Yugesh Kothari <[email protected]>
wrote:

> Hi,
>
> I am trying to look for a way to compile C/C++ source written with
> emsripten headers to LLVM IR (.ll or .bc) and then subsequently use smack (
> https://github.com/smackers/smack) to get it to boogie. I use the command
> :
>
> emsdk/upstream/bin/clang++ --target=wasm64 `em++ --cflags` -emit-llvm -S
> <file>.cpp -o <file>.ll
>
> which runs. But then when I try to use smack I get this error:
> "Exception: Problem reading input bitcode/IR: Invalid record".
>
> I run into the same problem if I try to compile down the above llvm to an
> executable using llc.
>
> I suspect this has something to do with how I originally compiled my C++
> source. Can someone suggest what is the "right" way to get LLVM IR and
> .js+.wasm instead of just the latter?
>
> Thanks!
>
> --
> You received this message because you are subscribed to the Google Groups
> "emscripten-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/emscripten-discuss/003bfb97-7658-4291-93b0-46f8ec3cd03cn%40googlegroups.com
> <https://groups.google.com/d/msgid/emscripten-discuss/003bfb97-7658-4291-93b0-46f8ec3cd03cn%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/emscripten-discuss/CAL_va2-wfzfd9BaBwQVTN3RxKftsixNm5aSmBs%3DkCn5b%3DcG%3DsQ%40mail.gmail.com.

Reply via email to