[libc] Add getc, ungetc, fflush to enable libc++ iostream on baremetal (#175530)

After https://github.com/llvm/llvm-project/pull/168931 landed getc,
ungetc and fflush are still missing at link time while trying to make
libc++ std::cout work with LLVM libc on baremetal.

ungetc implementation is very minimal only to cover the current standard
streams implementation from the patch above.

GitOrigin-RevId: 907eb11cc128630c52cd2191b925873b6ee56d6e
9 files changed