/// <summary> /// Emit a single object data item into the output R2R PE file using the section builder. /// </summary> /// <param name="objectData">Object data to emit</param> /// <param name="section">Target section</param> /// <param name="name">Textual name of the object data for diagnostic purposese</param> /// <param name="outputInfoBuilder">Optional output info builder to output the data item to</param> public void AddObjectData(DependencyAnalysis.ObjectNode.ObjectData objectData, ObjectNodeSection section, string name, OutputInfoBuilder outputInfoBuilder) { if (_written) { throw new InternalCompilerErrorException("Inconsistent upstream behavior - AddObjectData mustn't be called after Write"); } int targetSectionIndex; switch (section.Type) { case SectionType.ReadOnly: // We put ReadOnly data into the text section to limit the number of sections. case SectionType.Executable: targetSectionIndex = _textSectionIndex; break; case SectionType.Writeable: targetSectionIndex = _dataSectionIndex; break; default: throw new NotImplementedException(); } _sectionBuilder.AddObjectData(objectData, targetSectionIndex, name, outputInfoBuilder); }
/// <summary> /// Emit a single object data item into the output R2R PE file using the section builder. /// </summary> /// <param name="objectData">Object data to emit</param> /// <param name="section">Target section</param> /// <param name="name">Textual name of the object data for diagnostic purposese</param> /// <param name="mapFile">Optional map file to output the data item to</param> public void AddObjectData(ObjectNode.ObjectData objectData, ObjectNodeSection section, string name, TextWriter mapFile) { if (_written) { throw new InternalCompilerErrorException("Inconsistent upstream behavior - AddObjectData mustn't be called after Write"); } int targetSectionIndex; switch (section.Type) { case SectionType.Executable: targetSectionIndex = _textSectionIndex; break; case SectionType.Writeable: targetSectionIndex = _dataSectionIndex; break; case SectionType.ReadOnly: targetSectionIndex = _rdataSectionIndex; break; default: throw new NotImplementedException(); } _sectionBuilder.AddObjectData(objectData, targetSectionIndex, name, mapFile); }