[swift-users] Segmentation fault when running binary executable compiled from LLVM bitcode on Linux

Jordan Rose jordan_rose at apple.com
Thu Sep 21 18:05:03 CDT 2017


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 https://bugs.swift.org <https://bugs.swift.org/> ?

Thanks,
Jordan


> On Sep 21, 2017, at 13:42, Jeffrey W via swift-users <swift-users at swift.org> wrote:
> 
> Hi swift team,
> 
> I download the prebuilt swift 4.0 from here <https://swift.org/builds/swift-4.0-release/ubuntu1404/swift-4.0-RELEASE/swift-4.0-RELEASE-ubuntu14.04.tar.gz> 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:
> 
> $ cat hello.swift
> print("Hello World")
> $ swiftc hello.swift -emit-bc -o hello.bc
> $ clang++ hello.bc -c -o hello.o
> $ swiftc hello.o -o hello
> $ ./hello
> Segmentation fault (core dumped)
> 
> It works fine if no bitcode file is involved here.
> 
> $ swiftc hello.swift -c -o hello.o
> $ swiftc hello.o -o hello
> $ ./hello
> Hello World
> 
> I am running Ubuntu 14.04.3 (kernel 4.8.0). I also encountered the same seg fault if I use the prebuilt swift 3.1.1
> 
> Is it the right way to compile the bitcode generated from swift? Or is it a bug in swift ?
> 
> Thanks a lot in advance!
> 
> Best regards,
> Jeffrey
> 
> _______________________________________________
> swift-users mailing list
> swift-users at swift.org
> https://lists.swift.org/mailman/listinfo/swift-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20170921/fdf3faf2/attachment.html>


More information about the swift-users mailing list