Remove TARGET_THREADPTR reference from TARGET_HAVE_TLS to avoid static data initialization dependency on xtensa core configuration.
Tested with xtensa-linux-uclibc, no new regression failures. Committed to master. 2020-06-15 Max Filippov <jcmvb...@gmail.com> gcc/ * config/xtensa/xtensa.c (TARGET_HAVE_TLS): Remove TARGET_THREADPTR reference. (xtensa_tls_symbol_p, xtensa_tls_referenced_p): Use targetm.have_tls instead of TARGET_HAVE_TLS. (xtensa_option_override): Set targetm.have_tls to false in configurations without THREADPTR. --- gcc/config/xtensa/xtensa.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/gcc/config/xtensa/xtensa.c b/gcc/config/xtensa/xtensa.c index e370aa4623c1..be1eb21a0b60 100644 --- a/gcc/config/xtensa/xtensa.c +++ b/gcc/config/xtensa/xtensa.c @@ -275,7 +275,7 @@ static rtx xtensa_delegitimize_address (rtx); #define TARGET_SECONDARY_RELOAD xtensa_secondary_reload #undef TARGET_HAVE_TLS -#define TARGET_HAVE_TLS (TARGET_THREADPTR && HAVE_AS_TLS) +#define TARGET_HAVE_TLS HAVE_AS_TLS #undef TARGET_CANNOT_FORCE_CONST_MEM #define TARGET_CANNOT_FORCE_CONST_MEM xtensa_cannot_force_const_mem @@ -602,7 +602,7 @@ constantpool_mem_p (rtx op) static bool xtensa_tls_symbol_p (rtx x) { - if (! TARGET_HAVE_TLS) + if (! targetm.have_tls) return false; return GET_CODE (x) == SYMBOL_REF && SYMBOL_REF_TLS_MODEL (x) != 0; @@ -2025,7 +2025,7 @@ xtensa_mode_dependent_address_p (const_rtx addr, bool xtensa_tls_referenced_p (rtx x) { - if (! TARGET_HAVE_TLS) + if (! targetm.have_tls) return false; subrtx_iterator::array_type array; @@ -2222,6 +2222,9 @@ xtensa_option_override (void) if (xtensa_windowed_abi == -1) xtensa_windowed_abi = TARGET_WINDOWED_ABI_DEFAULT; + if (! TARGET_THREADPTR) + targetm.have_tls = false; + /* Use CONST16 in the absence of L32R. Set it in the TARGET_OPTION_OVERRIDE to avoid dependency on xtensa configuration in the xtensa-common.c */ -- 2.20.1