search for: linuxprogramstartup

Displaying 2 results from an estimated 2 matches for "linuxprogramstartup".

2019 May 03
2
Cross compiling an empty program results in a segfault
...s, Eli. That was really helpful. On Fri, Apr 12, 2019 at 9:31 PM Eli Friedman <efriedma at quicinc.com> wrote: > “--entry main” is not going to do what you want; the entry point for a > Linux program is not equivalent to the C “main”. > http://dbp-consulting.com/tutorials/debugging/linuxProgramStartup.html > has a description of how a C program normally starts on Linux. > > > > Generally, to build a C program, you don’t want to invoke the linker > directly; instead, use clang to invoke the linker correctly. This will > pass the appropriate flags and link against the appropr...
2019 Apr 10
2
Cross compiling an empty program results in a segfault
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