[llvm-dev] Cross compiling an empty program results in a segfault

Ivan Medoedov via llvm-dev llvm-dev at lists.llvm.org
Wed Apr 10 13:28:06 PDT 2019


Hello,

I'm trying to cross compile an empty program on macOS for Linux:

cat test.c

int main() {
        int a = 2+3;
        return 0;
}

clang -o -c -target x86_64-linux-gnu test.c

If I copy the resulting test.o to the Linux machine and run clang test.o,
it works fine.

However if I try to link it on macOS, I get a segfault when I launch ./a.out

ld.lld --entry main test.o

[copy a.out to Linux]

./a.out
segmentation fault 0x00000000001 in ?? ()

Would really appreciate your help here!

Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190410/d4acb188/attachment.html>


More information about the llvm-dev mailing list