[llvm-dev] What is the difference between bitcode file and naive output file which is compiled with -flto option from same c file?

zxl via llvm-dev llvm-dev at lists.llvm.org
Sun Dec 26 20:57:23 PST 2021


Hello everyone:    I have known that when a file(for example: a.c) is compiled with -flto flag, llvm will output a bitcode file(a.o), command is (clang -flto -c a.c -o a.o). Then I compile same file to bitcode file a.bc, command is (clang -emit-llvm -o a.bc -c a.c). I want to know what difference between a.o and a.bc ?
a.c content is like below:
```
#include "a.h"


static signed int i = 0;


void foo2(void) {
  i = -1;
}


static int foo3() {
  foo4();
  return 10;
}


int foo1(void) {
  int data = 0;


  if (i < 0)
    data = foo3();


  data = data + 42;
  return data;
}

```
Thanks
lzx
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20211227/c2136bd7/attachment.html>


More information about the llvm-dev mailing list