[llvm] r307189 - Revert "Switch external cvtres.exe for llvm's own resource library."
Eric Beckmann via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 5 11:59:16 PDT 2017
Author: ecbeckmann
Date: Wed Jul 5 11:59:16 2017
New Revision: 307189
URL: http://llvm.org/viewvc/llvm-project?rev=307189&view=rev
Log:
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.
Modified:
llvm/trunk/include/llvm/Object/WindowsResource.h
llvm/trunk/lib/Object/WindowsResource.cpp
llvm/trunk/tools/llvm-cvtres/llvm-cvtres.cpp
Modified: llvm/trunk/include/llvm/Object/WindowsResource.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Object/WindowsResource.h?rev=307189&r1=307188&r2=307189&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Object/WindowsResource.h (original)
+++ llvm/trunk/include/llvm/Object/WindowsResource.h Wed Jul 5 11:59:16 2017
@@ -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);
Modified: llvm/trunk/lib/Object/WindowsResource.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/WindowsResource.cpp?rev=307189&r1=307188&r2=307189&view=diff
==============================================================================
--- llvm/trunk/lib/Object/WindowsResource.cpp (original)
+++ llvm/trunk/lib/Object/WindowsResource.cpp Wed Jul 5 11:59:16 2017
@@ -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::WindowsResour
: MachineType(MachineType), Resources(Parser.getTree()),
Data(Parser.getData()), StringTable(Parser.getStringTable()) {
performFileLayout();
-
OutputBuffer = MemoryBuffer::getNewMemBuffer(FileSize);
}
Modified: llvm/trunk/tools/llvm-cvtres/llvm-cvtres.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-cvtres/llvm-cvtres.cpp?rev=307189&r1=307188&r2=307189&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-cvtres/llvm-cvtres.cpp (original)
+++ llvm/trunk/tools/llvm-cvtres/llvm-cvtres.cpp Wed Jul 5 11:59:16 2017
@@ -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)
More information about the llvm-commits
mailing list