]> git.saurik.com Git - apple/ld64.git/blobdiff - src/ld/passes/huge.cpp
ld64-253.3.tar.gz
[apple/ld64.git] / src / ld / passes / huge.cpp
index 932122aa27e7c7dbac05667270aa7205c115e64c..693976cef69b27c15a3b60e6944b62cf3d5a75d7 100644 (file)
@@ -30,6 +30,7 @@
 #include <mach/machine.h>
 
 #include <vector>
+#include <map>
 
 #include "ld.hpp"
 #include "huge.h"
@@ -83,7 +84,7 @@ void doPass(const Options& opts, ld::Internal& state)
                return;
 
        // move all zero fill atoms that >1MB in size to a new __huge section
-       ld::Internal::FinalSection* hugeSection = state.getFinalSection(ld::Section("__DATA", "__huge", ld::Section::typeZeroFill));
+       ld::Internal::FinalSection* hugeSection = state.getFinalSection(*new ld::Section("__DATA", "__huge", ld::Section::typeZeroFill));
        for (std::vector<ld::Internal::FinalSection*>::iterator sit=state.sections.begin(); sit != state.sections.end(); ++sit) {
                ld::Internal::FinalSection* sect = *sit;
                if ( sect == hugeSection )
@@ -94,6 +95,7 @@ void doPass(const Options& opts, ld::Internal& state)
                                const ld::Atom* atom = *ait;
                                if ( atom->size() > 1024*1024 ) {
                                        hugeSection->atoms.push_back(atom);
+                                       state.atomToSection[atom] = hugeSection;
                                        if (log) fprintf(stderr, "moved to __huge: %s, size=%llu\n", atom->name(), atom->size());
                                        *ait = NULL;  // change atom to NULL for later bulk removal
                                        movedSome = true;