void MachOLinkingContext::configure(HeaderFileType type, Arch arch, OS os, uint32_t minOSVersion) { _outputMachOType = type; _arch = arch; _os = os; _osMinVersion = minOSVersion; switch (_outputMachOType) { case llvm::MachO::MH_EXECUTE: // If targeting newer OS, use _main if (minOS("10.8", "6.0")) { _entrySymbolName = "_main"; } else { // If targeting older OS, use start (in crt1.o) _entrySymbolName = "start"; } // __PAGEZERO defaults to 4GB on 64-bit (except for PP64 which lld does not // support) and 4KB on 32-bit. if (is64Bit(_arch)) { _pageZeroSize = 0x100000000; } else { _pageZeroSize = 0x1000; } // Make PIE by default when targetting newer OSs. switch (os) { case OS::macOSX: if (minOSVersion >= 0x000A0700) // MacOSX 10.7 _pie = true; break; case OS::iOS: if (minOSVersion >= 0x00040300) // iOS 4.3 _pie = true; break; case OS::iOS_simulator: _pie = true; break; case OS::unknown: break; } break; case llvm::MachO::MH_DYLIB: _globalsAreDeadStripRoots = true; break; case llvm::MachO::MH_BUNDLE: break; case llvm::MachO::MH_OBJECT: _printRemainingUndefines = false; _allowRemainingUndefines = true; default: break; } // Set default segment page sizes based on arch. if (arch == arch_arm64) _pageSize = 4*4096; }
bool MachOLinkingContext::addUnixThreadLoadCommand() const { switch (_outputMachOType) { case MH_EXECUTE: if (_outputMachOTypeStatic) return true; else return !minOS("10.8", "6.0"); break; case MH_DYLINKER: case MH_PRELOAD: return true; default: return false; } }
/*! SLButton::buildAABB builds and returns the axis-aligned bounding box. */ SLAABBox& SLButton::updateAABBRec() { // build AABB of subMenus SLNode::updateAABBRec(); // calculate min & max in object space SLVec3f minOS((SLfloat)_minX, (SLfloat)_minY, -0.01f); SLVec3f maxOS((SLfloat)(_minX+_btnW), (SLfloat)(_minY+_btnH), 0.01f); // enlarge aabb for avoiding rounding errors minOS -= FLT_EPSILON; maxOS += FLT_EPSILON; // apply world matrix: this overwrites the AABB of the group _aabb.fromOStoWS(minOS, maxOS, updateAndGetWM()); return _aabb; }
bool MachOLinkingContext::addEntryPointLoadCommand() const { if ((_outputMachOType == MH_EXECUTE) && !_outputMachOTypeStatic) { return minOS("10.8", "6.0"); } return false; }