[all-commits] [llvm/llvm-project] 1bc5c8: [Driver] Add --ld-path= and deprecate -fuse-ld=/ab...

Fangrui Song via All-commits all-commits at lists.llvm.org
Mon Jul 20 09:35:11 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 1bc5c84710a8c73ef21295e63c19d10a8c71f2f5
      https://github.com/llvm/llvm-project/commit/1bc5c84710a8c73ef21295e63c19d10a8c71f2f5
  Author: Fangrui Song <maskray at google.com>
  Date:   2020-07-20 (Mon, 20 Jul 2020)

  Changed paths:
    M clang/include/clang/Basic/DiagnosticDriverKinds.td
    M clang/include/clang/Driver/Options.td
    M clang/lib/Driver/ToolChain.cpp
    A clang/test/Driver/Inputs/basic_freebsd64_tree/usr/bin/ld.bfd
    M clang/test/Driver/fuse-ld.c
    A clang/test/Driver/ld-path.c
    M clang/test/Misc/warning-flags.c

  Log Message:
  -----------
  [Driver] Add --ld-path= and deprecate -fuse-ld=/abs/path and -fuse-ld=rel/path

Supersedes D80225. Add --ld-path= to avoid strange target specific
prefixes and make -fuse-ld= focus on its intended job: "linker flavor".
(-f* affects generated code or language features. --ld-path does not
affect codegen, so it is not named -f*)

The way --ld-path= works is similar to "Command Search and Execution" in POSIX.1-2017 2.9.1 Simple Commands.

If --ld-path= specifies

* an absolute path, the value specifies the linker.
* a relative path without a path component separator (/), the value is searched using the -B, COMPILER_PATH, then PATH.
* a relative path with a path component separator, the linker is found relative to the current working directory.

-fuse-ld= and --ld-path= can be composed, e.g. `-fuse-ld=lld --ld-path=/usr/bin/ld.lld`

The driver can base its linker option decision on the flavor -fuse-ld=, but it should not do fragile
flavor checking with --ld-path=.

Reviewed By: whitequark, keith

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




More information about the All-commits mailing list