<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">Hello,<div><br></div><div>I'm trying to cross compile an empty program on macOS for Linux:</div><div><br></div><div>cat test.c</div><div><br></div><div><div>int main() {</div><div>        int a = 2+3;</div><div>        return 0;</div><div>}</div></div><div><br></div><div>clang -o -c -target x86_64-linux-gnu test.c<br></div><div><br></div><div>If I copy the resulting test.o to the Linux machine and run clang test.o, it works fine.</div><div><br></div><div>However if I try to link it on macOS, I get a segfault when I launch ./a.out</div><div><br></div><div>ld.lld --entry main test.o<br></div><div><br></div><div>[copy a.out to Linux]</div><div><br></div><div>./a.out</div><div>segmentation fault 0x00000000001 in ?? ()</div><div><br></div><div>Would really appreciate your help here!</div><div><br></div><div>Thanks</div></div></div></div></div>