+template <typename A>
+uint8_t* HeaderAndLoadCommandsAtom<A>::copyDataInCodeLoadCommand(uint8_t* p) const
+{
+ macho_linkedit_data_command<P>* cmd = (macho_linkedit_data_command<P>*)p;
+ cmd->set_cmd(LC_DATA_IN_CODE);
+ cmd->set_cmdsize(sizeof(macho_linkedit_data_command<P>));
+ cmd->set_dataoff(_writer.dataInCodeSection->fileOffset);
+ cmd->set_datasize(_writer.dataInCodeSection->size);
+ return p + sizeof(macho_linkedit_data_command<P>);
+}
+
+
+template <typename A>
+uint8_t* HeaderAndLoadCommandsAtom<A>::copyLinkerOptionsLoadCommand(uint8_t* p, const std::vector<const char*>& options) const
+{
+ macho_linker_option_command<P>* cmd = (macho_linker_option_command<P>*)p;
+ cmd->set_cmd(LC_LINKER_OPTION);
+ cmd->set_count(options.size());
+ char* buffer = cmd->buffer();
+ uint32_t sz = sizeof(macho_linker_option_command<P>);
+ for (std::vector<const char*>::const_iterator it=options.begin(); it != options.end(); ++it) {
+ const char* opt = *it;
+ uint32_t len = strlen(opt);
+ strcpy(buffer, opt);
+ sz += (len + 1);
+ buffer += (len + 1);
+ }
+ sz = alignedSize(sz);
+ cmd->set_cmdsize(sz);
+ return p + sz;
+}
+
+
+template <typename A>
+uint8_t* HeaderAndLoadCommandsAtom<A>::copyDependentDRLoadCommand(uint8_t* p) const
+{
+ macho_linkedit_data_command<P>* cmd = (macho_linkedit_data_command<P>*)p;
+ cmd->set_cmd(LC_DYLIB_CODE_SIGN_DRS);
+ cmd->set_cmdsize(sizeof(macho_linkedit_data_command<P>));
+ cmd->set_dataoff(_writer.dependentDRsSection->fileOffset);
+ cmd->set_datasize(_writer.dependentDRsSection->size);
+ return p + sizeof(macho_linkedit_data_command<P>);
+}
+
+
+
+template <typename A>
+uint8_t* HeaderAndLoadCommandsAtom<A>::copyOptimizationHintsLoadCommand(uint8_t* p) const
+{
+ macho_linkedit_data_command<P>* cmd = (macho_linkedit_data_command<P>*)p;
+ cmd->set_cmd(LC_LINKER_OPTIMIZATION_HINTS);
+ cmd->set_cmdsize(sizeof(macho_linkedit_data_command<P>));
+ cmd->set_dataoff(_writer.optimizationHintsSection->fileOffset);
+ cmd->set_datasize(_writer.optimizationHintsSection->size);
+ return p + sizeof(macho_linkedit_data_command<P>);
+}
+
+