[all-commits] [llvm/llvm-project] cd5d5c: [ELF] Refactor the way we handle -plugin-opt= (GCC...

Fangrui Song via All-commits all-commits at lists.llvm.org
Wed Apr 15 08:01:24 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: cd5d5ce235081005173566c99c592550021de058
      https://github.com/llvm/llvm-project/commit/cd5d5ce235081005173566c99c592550021de058
  Author: Fangrui Song <maskray at google.com>
  Date:   2020-04-15 (Wed, 15 Apr 2020)

  Changed paths:
    M lld/ELF/Driver.cpp
    M lld/ELF/Options.td
    M lld/test/ELF/lto-plugin-ignore.s

  Log Message:
  -----------
  [ELF] Refactor the way we handle -plugin-opt= (GCC collect2 or clang LTO related options)

GCC collect2 passes several options to the linker even if LTO is not used
(note, lld does not support GCC LTO). The lto-wrapper may be a relative
path (especially during development, when gcc is in a build directory), e.g.

  -plugin-opt=relative/path/to/lto-wrapper

We need to ignore such options, which are currently interpreted by
cl::ParseCommandLineOptions() and will fail with `error: --plugin-opt: ld.lld: Unknown command line argument 'relative/path/to/lto-wrapper'`
because the path is apparently not an option registered by an `llvm::cl::opt`.

See lto-plugin-ignore.s for how we interpret various -plugin-opt= options now.

Reviewed By: grimar, tejohnson

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




More information about the All-commits mailing list