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

Fangrui Song via All-commits all-commits at lists.llvm.org
Wed Aug 4 09:17:43 PDT 2021


  Branch: refs/heads/release/13.x
  Home:   https://github.com/llvm/llvm-project
  Commit: 73ea8254d2d7177e84814688a4523144bdbd2fbb
      https://github.com/llvm/llvm-project/commit/73ea8254d2d7177e84814688a4523144bdbd2fbb
  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

(cherry picked from commit 9bd29a73d17add45234a35de5f6ad7ca8321f7f9)




More information about the All-commits mailing list