#include <mach/machine.h>
#include <vector>
+#include <map>
#include "ld.hpp"
#include "huge.h"
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 )
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;