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@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@swift.org
> https://lists.swift.org/mailman/listinfo/swift-users

_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users

Reply via email to