int main(int argc, char **argv)
{
return 0;
}
I cross compile (host= linux x86_64, target= linux aarch64)
/path/to/clang --target=aar
You must compile with the option -nodefaultlib or -nostdlibs.
Here a quote from GCC documentation (clang interface is just the same):
One of the standard libraries bypassed by
-nostdliband-nodefaultlibsislibgcc.a, a library of internal subroutines which GCC uses to overcome shortcomings of particular machines, or special needs for some languages.
You may have to execute c++ static initialization routines and/or use what is provided by the object files crt in the lib directory. These files are part of libc and provides executable entry point.