[LinkerWrapper][NFC] Rework command line argument handling in the linker wrapper
authorJoseph Huber <jhuber6@vols.utk.edu>
Thu, 7 Jul 2022 02:58:52 +0000 (22:58 -0400)
committerJoseph Huber <jhuber6@vols.utk.edu>
Fri, 8 Jul 2022 15:18:38 +0000 (11:18 -0400)
commitd2ead9e324d4d268e8c0634849d6081e177c9dd7
treea2393d8ca4beba225239fdce542ff9320404ba39
parent29c6bf45c37a3a0c2b37a6034ee4685bfa741b82
[LinkerWrapper][NFC] Rework command line argument handling in the linker wrapper

Summary:
This patch reworks the command line argument handling in the linker
wrapper from using the LLVM `cl` interface to using the `Option`
interface with TableGen. This has several benefits compared to the old
method.

We use arguments from the linker arguments in the linker
wrapper, such as the libraries and input files, this allows us to
properly parse these. Additionally we can now easily set up aliases to
the linker wrapper arguments and pass them in the linker input directly.
That is, pass an option like `cuda-path=` as `--offload-arg=cuda-path=`
in the linker's inputs. This will allow us to handle offloading
compilation in the linker itself some day. Finally, this is also a much
cleaner interface for passing arguments to the individual device linking
jobs.
clang/lib/Driver/ToolChains/Clang.cpp
clang/test/Driver/linker-wrapper-image.c
clang/test/Driver/linker-wrapper.c
clang/test/Driver/openmp-offload.c
clang/tools/clang-linker-wrapper/CMakeLists.txt
clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
clang/tools/clang-linker-wrapper/LinkerWrapperOpts.td [new file with mode: 0644]