Revert "Switch external cvtres.exe for llvm's own resource library."

This reverts commit 600d52c278e123dd08bee24c1f00932b55add8de.

This patch still seems to break CrWinClangLLD, reverting until I can
find root problem.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307189 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Eric Beckmann 2017-07-05 18:59:16 +00:00
parent 7cacca2b9b
commit 9b6f55389e
3 changed files with 14 additions and 13 deletions

View File

@ -43,10 +43,13 @@
#include <map>
namespace llvm {
namespace object {
class WindowsResource;
enum class Machine { UNKNOWN, ARM, X64, X86 };
class ResourceEntryRef {
public:
Error moveNext(bool &End);

View File

@ -328,7 +328,7 @@ private:
std::unique_ptr<MemoryBuffer> OutputBuffer;
char *BufferStart;
uint64_t CurrentOffset = 0;
COFF::MachineTypes MachineType;
Machine MachineType;
const WindowsResourceParser::TreeNode &Resources;
const ArrayRef<std::vector<uint8_t>> Data;
uint64_t FileSize;
@ -350,7 +350,6 @@ WindowsResourceCOFFWriter::WindowsResourceCOFFWriter(
: MachineType(MachineType), Resources(Parser.getTree()),
Data(Parser.getData()), StringTable(Parser.getStringTable()) {
performFileLayout();
OutputBuffer = MemoryBuffer::getNewMemBuffer(FileSize);
}

View File

@ -120,21 +120,21 @@ int main(int argc_, const char *argv_[]) {
bool Verbose = InputArgs.hasArg(OPT_VERBOSE);
COFF::MachineTypes MachineType;
Machine MachineType;
if (InputArgs.hasArg(OPT_MACHINE)) {
std::string MachineString = InputArgs.getLastArgValue(OPT_MACHINE).upper();
MachineType = StringSwitch<COFF::MachineTypes>(MachineString)
.Case("ARM", COFF::IMAGE_FILE_MACHINE_ARMNT)
.Case("X64", COFF::IMAGE_FILE_MACHINE_AMD64)
.Case("X86", COFF::IMAGE_FILE_MACHINE_I386)
.Default(COFF::IMAGE_FILE_MACHINE_UNKNOWN);
if (MachineType == COFF::IMAGE_FILE_MACHINE_UNKNOWN)
MachineType = StringSwitch<Machine>(MachineString)
.Case("ARM", Machine::ARM)
.Case("X64", Machine::X64)
.Case("X86", Machine::X86)
.Default(Machine::UNKNOWN);
if (MachineType == Machine::UNKNOWN)
reportError("Unsupported machine architecture");
} else {
if (Verbose)
outs() << "Machine architecture not specified; assumed X64.\n";
MachineType = COFF::IMAGE_FILE_MACHINE_AMD64;
MachineType = Machine::X64;
}
std::vector<std::string> InputFiles = InputArgs.getAllArgValues(OPT_INPUT);
@ -155,10 +155,10 @@ int main(int argc_, const char *argv_[]) {
if (Verbose) {
outs() << "Machine: ";
switch (MachineType) {
case COFF::IMAGE_FILE_MACHINE_ARMNT:
case Machine::ARM:
outs() << "ARM\n";
break;
case COFF::IMAGE_FILE_MACHINE_I386:
case Machine::X86:
outs() << "X86\n";
break;
default:
@ -207,7 +207,6 @@ int main(int argc_, const char *argv_[]) {
std::copy(OutputBuffer->getBufferStart(), OutputBuffer->getBufferEnd(),
FileBuffer->getBufferStart());
error(FileBuffer->commit());
if (Verbose) {
Expected<OwningBinary<Binary>> BinaryOrErr = createBinary(OutputFile);
if (!BinaryOrErr)