Page MenuHomePhabricator

llvm-rc: accept /D, /U, /I parameters joined or separate like rc.exe
Needs RevisionPublic

Authored by awakecoding on May 30 2019, 10:35 AM.

Details

Summary

This change adds support for joined parameters for /D, /U and /I options like rc.exe, and fixes a problem encountered while trying to cross-compile from Linux to Windows using a custom cmake toolchain, ninja, llvm-rc, and MSVC headers + libraries extracted from the Visual Studio 2019 build tools.

As far as I know, CMake doesn't know it's calling llvm-rc on Linux, and generates the same command-line arguments it would normally feed to rc.exe on Windows. It should also be noted that in order to get partial success cross-compiling using llvm-rc, I had to patch my .rc scripts and make a minor modification to CMake to disable the cmcldeps wrapper. Patching llvm-rc to accept the arguments as joined worked around the problem that CMake generated the command-line parameters as joined, which works with rc.exe but not with llvm-rc.

A very similar change has been done for similar reasons for the /fo flag, but didn't apply the change to /D, /U and /I: https://reviews.llvm.org/D54191

This is my first contribution to LLVM, so feel free to request anything necessary to fit within the contribution guidelines.

Event Timeline

awakecoding created this revision.May 30 2019, 10:35 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 30 2019, 10:35 AM
awakecoding edited the summary of this revision. (Show Details)May 30 2019, 10:43 AM
awakecoding added a reviewer: mstorsjo.

Please add testcases for these changes. You could e.g. change some of the existing tests in test/tools/llvm-rc so that both forms are exercised, or add a new test there that uses that form.

thakis requested changes to this revision.Jun 5 2019, 9:07 AM
This revision now requires changes to proceed.Jun 5 2019, 9:07 AM