Re: Converting assembly language to bitcode

Hi Bryce,

Unfortunately, any object file generated from x86/ARM/etc. assembly input
cannot easily be converted to WebAssembly. You'll probably need to
configure the build scripts differently; none of the x86 source files
should be included.

It does seem as though they have C language fallbacks for some of these
functions (e.g.
https://github.com/cisco/openh264/blob/6fe15a6b82d492bebe388c55b7ee5131208e7334/codec/encoder/core/inc/set_mb_syn_cavlc.h#L78).
So you should be able to make this compile by disabling some #defines.

Good luck!
-Ben

On Mon, Sep 23, 2019 at 5:13 PM Bryce Tham <brycetham@gmail.com> wrote:

> Hi all,
>
> I'm trying to compile OpenH264 (https://github.com/cisco/openh264) with
> Emscripten so I can use it in my own C++ project. Running the command
> `emmake make` from the root directory yields several warnings such as the
> following:
>
> emcc:WARNING: codec/encoder/core/x86/coeff.o is not a valid input file
>
> Upon closer inspection, this is because the file `coeff.o` is the result
> of assembling another file `coeff.asm` in the same folder. The assembler
> used is NASM (https://www.nasm.us/), and the command used to produce
> `coeff.o` is the following:
>
> nasm -DUNIX64 -DHAVE_AVX2 -f elf64 -I./codec/common/x86/   -o
> codec/encoder/core/x86/coeff.o codec/encoder/core/x86/coeff.asm
>
> Is there any way to make coeff.o usable by Emscripten? From what I know,
> the resulting output file needs to be in bitcode for Emscripten to
> recognize it..
>
> I've tried using McSema (https://github.com/trailofbits/mcsema) to lift
> `coeff.o` but it is incompatible with the latest version of IDA Pro and I
> can't figure out a way to downgrade it. I've also looked at llvm-as (
> https://llvm.org/docs/CommandGuide/llvm-as.html) but it looks like it
> requires the input file to be written strictly in LLVM assembly language.
>
> Thanks in advance!
>
> Sincerely,
> Bryce
>

Received on Monday, 30 September 2019 14:05:31 UTC