diff options
author | Jim Grosbach <grosbach@apple.com> | 2014-03-18 22:09:05 +0000 |
---|---|---|
committer | Jim Grosbach <grosbach@apple.com> | 2014-03-18 22:09:05 +0000 |
commit | d55fc3f151f3167da4aa467cf2ff4038f82e3664 (patch) | |
tree | f178c30a8dc074fd457634ac48513b3bf1331fc8 /include | |
parent | 802d81591a1695604e0c78fbd76261d0900b5ee3 (diff) | |
download | llvm-d55fc3f151f3167da4aa467cf2ff4038f82e3664.tar.gz llvm-d55fc3f151f3167da4aa467cf2ff4038f82e3664.tar.bz2 llvm-d55fc3f151f3167da4aa467cf2ff4038f82e3664.tar.xz |
Darwin: Add assembler directives to create version-min load commands.
Allow object files to be tagged with a version-min load command for iOS
or MacOSX.
Teach macho-dump to understand the version-min load commands for
testcases.
rdar://11337778
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204190 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/MC/MCAssembler.h | 22 | ||||
-rw-r--r-- | include/llvm/MC/MCDirectives.h | 5 | ||||
-rw-r--r-- | include/llvm/MC/MCStreamer.h | 4 | ||||
-rw-r--r-- | include/llvm/Object/MachO.h | 2 |
4 files changed, 33 insertions, 0 deletions
diff --git a/include/llvm/MC/MCAssembler.h b/include/llvm/MC/MCAssembler.h index c4b475ee03..4b519dd7c9 100644 --- a/include/llvm/MC/MCAssembler.h +++ b/include/llvm/MC/MCAssembler.h @@ -15,6 +15,7 @@ #include "llvm/ADT/SmallString.h" #include "llvm/ADT/ilist.h" #include "llvm/ADT/ilist_node.h" +#include "llvm/MC/MCDirectives.h" #include "llvm/MC/MCFixup.h" #include "llvm/MC/MCInst.h" #include "llvm/MC/MCSubtargetInfo.h" @@ -840,6 +841,15 @@ public: const_data_region_iterator; typedef std::vector<DataRegionData>::iterator data_region_iterator; + /// MachO specific deployment target version info. + // A Major version of 0 indicates that no version information was supplied + // and so the corresponding load command should not be emitted. + typedef struct { + MCVersionMinType Kind; + unsigned Major; + unsigned Minor; + unsigned Update; + } VersionMinInfoType; private: MCAssembler(const MCAssembler&) LLVM_DELETED_FUNCTION; void operator=(const MCAssembler&) LLVM_DELETED_FUNCTION; @@ -902,6 +912,8 @@ private: // Access to the flags is necessary in cases where assembler directives affect // which flags to be set. unsigned ELFHeaderEFlags; + + VersionMinInfoType VersionMinInfo; private: /// Evaluate a fixup to a relocatable expression and the value which should be /// placed into the fixup. @@ -983,6 +995,16 @@ public: unsigned getELFHeaderEFlags() const {return ELFHeaderEFlags;} void setELFHeaderEFlags(unsigned Flags) { ELFHeaderEFlags = Flags;} + /// MachO deployment target version information. + const VersionMinInfoType &getVersionMinInfo() const { return VersionMinInfo; } + void setVersionMinInfo(MCVersionMinType Kind, unsigned Major, unsigned Minor, + unsigned Update) { + VersionMinInfo.Kind = Kind; + VersionMinInfo.Major = Major; + VersionMinInfo.Minor = Minor; + VersionMinInfo.Update = Update; + } + public: /// Construct a new assembler instance. /// diff --git a/include/llvm/MC/MCDirectives.h b/include/llvm/MC/MCDirectives.h index 0461766c2f..f9d66e0b15 100644 --- a/include/llvm/MC/MCDirectives.h +++ b/include/llvm/MC/MCDirectives.h @@ -60,6 +60,11 @@ enum MCDataRegionType { MCDR_DataRegionEnd ///< .end_data_region }; +enum MCVersionMinType { + MCVM_IOSVersionMin, ///< .ios_version_min + MCVM_OSXVersionMin ///< .macosx_version_min +}; + } // end namespace llvm #endif diff --git a/include/llvm/MC/MCStreamer.h b/include/llvm/MC/MCStreamer.h index fc7a3b8648..37d18fbe43 100644 --- a/include/llvm/MC/MCStreamer.h +++ b/include/llvm/MC/MCStreamer.h @@ -386,6 +386,10 @@ public: /// EmitDataRegion - Note in the output the specified region @p Kind. virtual void EmitDataRegion(MCDataRegionType Kind) {} + /// EmitVersionMin - Specify the MachO minimum deployment target version. + virtual void EmitVersionMin(MCVersionMinType, unsigned Major, unsigned Minor, + unsigned Update) {} + /// EmitThumbFunc - Note in the output that the specified @p Func is /// a Thumb mode function (ARM target only). virtual void EmitThumbFunc(MCSymbol *Func) = 0; diff --git a/include/llvm/Object/MachO.h b/include/llvm/Object/MachO.h index 50296aed9b..34edec3ebf 100644 --- a/include/llvm/Object/MachO.h +++ b/include/llvm/Object/MachO.h @@ -178,6 +178,8 @@ public: getSegment64LoadCommand(const LoadCommandInfo &L) const; MachO::linker_options_command getLinkerOptionsLoadCommand(const LoadCommandInfo &L) const; + MachO::version_min_command + getVersionMinLoadCommand(const LoadCommandInfo &L) const; MachO::any_relocation_info getRelocation(DataRefImpl Rel) const; MachO::data_in_code_entry getDice(DataRefImpl Rel) const; |