[all-commits] [llvm/llvm-project] 2e2737: [MC][MachO] Change addrsig format + ensure its siz...

Jez Ng via All-commits all-commits at lists.llvm.org
Tue Jul 19 18:22:56 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 2e2737cdf9983744fd894a5e5101429d74a67056
      https://github.com/llvm/llvm-project/commit/2e2737cdf9983744fd894a5e5101429d74a67056
  Author: Jez Ng <jezng at fb.com>
  Date:   2022-07-19 (Tue, 19 Jul 2022)

  Changed paths:
    M llvm/include/llvm/MC/MCMachObjectWriter.h
    M llvm/lib/MC/MCMachOStreamer.cpp
    M llvm/lib/MC/MachObjectWriter.cpp
    M llvm/test/CodeGen/AArch64/addrsig-macho.ll

  Log Message:
  -----------
  [MC][MachO] Change addrsig format + ensure its size is properly set

There were two problems with the previous setup:

1. We weren't setting its size, which caused problems when `__llvm_addrsig`
   wasn't the last section. In particular, `__debug_line` (if created) is
   generated and placed after `__llvm_addrsig`, and would result in an
   invalid object file w/ overlapping sections being emitted.

2. The symbol indices could be invalidated if e.g. `llvm-strip` ran on
   the object file. See discussion [here][1].

To fix both these issues, we use symbol relocations instead of encoding
symbol indices directly in the section contents. The section itself
doesn't contain any data. That sidesteps the layout problem in addition
to solving the second issue.

The corresponding LLD change to read in this new format: {D128938}.
It will fix the icf-safe.ll test failure on this diff.

[1]: https://discourse.llvm.org/t/problems-with-mach-o-address-significance-table-generation/63392/

Reviewed By: #lld-macho, alx32

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


  Commit: 2d889a87fb1c557f67adf9bc6dce90ddef7c7836
      https://github.com/llvm/llvm-project/commit/2d889a87fb1c557f67adf9bc6dce90ddef7c7836
  Author: Jez Ng <jezng at fb.com>
  Date:   2022-07-19 (Tue, 19 Jul 2022)

  Changed paths:
    M lld/MachO/ICF.cpp

  Log Message:
  -----------
  [lld-macho] Read in new addrsig format

The new format uses symbol relocations, as described in {D127637}.

Reviewed By: #lld-macho, alx32

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


Compare: https://github.com/llvm/llvm-project/compare/18f46f3ab067...2d889a87fb1c


More information about the All-commits mailing list