[lld] r308937 - Merging r308935:

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 24 16:33:06 PDT 2017


Author: ruiu
Date: Mon Jul 24 16:33:06 2017
New Revision: 308937

URL: http://llvm.org/viewvc/llvm-project?rev=308937&view=rev
Log:
Merging r308935:
------------------------------------------------------------------------
r308935 | tstellar | 2017-07-24 16:13:31 -0700 (Mon, 24 Jul 2017) | 13 lines

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
------------------------------------------------------------------------

Modified:
    lld/branches/release_50/   (props changed)
    lld/branches/release_50/lib/ReaderWriter/MachO/ObjCPass.cpp

Propchange: lld/branches/release_50/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Jul 24 16:33:06 2017
@@ -1 +1 @@
-/lld/trunk:308492,308728
+/lld/trunk:308492,308728,308935

Modified: lld/branches/release_50/lib/ReaderWriter/MachO/ObjCPass.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/branches/release_50/lib/ReaderWriter/MachO/ObjCPass.cpp?rev=308937&r1=308936&r2=308937&view=diff
==============================================================================
--- lld/branches/release_50/lib/ReaderWriter/MachO/ObjCPass.cpp (original)
+++ lld/branches/release_50/lib/ReaderWriter/MachO/ObjCPass.cpp Mon Jul 24 16:33:06 2017
@@ -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());
   }




More information about the llvm-commits mailing list