projects
/
oota-llvm.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
MC: support different sized constants in constant pools
[oota-llvm.git]
/
include
/
llvm
/
MC
/
MCMachObjectWriter.h
diff --git
a/include/llvm/MC/MCMachObjectWriter.h
b/include/llvm/MC/MCMachObjectWriter.h
index 949d90700e083e10e87990200131ae5271092b70..12a7f0ee7bb5a8dfc6fa8ceb9ef593191ec408a6 100644
(file)
--- a/
include/llvm/MC/MCMachObjectWriter.h
+++ b/
include/llvm/MC/MCMachObjectWriter.h
@@
-11,12
+11,11
@@
#define LLVM_MC_MCMACHOBJECTWRITER_H
#include "llvm/ADT/DenseMap.h"
#define LLVM_MC_MCMACHOBJECTWRITER_H
#include "llvm/ADT/DenseMap.h"
-#include "llvm/ADT/OwningPtr.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/MC/MCExpr.h"
#include "llvm/MC/MCObjectWriter.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/MC/MCExpr.h"
#include "llvm/MC/MCObjectWriter.h"
-#include "llvm/Object/MachOFormat.h"
#include "llvm/Support/DataTypes.h"
#include "llvm/Support/DataTypes.h"
+#include "llvm/Support/MachO.h"
#include <vector>
namespace llvm {
#include <vector>
namespace llvm {
@@
-45,6
+44,13
@@
protected:
public:
virtual ~MCMachObjectTargetWriter();
public:
virtual ~MCMachObjectTargetWriter();
+ /// @name Lifetime Management
+ /// @{
+
+ virtual void reset() {};
+
+ /// @}
+
/// @name Accessors
/// @{
/// @name Accessors
/// @{
@@
-85,13
+91,13
@@
class MachObjectWriter : public MCObjectWriter {
};
/// The target specific Mach-O writer instance.
};
/// The target specific Mach-O writer instance.
-
llvm::OwningP
tr<MCMachObjectTargetWriter> TargetObjectWriter;
+
std::unique_p
tr<MCMachObjectTargetWriter> TargetObjectWriter;
/// @name Relocation Data
/// @{
llvm::DenseMap<const MCSectionData*,
/// @name Relocation Data
/// @{
llvm::DenseMap<const MCSectionData*,
- std::vector<
object::macho::RelocationEntry
> > Relocations;
+ std::vector<
MachO::any_relocation_info
> > Relocations;
llvm::DenseMap<const MCSectionData*, unsigned> IndirectSymBase;
/// @}
llvm::DenseMap<const MCSectionData*, unsigned> IndirectSymBase;
/// @}
@@
-105,12
+111,21
@@
class MachObjectWriter : public MCObjectWriter {
/// @}
/// @}
+ MachSymbolData *findSymbolData(const MCSymbol &Sym);
+
public:
MachObjectWriter(MCMachObjectTargetWriter *MOTW, raw_ostream &_OS,
bool _IsLittleEndian)
: MCObjectWriter(_OS, _IsLittleEndian), TargetObjectWriter(MOTW) {
}
public:
MachObjectWriter(MCMachObjectTargetWriter *MOTW, raw_ostream &_OS,
bool _IsLittleEndian)
: MCObjectWriter(_OS, _IsLittleEndian), TargetObjectWriter(MOTW) {
}
+ /// @name Lifetime management Methods
+ /// @{
+
+ void reset() override;
+
+ /// @}
+
/// @name Utility Methods
/// @{
/// @name Utility Methods
/// @{
@@
-140,10
+155,9
@@
public:
/// @{
bool is64Bit() const { return TargetObjectWriter->is64Bit(); }
/// @{
bool is64Bit() const { return TargetObjectWriter->is64Bit(); }
- bool isARM() const {
- uint32_t CPUType = TargetObjectWriter->getCPUType() &
- ~object::mach::CTFM_ArchMask;
- return CPUType == object::mach::CTM_ARM;
+ bool isX86_64() const {
+ uint32_t CPUType = TargetObjectWriter->getCPUType();
+ return CPUType == MachO::CPU_TYPE_X86_64;
}
/// @}
}
/// @}
@@
-153,8
+167,8
@@
public:
/// WriteSegmentLoadCommand - Write a segment load command.
///
/// WriteSegmentLoadCommand - Write a segment load command.
///
- /// \
arg NumSections -
The number of sections in this segment.
- /// \
arg SectionDataSize -
The total size of the sections.
+ /// \
param NumSections
The number of sections in this segment.
+ /// \
param SectionDataSize
The total size of the sections.
void WriteSegmentLoadCommand(unsigned NumSections,
uint64_t VMSize,
uint64_t SectionDataStartOffset,
void WriteSegmentLoadCommand(unsigned NumSections,
uint64_t VMSize,
uint64_t SectionDataStartOffset,
@@
-182,6
+196,8
@@
public:
void WriteLinkeditLoadCommand(uint32_t Type, uint32_t DataOffset,
uint32_t DataSize);
void WriteLinkeditLoadCommand(uint32_t Type, uint32_t DataOffset,
uint32_t DataSize);
+ void WriteLinkerOptionsLoadCommand(const std::vector<std::string> &Options);
+
// FIXME: We really need to improve the relocation validation. Basically, we
// want to implement a separate computation which evaluates the relocation
// entry as the linker would, and verifies that the resultant fixup value is
// FIXME: We really need to improve the relocation validation. Basically, we
// want to implement a separate computation which evaluates the relocation
// entry as the linker would, and verifies that the resultant fixup value is
@@
-197,7
+213,7
@@
public:
// these through in many cases.
void addRelocation(const MCSectionData *SD,
// these through in many cases.
void addRelocation(const MCSectionData *SD,
-
object::macho::RelocationEntry
&MRE) {
+
MachO::any_relocation_info
&MRE) {
Relocations[SD].push_back(MRE);
}
Relocations[SD].push_back(MRE);
}
@@
-216,15
+232,14
@@
public:
void RecordRelocation(const MCAssembler &Asm, const MCAsmLayout &Layout,
const MCFragment *Fragment, const MCFixup &Fixup,
void RecordRelocation(const MCAssembler &Asm, const MCAsmLayout &Layout,
const MCFragment *Fragment, const MCFixup &Fixup,
- MCValue Target, uint64_t &FixedValue);
+ MCValue Target, bool &IsPCRel,
+ uint64_t &FixedValue) override;
void BindIndirectSymbols(MCAssembler &Asm);
/// ComputeSymbolTable - Compute the symbol table data
///
/// \param StringTable [out] - The string table data.
void BindIndirectSymbols(MCAssembler &Asm);
/// ComputeSymbolTable - Compute the symbol table data
///
/// \param StringTable [out] - The string table data.
- /// \param StringIndexMap [out] - Map from symbol names to offsets in the
- /// string table.
void ComputeSymbolTable(MCAssembler &Asm, SmallString<256> &StringTable,
std::vector<MachSymbolData> &LocalSymbolData,
std::vector<MachSymbolData> &ExternalSymbolData,
void ComputeSymbolTable(MCAssembler &Asm, SmallString<256> &StringTable,
std::vector<MachSymbolData> &LocalSymbolData,
std::vector<MachSymbolData> &ExternalSymbolData,
@@
-233,15
+248,18
@@
public:
void computeSectionAddresses(const MCAssembler &Asm,
const MCAsmLayout &Layout);
void computeSectionAddresses(const MCAssembler &Asm,
const MCAsmLayout &Layout);
- void ExecutePostLayoutBinding(MCAssembler &Asm, const MCAsmLayout &Layout);
+ void markAbsoluteVariableSymbols(MCAssembler &Asm,
+ const MCAsmLayout &Layout);
+ void ExecutePostLayoutBinding(MCAssembler &Asm,
+ const MCAsmLayout &Layout) override;
-
virtual
bool IsSymbolRefDifferenceFullyResolvedImpl(const MCAssembler &Asm,
-
const MCSymbolData &DataA,
-
const MCFragment &FB,
-
bool InSet,
-
bool IsPCRel) const
;
+ bool IsSymbolRefDifferenceFullyResolvedImpl(const MCAssembler &Asm,
+ const MCSymbolData &DataA,
+ const MCFragment &FB,
+ bool InSet,
+
bool IsPCRel) const override
;
- void WriteObject(MCAssembler &Asm, const MCAsmLayout &Layout);
+ void WriteObject(MCAssembler &Asm, const MCAsmLayout &Layout)
override
;
};
};