Hide __cpu_indicator_init/__cpu_model from linker
authorH.J. Lu <hongjiu.lu@intel.com>
Fri, 17 Apr 2015 12:58:07 +0000 (12:58 +0000)
committerH.J. Lu <hjl@gcc.gnu.org>
Fri, 17 Apr 2015 12:58:07 +0000 (05:58 -0700)
commitabd0cdc9c07c92d6cab15afc4fd38945d536751b
tree65719a14085bffae4c5e478b099f6bf4f54ba60d
parent05b1fb220b74c1a00ff7657e00f9a1e7a798acdf
Hide __cpu_indicator_init/__cpu_model from linker

We shouldn't call external function, __cpu_indicator_init, while an object
is being relocated since its .got.plt section hasn't been updated.  It
works for non-PIE since no update on .got.plt section is required.  This
patch creates libgcc.so as a linker script, hides __cpu_indicator_init
and __cpu_model in libgcc.so.1 from linker, forces linker to resolve
__cpu_indicator_init and __cpu_model to their hidden definitions in
libgcc.a while providing backward binary compatibility.

gcc/testsuite/

PR target/65612
* g++.dg/ext/mv18.C: New test.
* g++.dg/ext/mv19.C: Likewise.
* g++.dg/ext/mv20.C: Likewise.
* g++.dg/ext/mv21.C: Likewise.
* g++.dg/ext/mv22.C: Likewise.
* g++.dg/ext/mv23.C: Likewise.

libgcc/

PR target/65612
* config.host (tmake_file): Add t-slibgcc-libgcc for Linux/x86.
* config/i386/cpuinfo.c (__cpu_model): Initialize.
(__cpu_indicator_init@GCC_4.8.0): New.
(__cpu_model@GCC_4.8.0): Likewise.
* config/i386/t-linux (HOST_LIBGCC2_CFLAGS): Add
-DUSE_ELF_SYMVER.

From-SVN: r222178
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/ext/mv18.C [new file with mode: 0644]
gcc/testsuite/g++.dg/ext/mv19.C [new file with mode: 0644]
gcc/testsuite/g++.dg/ext/mv20.C [new file with mode: 0644]
gcc/testsuite/g++.dg/ext/mv21.C [new file with mode: 0644]
gcc/testsuite/g++.dg/ext/mv22.C [new file with mode: 0644]
gcc/testsuite/g++.dg/ext/mv23.C [new file with mode: 0644]
libgcc/ChangeLog
libgcc/config.host
libgcc/config/i386/cpuinfo.c
libgcc/config/i386/t-linux