[PATCH] D25083: [ELF] - Do not crash if symbol type set to TLS when there is no tls sections.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 30 13:25:52 PDT 2016


ruiu added inline comments.


> Symbols.cpp:64-65
> +      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;

fatal(getFilename(D.File) + " has a STT_TLS symbol but doesn't have a PT_TLS section.")

> tls-symbol.s:3-4
> +
> +## 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 \

The test file contains a STT_TLS symbol but has no TLS section.

> tls-symbol.s:5-6
> +## 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

You can write it in one line.

https://reviews.llvm.org/D25083





More information about the llvm-commits mailing list