//
// The LLVM Compiler Infrastructure
//
-// This file was developed by Nate Begeman and is distributed under the
-// University of Illinois Open Source License. See LICENSE.TXT for details.
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
#include "llvm/Target/TargetData.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Target/TargetMachOWriterInfo.h"
+#include <map>
namespace llvm {
class GlobalVariable;
class MachOWriter : public MachineFunctionPass {
friend class MachOCodeEmitter;
public:
+ static char ID;
MachineCodeEmitter &getMachineCodeEmitter() const {
return *(MachineCodeEmitter*)MCE;
}
// The following constants are getting pulled in by one of the
// system headers, which creates a neat clash with the enum.
#if !defined(VM_PROT_NONE)
-#define VM_PROT_NONE 0x00
+#define VM_PROT_NONE 0x00
#endif
#if !defined(VM_PROT_READ)
-#define VM_PROT_READ 0x01
+#define VM_PROT_READ 0x01
#endif
#if !defined(VM_PROT_WRITE)
-#define VM_PROT_WRITE 0x02
+#define VM_PROT_WRITE 0x02
#endif
#if !defined(VM_PROT_EXECUTE)
-#define VM_PROT_EXECUTE 0x04
+#define VM_PROT_EXECUTE 0x04
#endif
#if !defined(VM_PROT_ALL)
-#define VM_PROT_ALL 0x07
+#define VM_PROT_ALL 0x07
#endif
// Constants for the vm protection fields
const Type *Ty = C->getType();
if (Ty->isPrimitiveType() || Ty->isInteger()) {
- unsigned Size = TM.getTargetData()->getTypeSize(Ty);
+ unsigned Size = TM.getTargetData()->getABITypeSize(Ty);
switch(Size) {
default: break; // Fall through to __TEXT,__const
case 4:
/// PendingSyms - This is a list of externally defined symbols that we have
/// been asked to emit, but have not seen a reference to. When a reference
/// is seen, the symbol will move from this list to the SymbolTable.
- std::vector<MachOSym> PendingSyms;
+ std::vector<GlobalValue*> PendingGlobals;
/// DynamicSymbolTable - This is just a vector of indices into
/// SymbolTable to aid in emitting the DYSYMTAB load command.
unsigned ToIndex,
OutputBuffer &RelocOut,
OutputBuffer &SecOut,
- bool Scattered) {
+ bool Scattered,
+ bool Extern) {
return TM.getMachOWriterInfo()->GetTargetRelocation(MR, FromIdx, ToAddr,
ToIndex, RelocOut,
- SecOut, Scattered);
+ SecOut, Scattered,
+ Extern);
}
};
}