[all-commits] [llvm/llvm-project] 9bd29a: [ELF] Make dot in .tbss correct

Fangrui Song via All-commits all-commits at lists.llvm.org
Wed Aug 4 08:59:03 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 9bd29a73d17add45234a35de5f6ad7ca8321f7f9
      https://github.com/llvm/llvm-project/commit/9bd29a73d17add45234a35de5f6ad7ca8321f7f9
  Author: Fangrui Song <i at maskray.me>
  Date:   2021-08-04 (Wed, 04 Aug 2021)

  Changed paths:
    M lld/ELF/LinkerScript.cpp
    M lld/ELF/LinkerScript.h
    M lld/test/ELF/linkerscript/tbss.s

  Log Message:
  -----------
  [ELF] Make dot in .tbss correct

GNU ld doesn't support multiple SHF_TLS SHT_NOBITS output sections (it restores
the address after an SHF_TLS SHT_NOBITS section, so consecutive SHF_TLS
SHT_NOBITS sections will have conflicting address ranges).

That said, `threadBssOffset` implements limited support for consecutive SHF_TLS
SHT_NOBITS sections. (SHF_TLS SHT_PROGBITS following a SHF_TLS SHT_NOBITS can still be
incorrect.)

`.` in an output section description of an SHF_TLS SHT_NOBITS section is
incorrect. (https://lists.llvm.org/pipermail/llvm-dev/2021-July/151974.html)

This patch saves the end address of the previous tbss section in
`ctx->tbssAddr`, changes `dot` in the beginning of `assignOffset` so
that `.` evaluation will be correct.

Reviewed By: peter.smith

Differential Revision: https://reviews.llvm.org/D107208




More information about the All-commits mailing list