> Date: Sat, 22 Oct 2022 11:14:34 +0200 > From: Heinrich Schuchardt <xypron.g...@gmx.de> > > Hello Simon, > > when running ./u-boot -T -l and issuing the poweroff command a crash occurs: > > os_exit() results in std::ostream::flush() calling U-Boot's fflush with > file = -138447008 (or any other negative number) > > Man fflush shows the following definition: > > int fflush(FILE *stream); > > U-Boot's fflush() is defined as > > void fflush(int file); > > The pointer FILE *stream is truncated to int which may result in a > negative number when invoking U-Boot's fflush() but anyway we want > std::ostream::flush() to invoke glibc's fflush(). > > Can we ensure correct linking or do we have to rename fflush()?
Probably have to rename it. The name is reserved by the ISO C standard, at least when building in a non-freestanding environment. And the sandbox stuff means that U-Boot isn't always compiled in a free-standing environment. I do wonder though how you end up building the sandbox with a C++ compiler. There is some logic in the build system (inherited from the Linux kernel?) to build host tools with C++. But I'd hope the sandbox doesn't use that.