https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83010
--- Comment #3 from Yao Qi <qiyao at gcc dot gnu.org> --- (In reply to Jakub Jelinek from comment #2) > From quick look, it seems gas/ld just doesn't have corresponding support, so > that would need to be written first. There is R_AARCH64_TLS_DTPREL64 > relocation, wonder if that might do the job if gas has some way to emit that > relocation. Yes, beside gcc, something is needed in ld too. Clang emits DW_AT_location for TLS variable, but ld failed to link, $ ./clang+llvm-5.0.0-aarch64-linux-gnu/bin/clang -g 4.c -o 4.exe /usr/bin/ld: /tmp/4-767da1.o(.debug_info+0x37): R_AARCH64_ABS64 used with TLS symbol a_thread_local but gold is ok, $ ./clang+llvm-5.0.0-aarch64-linux-gnu/bin/clang -fuse-ld=gold -g 4.c -o 4.exe <1><2a>: Abbrev Number: 2 (DW_TAG_variable) <2b> DW_AT_name : (indirect string, offset: 0x3e): a_thread_local <2f> DW_AT_type : <0x40> <33> DW_AT_external : 1 <33> DW_AT_decl_file : 1 <34> DW_AT_decl_line : 2 <35> DW_AT_location : 10 byte block: e 0 0 0 0 0 0 0 0 e0 (DW_OP_const8u: 0 0; DW_OP_GNU_push_tls_address or DW_OP_HP_unknown)