Can a bc file generated by the windows version llvm run with the linux version llvm?

I generated a bc with a windows version llvm, and wanted to run it with a linux version llvm. However, it can’t.

LLVM IR has a unify format, doesn’t it? why can’t a bc file be recognized by llvm backend?

Thank you.

LLVM IR is machine-independent. That doesn’t mean it is portable between different environments.

Things that can make an IR file not portable between different OSes include:

  • different sizes or alignments for data types
  • different struct layout and padding, even for structs declared identically in C
  • different encoded names of C or C++ functions from external libraries (even as simple as _ or not)
  • different values for #defines and enums from system headers
  • completely different members, layout, sizes in structs from system headers