[lld] r260184 - Reorder enum entry as its used for atom sorting.

Pete Cooper via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 8 17:27:30 PST 2016


Author: pete
Date: Mon Feb  8 19:27:30 2016
New Revision: 260184

URL: http://llvm.org/viewvc/llvm-project?rev=260184&view=rev
Log:
Reorder enum entry as its used for atom sorting.

The atom content type enum is used as a tie breaker to sort atoms.
In that case, we want MachHeader to be before typeCode as it really will
be before the code in the final executable.

Test case to follow in the next commit or two.

Modified:
    lld/trunk/include/lld/Core/DefinedAtom.h
    lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp

Modified: lld/trunk/include/lld/Core/DefinedAtom.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Core/DefinedAtom.h?rev=260184&r1=260183&r2=260184&view=diff
==============================================================================
--- lld/trunk/include/lld/Core/DefinedAtom.h (original)
+++ lld/trunk/include/lld/Core/DefinedAtom.h Mon Feb  8 19:27:30 2016
@@ -106,6 +106,7 @@ public:
 
   enum ContentType {
     typeUnknown,            // for use with definitionUndefined
+    typeMachHeader,         // atom representing mach_header [Darwin]
     typeCode,               // executable code
     typeResolver,           // function which returns address of target
     typeBranchIsland,       // linker created for large binaries
@@ -146,7 +147,6 @@ public:
     typeTLVInitialData,     // initial data for a TLV [Darwin]
     typeTLVInitialZeroFill, // TLV initial zero fill data [Darwin]
     typeTLVInitializerPtr,  // pointer to thread local initializer [Darwin]
-    typeMachHeader,         // atom representing mach_header [Darwin]
     typeDSOHandle,          // atom representing DSO handle [Darwin]
     typeThreadZeroFill,     // Uninitialized thread local data(TBSS) [ELF]
     typeThreadData,         // Initialized thread local data(TDATA) [ELF]

Modified: lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp?rev=260184&r1=260183&r2=260184&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp (original)
+++ lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp Mon Feb  8 19:27:30 2016
@@ -301,6 +301,7 @@ SectionInfo *Util::getFinalSection(Defin
       continue;
     SectionAttr sectionAttrs = 0;
     switch (atomType) {
+    case DefinedAtom::typeMachHeader:
     case DefinedAtom::typeCode:
     case DefinedAtom::typeStub:
     case DefinedAtom::typeStubHelper:




More information about the llvm-commits mailing list