[llvm-dev] llvm-rc option parsing

Shoaib Meenai via llvm-dev llvm-dev at lists.llvm.org
Tue Oct 24 14:49:03 PDT 2017


Hi all (CC llvm-rc contributors),

I've been attempting to cross-compile LLVM for Windows using clang-cl. LLVM's
build system embeds resource files for MSVC builds, so I was hoping to use
llvm-rc for that portion.

cmake invokes the resource compiler with arguments joined to their options
(e.g. `/D_WIN32`, `/fofoo.res`, etc.), which rc.exe supports, but llvm-rc
expects arguments to be separate. It's simple enough to change that, of
course; just change `Separate` to `JoinedOrSeparate` in the options tabledef.
Unfortunately, that then causes problems with Unix-style absolute paths; for
example, on macOS, `/Users/...` would be interpreted as a macro undefine
rather than a path.

clang-cl has similar issues, and supports such paths by treating anything
after a `--` as a path. (clang-cl has it slightly easier since at least its
options are case-sensitive, but it's still the same underlying issue). I'd
like to make a similar change in llvm-rc (i.e., arguments can be both joined
or separate, and you use `--` to resolve ambiguities between options and
paths), but I wanted to run it by everyone before putting up that patch, in
case it breaks people's use cases. (I doubt there are a whole lot of llvm-rc
use cases right now, given that it was only introduced in the 6.0 cycle, but
still.)

Thanks,
Shoaib



More information about the llvm-dev mailing list