https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88999
--- Comment #4 from sandra at gcc dot gnu.org --- I've been taking another look at this issue. It looks like the trouble is that the "checking for S_ISREG or S_IFREG" test in the configure script is failing because it tries to link the test program without specifying an appropriate linker script. Newlib with GDB semihosting ought to support S_IFREG, and indeed the program makes it through the compilation step without complaint only to fail because the default linker script isn't pulling in the semihosting library. I imagine this problem might affect other bare-metal targets that have to be linked explicitly with a BSP, too. Anyway, std::__basic_file<char>::showmanyc returns 0 when neither _GLIBCXX_HAVE_S_ISREG nor _GLIBCXX_HAVE_S_IFREG is defined, which causes in_avail() to return 0 as well. I've also found a bug in the nios2 libgloss implementation of lseek (it doesn't encode negative offsets correctly), but lseek is never even getting called here.