[PATCH] D86909: [lld-macho] Initial support for common symbols

Jez Ng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 31 23:10:13 PDT 2020


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

On Unix, it is traditionally allowed to write variable definitions without
initialization expressions (such as "int foo;") to header files. These are
called tentative definitions.

The compiler creates common symbols when it sees tentative definitions. When
linking the final binary, if there are remaining common symbols after name
resolution is complete, the linker converts them to regular defined symbols in
a `__common` section.

This diff implements most of that functionality, though we do not yet handle
the case where there are both common and non-common definitions of the same
symbol.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D86909

Files:
  lld/MachO/Driver.cpp
  lld/MachO/InputFiles.cpp
  lld/MachO/SymbolTable.cpp
  lld/MachO/SymbolTable.h
  lld/MachO/Symbols.h
  lld/MachO/SyntheticSections.h
  lld/test/MachO/common-symbol-coalescing.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D86909.289076.patch
Type: text/x-patch
Size: 8774 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200901/2e3422ba/attachment.bin>


More information about the llvm-commits mailing list