mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-16 14:31:59 +00:00
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
This commit is contained in:
parent
41ed3ca19d
commit
c9d1439051
@ -25,7 +25,8 @@ class MachObjectWriter : public MCObjectWriter {
|
||||
void *Impl;
|
||||
|
||||
public:
|
||||
MachObjectWriter(raw_ostream &OS, bool Is64Bit, bool IsLittleEndian = true);
|
||||
MachObjectWriter(raw_ostream &OS, bool Is64Bit, uint32_t CPUType,
|
||||
uint32_t CPUSubtype, bool IsLittleEndian = true);
|
||||
virtual ~MachObjectWriter();
|
||||
|
||||
virtual void ExecutePostLayoutBinding(MCAssembler &Asm);
|
||||
|
@ -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() {
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "llvm/MC/MCSectionMachO.h"
|
||||
#include "llvm/MC/MachObjectWriter.h"
|
||||
#include "llvm/Support/ELF.h"
|
||||
#include "llvm/Support/MachO.h"
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include "llvm/Target/TargetRegistry.h"
|
||||
@ -128,7 +129,9 @@ public:
|
||||
}
|
||||
|
||||
MCObjectWriter *createObjectWriter(raw_ostream &OS) const {
|
||||
return new MachObjectWriter(OS, /*Is64Bit=*/false);
|
||||
// FIXME: Subtarget info should be derived. Force v7 for now.
|
||||
return new MachObjectWriter(OS, /*Is64Bit=*/false, MachO::CPUTypeARM,
|
||||
MachO::CPUSubType_ARM_V7);
|
||||
}
|
||||
|
||||
virtual bool doesSectionRequireSymbols(const MCSection &Section) const {
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "llvm/MC/MCSectionMachO.h"
|
||||
#include "llvm/MC/MachObjectWriter.h"
|
||||
#include "llvm/Support/ELF.h"
|
||||
#include "llvm/Support/MachO.h"
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include "llvm/Target/TargetRegistry.h"
|
||||
@ -396,7 +397,8 @@ public:
|
||||
}
|
||||
|
||||
MCObjectWriter *createObjectWriter(raw_ostream &OS) const {
|
||||
return new MachObjectWriter(OS, /*Is64Bit=*/false);
|
||||
return new MachObjectWriter(OS, /*Is64Bit=*/false, MachO::CPUTypeI386,
|
||||
MachO::CPUSubType_I386_ALL);
|
||||
}
|
||||
};
|
||||
|
||||
@ -412,7 +414,8 @@ public:
|
||||
}
|
||||
|
||||
MCObjectWriter *createObjectWriter(raw_ostream &OS) const {
|
||||
return new MachObjectWriter(OS, /*Is64Bit=*/true);
|
||||
return new MachObjectWriter(OS, /*Is64Bit=*/true, MachO::CPUTypeX86_64,
|
||||
MachO::CPUSubType_I386_ALL);
|
||||
}
|
||||
|
||||
virtual bool doesSectionRequireSymbols(const MCSection &Section) const {
|
||||
|
Loading…
x
Reference in New Issue
Block a user