[prev in list] [next in list] [prev in thread] [next in thread] 

List:       llvm-dev
Subject:    [llvm-dev] What is the difference between bitcode file and naive output file which is compiled with 
From:       zxl via llvm-dev <llvm-dev () lists ! llvm ! org>
Date:       2021-12-27 4:57:23
Message-ID: tencent_DB77408C4D36FAAC7E830CA83D2E7FCC520A () qq ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]

[Attachment #4 (text/plain)]

Hello everyone:&nbsp; &nbsp; 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) {
&nbsp; i = -1;
}


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


int foo1(void) {
&nbsp; int data = 0;


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


&nbsp; data = data + 42;
&nbsp; return data;
}

```
Thanks
lzx


[Attachment #5 (text/html)]

Hello everyone:<div>&nbsp; &nbsp; 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 ?</div><div>a.c content is like below:<br>```</div><div><div>#include \
"a.h"</div><div><br></div><div>static signed int i = 0;</div><div><br></div><div>void \
foo2(void) {</div><div>&nbsp; i = -1;</div><div>}</div><div><br></div><div>static int \
foo3() {</div><div>&nbsp; foo4();</div><div>&nbsp; return \
10;</div><div>}</div><div><br></div><div>int foo1(void) {</div><div>&nbsp; int data = \
0;</div><div><br></div><div>&nbsp; if (i &lt; 0)</div><div>&nbsp; &nbsp; data = \
foo3();</div><div><br></div><div>&nbsp; data = data + 42;</div><div>&nbsp; return \
data;</div><div>}</div></div><div>```</div><div>Thanks</div><div>lzx</div><div><div \
style="color: rgb(212, 212, 212); background-color: rgb(30, 30, 30); font-family: \
Menlo, Monaco, &quot;Courier New&quot;, monospace; font-size: 12px; line-height: \
18px; white-space: pre;"><div></div></div></div>


[Attachment #6 (text/plain)]

_______________________________________________
LLVM Developers mailing list
llvm-dev@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic