<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">Hm, I don’t see any inherent problems with splitting compilation like this, although it’s not something we test. The only thing I could think of is that Swift uses a custom calling convention on some platforms, but I would expect clang++ to refuse to compile the bc file at all if that were the issue. Mind filing a bug at <a href="https://bugs.swift.org" class="">https://bugs.swift.org</a>&nbsp;?</div><div class=""><br class=""></div><div class="">Thanks,</div><div class="">Jordan</div><div class=""><br class=""></div><br class=""><div><blockquote type="cite" class=""><div class="">On Sep 21, 2017, at 13:42, Jeffrey W via swift-users &lt;<a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Hi swift team,<div class=""><br class=""></div><div class="">I download the prebuilt swift 4.0 from <a href="https://swift.org/builds/swift-4.0-release/ubuntu1404/swift-4.0-RELEASE/swift-4.0-RELEASE-ubuntu14.04.tar.gz" class="">here</a>&nbsp;and try to do some work on the generated LLVM BC. However, I got a seg fault when running the binary executable compiled from bitcode as shown below:</div><div class=""><br class=""></div><div class=""><font color="#0000ff" face="monospace, monospace" class="">$ cat hello.swift<br class=""></font></div><div class=""><div class=""><font color="#0000ff" face="monospace, monospace" class="">print("Hello World")</font></div><div class=""><font color="#0000ff" face="monospace, monospace" class="">$ swiftc hello.swift -emit-bc -o hello.bc</font></div><div class=""><font color="#0000ff" face="monospace, monospace" class="">$ clang++ hello.bc -c -o hello.o</font></div><div class=""><font color="#0000ff" face="monospace, monospace" class="">$ swiftc hello.o -o hello</font></div><div class=""><font color="#0000ff" face="monospace, monospace" class="">$ ./hello</font></div><div class=""><font color="#0000ff" face="monospace, monospace" class="">Segmentation fault (core dumped)</font></div><div class=""><br class=""></div><div class="">It works fine if no bitcode file is involved here.</div><div class=""><br class=""></div><div class=""><font color="#0000ff" face="monospace, monospace" class="">$ swiftc hello.swift -c -o hello.o</font></div><div class=""><font color="#0000ff" face="monospace, monospace" class="">$ swiftc hello.o -o hello</font></div><div class=""><font color="#0000ff" face="monospace, monospace" class="">$ ./hello</font></div><div class=""><font color="#0000ff" face="monospace, monospace" class="">Hello World</font></div><div class=""><br class=""></div><div class="">I am running Ubuntu&nbsp;14.04.3 (kernel 4.8.0). I also encountered the same seg fault if I use the prebuilt swift 3.1.1</div></div><div class=""><br class=""></div><div class="">Is it the right way to compile the bitcode generated from swift? Or is it a bug in swift ?</div><div class=""><br class=""></div><div class="">Thanks a lot in advance!</div><div class=""><br class=""></div><div class="">Best regards,</div><div class="">Jeffrey</div><div class=""><br class=""></div></div>
_______________________________________________<br class="">swift-users mailing list<br class=""><a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-users<br class=""></div></blockquote></div><br class=""></body></html>