[PATCH] D98545: [lld-macho][nfc] Give every SyntheticSection a fake InputSection

Jez Ng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 12 11:59:48 PST 2021


int3 created this revision.
int3 added reviewers: lld-macho, oontvoo.
Herald added a project: lld-macho.
int3 requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Previously, it was difficult to write code that handled both synthetic
and regular sections generically. We solve this problem by creating a
fake InputSection at the start of every SyntheticSection.

This refactor allows us to handle DSOHandle like a regular Defined
symbol (since Defined symbols must be attached to an InputSection), and
paves the way for supporting `__mh_*header` symbols. Additionally, it
simplifies our binding/rebase code.

I did have to extend Defined a little -- it now has a `linkerInternal`
flag, to indicate that `___dso_handle` should not be in the final symbol
table.

I've also added some additional testing for `___dso_handle`.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D98545

Files:
  lld/MachO/Driver.cpp
  lld/MachO/SymbolTable.cpp
  lld/MachO/SymbolTable.h
  lld/MachO/Symbols.cpp
  lld/MachO/Symbols.h
  lld/MachO/SyntheticSections.cpp
  lld/MachO/SyntheticSections.h
  lld/test/MachO/dso-handle.s
  lld/test/MachO/invalid/dso-handle-duplicate.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D98545.330338.patch
Type: text/x-patch
Size: 19241 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210312/13944bdf/attachment.bin>


More information about the llvm-commits mailing list