[llvm-rc] Add a GNU windres-like frontend to llvm-rc

Authored by mstorsjo on Apr 15 2021, 4:38 AM.


[llvm-rc] Add a GNU windres-like frontend to llvm-rc

This primarily parses a different set of options and invokes the same
resource compiler as llvm-rc normally. Additionally, it can convert
directly to an object file (which in MSVC style setups is done with the
separate cvtres tool, or by the linker).

(GNU windres also supports other conversions; from coff object file back
to .res, and from .res or object file back to .rc form; that's not yet

The other bigger complication lies in being able to imply or pass the
intended target triple, to let clang find the corresponding mingw sysroot
for finding include files, and for specifying the default output object
machine format.

It can be implied from the tool triple prefix, like
<triple>-[llvm-]windres or picked up from the windres option e.g.
-F pe-x86-64. In GNU windres, that option takes BFD style format names
such as pe-i386 or pe-x86-64. As libbfd in binutils doesn't support
Windows on ARM, there's no such canonical name for the ARM targets.
Therefore, as an LLVM specific extension, this option is extended to
allow passing full triples, too.

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


mstorsjoApr 26 2021, 12:04 PM
Differential Revision
D100756: [llvm-rc] [4/4] Add a GNU windres-like frontend to llvm-rc
rGf0c22c3d584c: [Verifier] Tidy up the code a bit, NFC.