Add hidden_tls_def macros, fix powerpc-soft build with GCC 9.

Soft-float powerpc fails to build with current GCC mainline because of
use of libc_hidden_data_def for TLS variables, resulting in a non-TLS
alias being defined, to which the tls_model attribute is now copied,
resulting in a warning about it being ignored.

The problem here appears to be the non-TLS alias.  This patch adds a
hidden_tls_def macro family, corresponding to the hidden_tls_proto
macros, to define TLS aliases properly in such a case, and uses it for
those powerpc soft-float variables.

Tested with build-many-glibcs.py compilers build for powerpc-linux-gnu
soft-float.  Also tested for x86_64.

	* include/libc-symbols.h [SHARED && !NO_HIDDEN && !__ASSEMBLER__]
	(__hidden_ver2): New macro.  Use old definition of __hidden_ver1
	with additional parameter thread.
	[SHARED && !NO_HIDDEN && !__ASSEMBLER__] (__hidden_ver1): Define
	in terms of __hidden_ver2.
	(hidden_tls_def): New macro.
	(libc_hidden_tls_def): Likewise.
	(rtld_hidden_tls_def): Likewise.
	(libm_hidden_tls_def): Likewise.
	(libmvec_hidden_tls_def): Likewise.
	(libresolv_hidden_tls_def): Likewise.
	(librt_hidden_tls_def): Likewise.
	(libdl_hidden_tls_def): Likewise.
	(libnss_files_hidden_tls_def): Likewise.
	(libnsl_hidden_tls_def): Likewise.
	(libnss_nisplus_hidden_tls_def): Likewise.
	(libutil_hidden_tls_def): Likewise.
	(libutil_hidden_tls_def): Likweise.
	* sysdeps/powerpc/nofpu/sim-full.c (__sim_exceptions_thread): Use
	libc_hidden_tls_def.
	(__sim_disabled_exceptions_thread): Likewise.
	(__sim_round_mode_thread): Likewise.
This commit is contained in:
Joseph Myers 2018-11-13 01:53:53 +00:00
parent 53f5c65914
commit 9c4b457e1b
3 changed files with 57 additions and 5 deletions

View File

@ -1,5 +1,28 @@
2018-11-13 Joseph Myers <joseph@codesourcery.com>
* include/libc-symbols.h [SHARED && !NO_HIDDEN && !__ASSEMBLER__]
(__hidden_ver2): New macro. Use old definition of __hidden_ver1
with additional parameter thread.
[SHARED && !NO_HIDDEN && !__ASSEMBLER__] (__hidden_ver1): Define
in terms of __hidden_ver2.
(hidden_tls_def): New macro.
(libc_hidden_tls_def): Likewise.
(rtld_hidden_tls_def): Likewise.
(libm_hidden_tls_def): Likewise.
(libmvec_hidden_tls_def): Likewise.
(libresolv_hidden_tls_def): Likewise.
(librt_hidden_tls_def): Likewise.
(libdl_hidden_tls_def): Likewise.
(libnss_files_hidden_tls_def): Likewise.
(libnsl_hidden_tls_def): Likewise.
(libnss_nisplus_hidden_tls_def): Likewise.
(libutil_hidden_tls_def): Likewise.
(libutil_hidden_tls_def): Likweise.
* sysdeps/powerpc/nofpu/sim-full.c (__sim_exceptions_thread): Use
libc_hidden_tls_def.
(__sim_disabled_exceptions_thread): Likewise.
(__sim_round_mode_thread): Likewise.
* sysdeps/sparc/sparc-ifunc.h [SHARED]
(sparc_ifunc_redirected_hidden_def): Use __attribute_copy__ to
copy attributes from name.

View File

@ -538,14 +538,19 @@ for linking")
# define __hidden_asmname1(prefix, name) __hidden_asmname2(prefix, name)
# define __hidden_asmname2(prefix, name) #prefix name
# define __hidden_ver1(local, internal, name) \
extern __typeof (name) __EI_##name __asm__(__hidden_asmname (#internal)); \
extern __typeof (name) __EI_##name \
__hidden_ver2 (, local, internal, name)
# define __hidden_ver2(thread, local, internal, name) \
extern thread __typeof (name) __EI_##name \
__asm__(__hidden_asmname (#internal)); \
extern thread __typeof (name) __EI_##name \
__attribute__((alias (__hidden_asmname (#local)))) \
__attribute_copy__ (name)
# define hidden_ver(local, name) __hidden_ver1(local, __GI_##name, name);
# define hidden_data_ver(local, name) hidden_ver(local, name)
# define hidden_def(name) __hidden_ver1(__GI_##name, name, name);
# define hidden_data_def(name) hidden_def(name)
# define hidden_tls_def(name) \
__hidden_ver2 (__thread, __GI_##name, name, name);
# define hidden_weak(name) \
__hidden_ver1(__GI_##name, name, name) __attribute__((weak));
# define hidden_data_weak(name) hidden_weak(name)
@ -573,6 +578,7 @@ for linking")
# define hidden_weak(name) hidden_def (name)
# define hidden_ver(local, name) strong_alias (local, __GI_##name)
# define hidden_data_def(name) strong_data_alias (name, __GI_##name)
# define hidden_tls_def(name) hidden_data_def (name)
# define hidden_data_weak(name) hidden_data_def (name)
# define hidden_data_ver(local, name) strong_data_alias (local, __GI_##name)
# define HIDDEN_JUMPTARGET(name) __GI_##name
@ -602,6 +608,7 @@ for linking")
# define hidden_ver(local, name)
# define hidden_data_weak(name)
# define hidden_data_def(name)
# define hidden_tls_def(name)
# define hidden_data_ver(local, name)
# define hidden_nolink(name, lib, version)
#endif
@ -619,6 +626,7 @@ for linking")
# endif
# define libc_hidden_ver(local, name) hidden_ver (local, name)
# define libc_hidden_data_def(name) hidden_data_def (name)
# define libc_hidden_tls_def(name) hidden_tls_def (name)
# define libc_hidden_data_weak(name) hidden_data_weak (name)
# define libc_hidden_data_ver(local, name) hidden_data_ver (local, name)
#else
@ -628,6 +636,7 @@ for linking")
# define libc_hidden_weak(name)
# define libc_hidden_ver(local, name)
# define libc_hidden_data_def(name)
# define libc_hidden_tls_def(name)
# define libc_hidden_data_weak(name)
# define libc_hidden_data_ver(local, name)
#endif
@ -639,6 +648,7 @@ for linking")
# define rtld_hidden_weak(name) hidden_weak (name)
# define rtld_hidden_ver(local, name) hidden_ver (local, name)
# define rtld_hidden_data_def(name) hidden_data_def (name)
# define rtld_hidden_tls_def(name) hidden_tls_def (name)
# define rtld_hidden_data_weak(name) hidden_data_weak (name)
# define rtld_hidden_data_ver(local, name) hidden_data_ver (local, name)
#else
@ -648,6 +658,7 @@ for linking")
# define rtld_hidden_weak(name)
# define rtld_hidden_ver(local, name)
# define rtld_hidden_data_def(name)
# define rtld_hidden_tls_def(name)
# define rtld_hidden_data_weak(name)
# define rtld_hidden_data_ver(local, name)
#endif
@ -659,6 +670,7 @@ for linking")
# define libm_hidden_weak(name) hidden_weak (name)
# define libm_hidden_ver(local, name) hidden_ver (local, name)
# define libm_hidden_data_def(name) hidden_data_def (name)
# define libm_hidden_tls_def(name) hidden_tls_def (name)
# define libm_hidden_data_weak(name) hidden_data_weak (name)
# define libm_hidden_data_ver(local, name) hidden_data_ver (local, name)
#else
@ -668,6 +680,7 @@ for linking")
# define libm_hidden_weak(name)
# define libm_hidden_ver(local, name)
# define libm_hidden_data_def(name)
# define libm_hidden_tls_def(name)
# define libm_hidden_data_weak(name)
# define libm_hidden_data_ver(local, name)
#endif
@ -679,6 +692,7 @@ for linking")
# define libmvec_hidden_weak(name) hidden_weak (name)
# define libmvec_hidden_ver(local, name) hidden_ver (local, name)
# define libmvec_hidden_data_def(name) hidden_data_def (name)
# define libmvec_hidden_tls_def(name) hidden_tls_def (name)
# define libmvec_hidden_data_weak(name) hidden_data_weak (name)
# define libmvec_hidden_data_ver(local, name) hidden_data_ver (local, name)
#else
@ -688,6 +702,7 @@ for linking")
# define libmvec_hidden_weak(name)
# define libmvec_hidden_ver(local, name)
# define libmvec_hidden_data_def(name)
# define libmvec_hidden_tls_def(name)
# define libmvec_hidden_data_weak(name)
# define libmvec_hidden_data_ver(local, name)
#endif
@ -700,6 +715,7 @@ for linking")
# define libresolv_hidden_weak(name) hidden_weak (name)
# define libresolv_hidden_ver(local, name) hidden_ver (local, name)
# define libresolv_hidden_data_def(name) hidden_data_def (name)
# define libresolv_hidden_tls_def(name) hidden_tls_def (name)
# define libresolv_hidden_data_weak(name) hidden_data_weak (name)
# define libresolv_hidden_data_ver(local, name) hidden_data_ver (local, name)
#else
@ -709,6 +725,7 @@ for linking")
# define libresolv_hidden_weak(name)
# define libresolv_hidden_ver(local, name)
# define libresolv_hidden_data_def(name)
# define libresolv_hidden_tls_def(name)
# define libresolv_hidden_data_weak(name)
# define libresolv_hidden_data_ver(local, name)
#endif
@ -721,6 +738,7 @@ for linking")
# define librt_hidden_weak(name) hidden_weak (name)
# define librt_hidden_ver(local, name) hidden_ver (local, name)
# define librt_hidden_data_def(name) hidden_data_def (name)
# define librt_hidden_tls_def(name) hidden_tls_def (name)
# define librt_hidden_data_weak(name) hidden_data_weak (name)
# define librt_hidden_data_ver(local, name) hidden_data_ver (local, name)
#else
@ -730,6 +748,7 @@ for linking")
# define librt_hidden_weak(name)
# define librt_hidden_ver(local, name)
# define librt_hidden_data_def(name)
# define librt_hidden_tls_def(name)
# define librt_hidden_data_weak(name)
# define librt_hidden_data_ver(local, name)
#endif
@ -742,6 +761,7 @@ for linking")
# define libdl_hidden_weak(name) hidden_weak (name)
# define libdl_hidden_ver(local, name) hidden_ver (local, name)
# define libdl_hidden_data_def(name) hidden_data_def (name)
# define libdl_hidden_tls_def(name) hidden_tls_def (name)
# define libdl_hidden_data_weak(name) hidden_data_weak (name)
# define libdl_hidden_data_ver(local, name) hidden_data_ver (local, name)
#else
@ -751,6 +771,7 @@ for linking")
# define libdl_hidden_weak(name)
# define libdl_hidden_ver(local, name)
# define libdl_hidden_data_def(name)
# define libdl_hidden_tls_def(name)
# define libdl_hidden_data_weak(name)
# define libdl_hidden_data_ver(local, name)
#endif
@ -763,6 +784,7 @@ for linking")
# define libnss_files_hidden_weak(name) hidden_weak (name)
# define libnss_files_hidden_ver(local, name) hidden_ver (local, name)
# define libnss_files_hidden_data_def(name) hidden_data_def (name)
# define libnss_files_hidden_tls_def(name) hidden_tls_def (name)
# define libnss_files_hidden_data_weak(name) hidden_data_weak (name)
# define libnss_files_hidden_data_ver(local, name) hidden_data_ver(local, name)
#else
@ -772,6 +794,7 @@ for linking")
# define libnss_files_hidden_weak(name)
# define libnss_files_hidden_ver(local, name)
# define libnss_files_hidden_data_def(name)
# define libnss_files_hidden_tls_def(name)
# define libnss_files_hidden_data_weak(name)
# define libnss_files_hidden_data_ver(local, name)
#endif
@ -790,6 +813,7 @@ for linking")
# define libnsl_hidden_weak(name) hidden_weak (name)
# define libnsl_hidden_ver(local, name) hidden_ver (local, name)
# define libnsl_hidden_data_def(name) hidden_data_def (name)
# define libnsl_hidden_tls_def(name) hidden_tls_def (name)
# define libnsl_hidden_data_weak(name) hidden_data_weak (name)
# define libnsl_hidden_data_ver(local, name) hidden_data_ver (local, name)
#else
@ -799,6 +823,7 @@ for linking")
# define libnsl_hidden_weak(name)
# define libnsl_hidden_ver(local, name)
# define libnsl_hidden_data_def(name)
# define libnsl_hidden_tls_def(name)
# define libnsl_hidden_data_weak(name)
# define libnsl_hidden_data_ver(local, name)
#endif
@ -811,6 +836,7 @@ for linking")
# define libnss_nisplus_hidden_weak(name) hidden_weak (name)
# define libnss_nisplus_hidden_ver(local, name) hidden_ver (local, name)
# define libnss_nisplus_hidden_data_def(name) hidden_data_def (name)
# define libnss_nisplus_hidden_tls_def(name) hidden_tls_def (name)
# define libnss_nisplus_hidden_data_weak(name) hidden_data_weak (name)
# define libnss_nisplus_hidden_data_ver(local, name) hidden_data_ver (local, name)
#else
@ -820,6 +846,7 @@ for linking")
# define libnss_nisplus_hidden_weak(name)
# define libnss_nisplus_hidden_ver(local, name)
# define libnss_nisplus_hidden_data_def(name)
# define libnss_nisplus_hidden_tls_def(name)
# define libnss_nisplus_hidden_data_weak(name)
# define libnss_nisplus_hidden_data_ver(local, name)
#endif
@ -840,6 +867,7 @@ for linking")
# define libutil_hidden_weak(name) hidden_weak (name)
# define libutil_hidden_ver(local, name) hidden_ver (local, name)
# define libutil_hidden_data_def(name) hidden_data_def (name)
# define libutil_hidden_tls_def(name) hidden_tls_def (name)
# define libutil_hidden_data_weak(name) hidden_data_weak (name)
# define libutil_hidden_data_ver(local, name) hidden_data_ver (local, name)
#else
@ -849,6 +877,7 @@ for linking")
# define libutil_hidden_weak(name)
# define libutil_hidden_ver(local, name)
# define libutil_hidden_data_def(name)
# define libutil_hidden_tls_def(name)
# define libutil_hidden_data_weak(name)
# define libutil_hidden_data_ver(local, name)
#endif

View File

@ -23,14 +23,14 @@
/* Thread-local to store sticky exceptions. */
__thread int __sim_exceptions_thread __attribute__ ((nocommon));
libc_hidden_data_def (__sim_exceptions_thread);
libc_hidden_tls_def (__sim_exceptions_thread);
/* By default, no exceptions should trap. */
__thread int __sim_disabled_exceptions_thread = 0xffffffff;
libc_hidden_data_def (__sim_disabled_exceptions_thread);
libc_hidden_tls_def (__sim_disabled_exceptions_thread);
__thread int __sim_round_mode_thread __attribute__ ((nocommon));
libc_hidden_data_def (__sim_round_mode_thread);
libc_hidden_tls_def (__sim_round_mode_thread);
#if SIM_GLOBAL_COMPAT
int __sim_exceptions_global __attribute__ ((nocommon));