Are llvm-gcc and clang binary compatible with gcc? - particularly mingw gcc on Windows

后端 未结 5 769
旧时难觅i
旧时难觅i 2020-12-14 07:30

If I build a static library with llvm-gcc, then link it with a program compiled using mingw gcc, will the result work?

The same for other combinations of llvm-gcc, c

5条回答
  •  时光取名叫无心
    2020-12-14 08:03

    Hopefully they fixed it but I avoid llvm-gcc because I (also) use llvm as a cross compiler and when you use llvm-gcc -m32 on a 64 bit machine the -m32 is ignored and you get 64 bit ints which have to be faked on your 32 bit target machine. Clang does not have that bug nor does gcc. Also the more I use clang the more I like. As to your direct question, dont know, in theory these days targets have well known or used calling conventions. And you would hope both gcc and llvm conform to the same but you never know. the simplest way to find this out is to write a couple of simple functions, compile and disassemble using both tool sets and see how they pass operands to the functions.

提交回复
热议问题