https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100354
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |ktkachov at gcc dot gnu.org, | |rearnsha at gcc dot gnu.org, | |rsandifo at gcc dot gnu.org --- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> --- It could be e.g. done by having the targetm.const_not_ok_for_debug_p target hook not return true for the UNSPEC_TLS case and have some new target hook that would handle emitting debug info for an UNSPEC. Or a way to just quiet the note (I'll repeat it is -fchecking only) would be to use as the operand of UNSPEC_TLS not const0_rtx as it does, but some magic SYMBOL_REF with SYMBOL_REF_TLS_MODEL non-zero on it. Say like: --- gcc/config/aarch64/aarch64.md.jj 2022-01-11 23:11:21.682300103 +0100 +++ gcc/config/aarch64/aarch64.md 2022-02-08 19:51:00.581676457 +0100 @@ -6833,7 +6833,8 @@ (define_insn "ldr_got_tiny_sidi" (define_insn "aarch64_load_tp_hard" [(set (match_operand:DI 0 "register_operand" "=r") - (unspec:DI [(const_int 0)] UNSPEC_TLS))] + (unspec:DI [(match_operand 1 "aarch64_tls_le_symref" "S")] + UNSPEC_TLS))] "" "mrs\\t%0, tpidr_el0" [(set_attr "type" "mrs")] --- gcc/config/aarch64/aarch64.cc.jj 2022-02-04 14:36:54.262615676 +0100 +++ gcc/config/aarch64/aarch64.cc 2022-02-08 19:46:58.206051731 +0100 @@ -18474,7 +18474,9 @@ aarch64_load_tp (rtx target) target = gen_reg_rtx (Pmode); /* Can return in any reg. */ - emit_insn (gen_aarch64_load_tp_hard (target)); + rtx sym = gen_rtx_SYMBOL_REF (Pmode, ""); + SYMBOL_REF_FLAGS (sym) = TLS_MODEL_LOCAL_EXEC << SYMBOL_FLAG_TLS_SHIFT; + emit_insn (gen_aarch64_load_tp_hard (target, sym)); return target; }