[PATCH] D116913: [lld-macho] Add --start-lib --end-lib

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 9 20:32:12 PST 2022


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

In ld.lld, when an ObjFile/BitcodeFile is read in --start-lib state, the file is
given archive semantics. --end-lib closes the previous --start-lib. A build
system can use this feature as an alternative to archives. This patch ports
the feature to lld-macho.

--start-lib and --end-lib are positional, unlike usual ld64 options.
I think the slight drawback does not matter as (a) reusing option names
make build systems easy (b) `--start-lib a.o b.o --end-lib` conveys more
information than an alternative design: `-objlib a.o -objlib b.o` because
--start-lib makes it clear which objects are in the same conceptual archive.
This provides flexibility.

Close https://github.com/llvm/llvm-project/issues/52931


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D116913

Files:
  lld/MachO/Driver.cpp
  lld/MachO/InputFiles.cpp
  lld/MachO/InputFiles.h
  lld/MachO/Options.td
  lld/MachO/SymbolTable.cpp
  lld/MachO/SymbolTable.h
  lld/MachO/Symbols.h
  lld/test/MachO/start-lib.s
  lld/test/MachO/weak-definition-direct-fetch.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D116913.398494.patch
Type: text/x-patch
Size: 17312 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220110/b013e71c/attachment.bin>


More information about the llvm-commits mailing list