[clang] [LinkerWrapper] Accept some needed lld-link linker arguments for COFF targets (PR #72889)

Joseph Huber via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 20 15:50:32 PST 2023


jhuber6 wrote:

> The command-line argument handling is not related to [PE](https://en.wikipedia.org/wiki/Portable_Executable)/COFF, but to Microsoft's `link.exe` command line interface, for instance [`/libpath:`](https://learn.microsoft.com/en-us/cpp/build/reference/libpath-additional-libpath?view=msvc-170). `/usr/bin/lld-link` is a `link.exe`-compatible interface for lld with an appropriate default triple, like `clang-cl` is for `clang`. IIRC, `lld` choses its command-line interface based on the `argv[0]` name, so should clang-linker-wrapper when passed `--linker-path=/usr/bin/lld-link` instead of `--linker-path=/usr/bin/lld`, but both should be able to generate PE files.
> 
> That is, this patch is not necessarily wrong, but the commit message and "// COFF-style linker options." should refer to the command line interface instead.

I changed the title, realistically I could probably try to separate these more logically, but I think it's easier to just handle them both independently but identically in the logic.

https://github.com/llvm/llvm-project/pull/72889


More information about the cfe-commits mailing list