[all-commits] [llvm/llvm-project] d2f3d7: [lld-macho] Force higher alignment for __thread_vars

Daniel Bertalan via All-commits all-commits at lists.llvm.org
Sat Sep 24 23:22:43 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d2f3d7bad26ac75b6729d27bf04d497621e84ed4
      https://github.com/llvm/llvm-project/commit/d2f3d7bad26ac75b6729d27bf04d497621e84ed4
  Author: Daniel Bertalan <dani at danielbertalan.dev>
  Date:   2022-09-25 (Sun, 25 Sep 2022)

  Changed paths:
    M lld/MachO/Writer.cpp
    M lld/test/MachO/tlv-dylib.s

  Log Message:
  -----------
  [lld-macho] Force higher alignment for __thread_vars

`__thread_vars` contains pointers to `__tlv_bootstrap`, which are fixed
up by dyld; however the section's alignment is not specified. This means
that the relocations might end up on odd addresses, which is not
representable by the soon to be added chained fixups.

This is arguably a bug in MC, but this behavior has been there since TLV
support was originally added.

This patch forces the `__thread_vars` sections to be aligned to the
target's pointer size. This is done by ld64 as well.

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




More information about the All-commits mailing list