[all-commits] [llvm/llvm-project] b96bb7: [ELF] Add two new tests showing broken .tbss align...

Jessica Clarke via All-commits all-commits at lists.llvm.org
Thu Jul 29 07:14:20 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b96bb7899fe319278ad7809f3c647b944bc00c6c
      https://github.com/llvm/llvm-project/commit/b96bb7899fe319278ad7809f3c647b944bc00c6c
  Author: Jessica Clarke <jrtc27 at jrtc27.com>
  Date:   2021-07-29 (Thu, 29 Jul 2021)

  Changed paths:
    A lld/test/ELF/linkerscript/tls-nobits-offset.s
    A lld/test/ELF/tls-nobits-offset.s

  Log Message:
  -----------
  [ELF] Add two new tests showing broken .tbss alignment if first in PT_TLS

This is a similar problem to D66658, where we are too aggressive in not
aligning NOBITS sections, and the tests are based on the ones added for
that fix. If a .tbss section is first in a PT_TLS segment (i.e. there is
no .tdata section) then, although it doesn't need to be aligned such
that address and offset are congruent modulo the page size, they do need
to be congruent modulo the segment alignment, otherwise the whole PT_TLS
will be unaligned.

Reviewed By: MaskRay

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


  Commit: cfaa5bf4ce62266897d27c8c0f3474e555ab87e5
      https://github.com/llvm/llvm-project/commit/cfaa5bf4ce62266897d27c8c0f3474e555ab87e5
  Author: Jessica Clarke <jrtc27 at jrtc27.com>
  Date:   2021-07-29 (Thu, 29 Jul 2021)

  Changed paths:
    M lld/ELF/Writer.cpp
    M lld/test/ELF/linkerscript/tls-nobits-offset.s
    M lld/test/ELF/tls-nobits-offset.s

  Log Message:
  -----------
  [ELF] Align the first section of a PT_TLS even if its type is SHT_NOBITS

This is somewhat of a repeat of D66658 but for sections in PT_TLS
segments. Although such sections don't need to be aligned such that
address and offset are congruent modulo the page size, they do need
to be congruent modulo the segment alignment, otherwise the
whole PT_TLS will be unaligned. We therefore use the normal calculation
to determine the section's address within the PT_LOAD rather than
bailing out early due to being SHT_NOBITS.

Reviewed By: MaskRay

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


Compare: https://github.com/llvm/llvm-project/compare/c3c1826c310c...cfaa5bf4ce62


More information about the All-commits mailing list