> Note that it is assumed that a freestanding environment will additionally provide memcpy, memmove, memset, and memcmp implementations, as these are needed for efficient codegen for many programs.
GCC has effectively the same stipulation[1]:
> GCC requires the freestanding environment provide memcpy, memmove, memset and memcmp.
The main thing I'm confused about is why you didn't get a linker error.
0. https://clang.llvm.org/docs/CommandGuide/clang.html#cmdoptio...
EFI isn't your usual Freestanding env. Your output is a dynamically linked PE2 (Windows) executable. The linker had spots for memcpy and others to be linked in Dynamically. But they were not. Whatever was there caused a hang in TianoCore UEFI. (Which would eventually reset due to the watchdog timer)
so does gcc, it's pretty much a requirement of the C standard. https://gcc.godbolt.org/z/aaE5hn
Why would the C standard mandate the presence of standard library functions in a freestanding environment? I always assumed compilers emitting calls to mem* functions were doing it because it was the easy solution just like linking to libgcc.