Fix ObjCPass on big-endian host

Summary:
This fixes test/mach-o/objc-image-info-pass-output.yaml on
big-endian hosts.

Reviewers: lhames, kledzik, ruiu

Reviewed By: ruiu

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D35052

llvm-svn: 308935
This commit is contained in:
Tom Stellard 2017-07-24 23:13:31 +00:00
parent 7cff7d4664
commit 1d70d75f46
1 changed files with 6 additions and 2 deletions

View File

@ -11,6 +11,7 @@
#include "ArchHandler.h"
#include "File.h"
#include "MachONormalizedFileBinaryUtils.h"
#include "MachOPasses.h"
#include "lld/Core/DefinedAtom.h"
#include "lld/Core/File.h"
@ -29,7 +30,7 @@ namespace mach_o {
///
class ObjCImageInfoAtom : public SimpleDefinedAtom {
public:
ObjCImageInfoAtom(const File &file,
ObjCImageInfoAtom(const File &file, bool isBig,
MachOLinkingContext::ObjCConstraint objCConstraint,
uint32_t swiftVersion)
: SimpleDefinedAtom(file) {
@ -54,6 +55,8 @@ public:
}
Data.info.flags |= (swiftVersion << 8);
normalized::write32(Data.bytes + 4, Data.info.flags, isBig);
}
~ObjCImageInfoAtom() override = default;
@ -109,7 +112,8 @@ public:
private:
const DefinedAtom* getImageInfo() {
return new (_file.allocator()) ObjCImageInfoAtom(_file,
bool IsBig = MachOLinkingContext::isBigEndian(_ctx.arch());
return new (_file.allocator()) ObjCImageInfoAtom(_file, IsBig,
_ctx.objcConstraint(),
_ctx.swiftVersion());
}