Created attachment 38503 [details] preprocessed source file When compiling the GNU libc on mips64el-linux-gnuabi64 with GCC >= 4.9, the resulting libc causes lua 5.2 to not work correcty. It happens this is due to wrong the compilation of libio/oldstdfiles.c. When using GCC <= 4.8, the _IO_stdin_ symbol ends up in the data.rel section just like _IO_stdout_ and _IO_stderr_. When using GCC >= 4.9, the _IO_stdin_ symbol is moved to the .data.rel.local section, while the two others are unchanged. This is also reproducible with GCC 5 and GCC 6. The issue seems to have been introduced by the following patch: https://gcc.gnu.org/ml/gcc-patches/2014-01/msg01169.html I have attached the preprocessed source file, the original source file can be found there: https://sourceware.org/git/?p=glibc.git;a=blob;f=libio/oldstdfiles.c;h=609b7d9ef2d78f851a29b3d25efbb03f9c76ca91;hb=HEAD
The change was correct. _IO_stdin_ has only a reference to _IO_stdfile_0_lock which means _IO_stdin_ should be in the .data.rel.local section; the _IO_stdfile_0_lock is local to that TU. While _IO_stdout_ has a reference to _IO_stdin_ which means it is in the .data.rel section (likewise for _IO_stderr_). So if something is failing, it was a latent bug somewhere else. What is the incorrect behavior of Lau here?