[llvm-dlltool] Imply the target arch from a tool triple prefix
authorMartin Storsjö <martin@martin.st>
Mon, 14 Jun 2021 10:21:54 +0000 (13:21 +0300)
committerMartin Storsjö <martin@martin.st>
Thu, 17 Jun 2021 10:02:35 +0000 (13:02 +0300)
commitca56b33daf6781a248750b6d538cef84fdae0d1b
tree613a9b84a2584d3422c7bae7d802b951f8093028
parent675d52bc46ff7e618ffa2fb282d031e387e3a114
[llvm-dlltool] Imply the target arch from a tool triple prefix

Also use the default LLVM target as default for dlltool. This
matches how GNU dlltool behaves; it is compiled with one default
target, which is used if no option is provided.

Extend the anonymous namespace in the implementation file instead
of using static functions.

Based on a patch by Mateusz Mikuła.

The effect of the default LLVM target, if neither the -m option
nor a tool triple prefix is provided, isn't tested, as we can't
make assumptions about what it is set to.

(We could make the default be forced to one of the four supported
architectures if the default triple is another arch, and then just
test that llvm-dlltool without an -m option is able to produce an
import library, without checking the actual architecture though.)

Differential Revision: https://reviews.llvm.org/D104212
llvm/lib/ToolDrivers/llvm-dlltool/DlltoolDriver.cpp
llvm/test/tools/llvm-dlltool/triple-prefix.def [new file with mode: 0644]