[PATCH] D15868: Sort MachO sections in -r mode

Pete Cooper via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 4 14:41:59 PST 2016


pete closed this revision.
pete added a comment.

Thanks for the review.  Committed as r256786.


================
Comment at: lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp:409
@@ -408,9 +408,3 @@
 void Util::organizeSections() {
-  if (_ctx.outputMachOType() == llvm::MachO::MH_OBJECT) {
-    // Leave sections ordered as normalized file specified.
-    uint32_t sectionIndex = 1;
-    for (SectionInfo *si : _sectionInfos) {
-      si->finalSectionIndex = sectionIndex++;
-    }
-  } else {
-    switch (_ctx.outputMachOType()) {
+  // NOTE!: Keep this in sync with assignAddressesToSections.
+  switch (_ctx.outputMachOType()) {
----------------
lhames wrote:
> Is this a new requirement with this patch, or are you just documenting an existing requirement?
Turns out it was an existing requirement.  This is mostly here so that if we change something again in future we know where to look.

================
Comment at: lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp:482
@@ -489,2 +481,3 @@
 void Util::assignAddressesToSections(const NormalizedFile &file) {
+  // NOTE!: Keep this in sync with organizeSections.
   size_t hlcSize = headerAndLoadCommandsSize(file);
----------------
lhames wrote:
> And here?
Likewise here.


http://reviews.llvm.org/D15868





More information about the llvm-commits mailing list