Bug 71155 - symbol in wrong section .data.rel.local on mips64el
Summary: symbol in wrong section .data.rel.local on mips64el
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 4.9.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
Depends on:
Reported: 2016-05-16 22:50 UTC by Aurelien Jarno
Modified: 2020-02-02 19:11 UTC (History)
0 users

See Also:
Host: mips64el-linux-gnuabi64
Target: mips64el-linux-gnuabi64
Build: mips64el-linux-gnuabi64
Known to work: 4.8.5
Known to fail: 4.9.3, 5.3.1, 6.1.1, 7.0
Last reconfirmed: 2020-02-02 00:00:00

preprocessed source file (46.81 KB, text/plain)
2016-05-16 22:50 UTC, Aurelien Jarno

Note You need to log in before you can comment on or make changes to this bug.
Description Aurelien Jarno 2016-05-16 22:50:25 UTC
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:

I have attached the preprocessed source file, the original source file can be found there:
Comment 1 Andrew Pinski 2020-02-02 19:11:14 UTC
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?