Index: ELF/Symbols.cpp
===================================================================
--- ELF/Symbols.cpp
+++ ELF/Symbols.cpp
@@ -59,8 +59,12 @@
       Addend = 0;
     }
     uintX_t VA = (SC->OutSec ? SC->OutSec->getVA() : 0) + SC->getOffset(Offset);
-    if (D.isTls() && !Config->Relocatable)
+    if (D.isTls() && !Config->Relocatable) {
+      if (!Out<ELFT>::TlsPhdr)
+        fatal(getFilename(D.File) +
+              ": no PT_TLS program header found when met STT_TLS symbol");
       return VA - Out<ELFT>::TlsPhdr->p_vaddr;
+    }
     return VA;
   }
   case SymbolBody::DefinedCommonKind:
Index: test/ELF/invalid/tls-symbol.s
===================================================================
--- test/ELF/invalid/tls-symbol.s
+++ test/ELF/invalid/tls-symbol.s
@@ -0,0 +1,7 @@
+# REQUIRES: x86
+
+## tls-symbol.elf does not have TLS sections, but type
+## of one of the symbol is broken and set to STT_TLS.
+# RUN: not ld.lld %S/Inputs/tls-symbol.elf \
+# RUN:   -o %t 2>&1 | FileCheck %s
+# CHECK: no PT_TLS program header found when met STT_TLS symbol