[PATCH] D35052: Fix ObjCPass on big-endian host
Tom Stellard via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 6 06:04:23 PDT 2017
tstellar created this revision.
This fixes test/mach-o/objc-image-info-pass-output.yaml on
big-endian hosts.
https://reviews.llvm.org/D35052
Files:
lib/ReaderWriter/MachO/ObjCPass.cpp
Index: lib/ReaderWriter/MachO/ObjCPass.cpp
===================================================================
--- lib/ReaderWriter/MachO/ObjCPass.cpp
+++ lib/ReaderWriter/MachO/ObjCPass.cpp
@@ -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 @@
///
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,9 @@
}
Data.info.flags |= (swiftVersion << 8);
+
+ using normalized::write32;
+ write32(Data.bytes + 4, Data.info.flags, isBig);
}
~ObjCImageInfoAtom() override = default;
@@ -109,7 +113,8 @@
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());
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D35052.105413.patch
Type: text/x-patch
Size: 1352 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170706/b87e57af/attachment.bin>
More information about the llvm-commits
mailing list