Clang fixed a bug that was masking the fact that these macros aren't
always defined in cases we care about. Just define our own version of
them for these tests.
rdar://127427660
The _swift5_entry section contains a relative pointer to the entry-point
function (spelled variously _main and @main depending on context).
Support differentiating whether that entry point originates from a type
annotated @main or something else (i.e. main.swift) via a second
relative-pointer-sized field. For now, that field is just a bit: 1 if
there is a type annotated @main, 0 otherwise. In the future, that field
could be a relative pointer to the type descriptor for the type.
Previously, the test was limited to only x86_64 macos. Remove that
limitation by introducing the appropriate cross-platform typedef for
mach_header and signing the pointer before casting it to a function
pointer.
To enable lookup of the entry point, emit a pointer to that entry point
into a new section; on MachO, the __swift5_entry section of the __TEXT
segment.
rdar://problem/66402358