[PATCH] D83532: [lld-macho] Partial support for weak definitions

Jez Ng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 9 23:18:34 PDT 2020


int3 created this revision.
int3 added a reviewer: lld-macho.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

This diff adds support for weak definitions, though it doesn't handle weak
symbols in dylibs quite correctly -- we need to emit binding opcodes for them
in the weak binding section rather than the lazy binding section.

What *is* covered in this diff:

1. Reading the weak flag from symbol table / export trie, and writing it to the export trie
2. Refining the symbol table's rules for choosing one symbol definition over another. Wrote a few dozen test cases to make sure we were matching ld64's behavior.

We can now link basic C++ programs.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D83532

Files:
  lld/MachO/Arch/X86_64.cpp
  lld/MachO/ExportTrie.cpp
  lld/MachO/ExportTrie.h
  lld/MachO/InputFiles.cpp
  lld/MachO/SymbolTable.cpp
  lld/MachO/SymbolTable.h
  lld/MachO/Symbols.h
  lld/MachO/SyntheticSections.cpp
  lld/test/MachO/weak-definition-direct-fetch.s
  lld/test/MachO/weak-definition-indirect-fetch.s
  lld/test/MachO/weak-definition-order.s
  lld/test/MachO/weak-definition-over-dysym.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D83532.276918.patch
Type: text/x-patch
Size: 23600 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200710/af1aa71c/attachment.bin>


More information about the llvm-commits mailing list