[all-commits] [llvm/llvm-project] 0aae2b: [lld-macho] Add --start-lib --end-lib

Fangrui Song via All-commits all-commits at lists.llvm.org
Wed Jan 19 10:15:01 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 0aae2bf37318eff2ac4abeb570383d9d603be552
      https://github.com/llvm/llvm-project/commit/0aae2bf37318eff2ac4abeb570383d9d603be552
  Author: Fangrui Song <i at maskray.me>
  Date:   2022-01-19 (Wed, 19 Jan 2022)

  Changed paths:
    M lld/MachO/Driver.cpp
    M lld/MachO/InputFiles.cpp
    M lld/MachO/InputFiles.h
    M lld/MachO/Options.td
    M lld/MachO/SymbolTable.cpp
    M lld/MachO/SymbolTable.h
    M lld/MachO/Symbols.h
    M lld/MachO/UnwindInfoSection.cpp
    M lld/test/MachO/objc-uses-custom-personality.s
    M lld/test/MachO/objc.s
    A lld/test/MachO/start-lib.s
    M lld/test/MachO/weak-definition-direct-fetch.s

  Log Message:
  -----------
  [lld-macho] Add --start-lib --end-lib

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 convenient (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 (c) `-objlib`/`-filelist` interaction may be weird.

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

Reviewed By: #lld-macho, Jez Ng, oontvoo

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




More information about the All-commits mailing list