aboutsummaryrefslogtreecommitdiff
path: root/lib/MC/MachObjectWriter.cpp
diff options
context:
space:
mode:
authorJim Grosbach <grosbach@apple.com>2010-11-05 18:48:58 +0000
committerJim Grosbach <grosbach@apple.com>2010-11-05 18:48:58 +0000
commitc9d1439051d130cfb947ef9ab4a95737c41e2fd1 (patch)
tree0f739dfe9d2f28078bb3574fe01f6dc85cb35fd6 /lib/MC/MachObjectWriter.cpp
parent41ed3ca19d406b6eef47c01ea16453f3080f32e8 (diff)
Allow targets to specify the MachO CPUType/CPUSubtype information.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118288 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/MC/MachObjectWriter.cpp')
-rw-r--r--lib/MC/MachObjectWriter.cpp20
1 files changed, 13 insertions, 7 deletions
diff --git a/lib/MC/MachObjectWriter.cpp b/lib/MC/MachObjectWriter.cpp
index 61df5bb35c..e98d27d73e 100644
--- a/lib/MC/MachObjectWriter.cpp
+++ b/lib/MC/MachObjectWriter.cpp
@@ -290,9 +290,14 @@ class MachObjectWriterImpl {
unsigned Is64Bit : 1;
+ uint32_t CPUType;
+ uint32_t CPUSubtype;
+
public:
- MachObjectWriterImpl(MachObjectWriter *_Writer, bool _Is64Bit)
- : Writer(_Writer), OS(Writer->getStream()), Is64Bit(_Is64Bit) {
+ MachObjectWriterImpl(MachObjectWriter *_Writer, bool _Is64Bit,
+ uint32_t _CPUType, uint32_t _CPUSubtype)
+ : Writer(_Writer), OS(Writer->getStream()), Is64Bit(_Is64Bit),
+ CPUType(_CPUType), CPUSubtype(_CPUSubtype) {
}
void Write8(uint8_t Value) { Writer->Write8(Value); }
@@ -319,10 +324,9 @@ public:
Write32(Is64Bit ? Header_Magic64 : Header_Magic32);
- // FIXME: Support cputype.
- Write32(Is64Bit ? MachO::CPUTypeX86_64 : MachO::CPUTypeI386);
- // FIXME: Support cpusubtype.
- Write32(MachO::CPUSubType_I386_ALL);
+ Write32(CPUType);
+ Write32(CPUSubtype);
+
Write32(HFT_Object);
Write32(NumLoadCommands); // Object files have a single load command, the
// segment.
@@ -1329,10 +1333,12 @@ public:
MachObjectWriter::MachObjectWriter(raw_ostream &OS,
bool Is64Bit,
+ uint32_t CPUType,
+ uint32_t CPUSubtype,
bool IsLittleEndian)
: MCObjectWriter(OS, IsLittleEndian)
{
- Impl = new MachObjectWriterImpl(this, Is64Bit);
+ Impl = new MachObjectWriterImpl(this, Is64Bit, CPUType, CPUSubtype);
}
MachObjectWriter::~MachObjectWriter() {