/// configure the output filename bool OutputFormatOptions::parseOutput(Module& pModule, LinkerConfig& pConfig) { if (true == m_Shared || true == m_PIE) { // -shared or -pie m_FileType = mcld::LinkerConfig::DynObj; } else if (true == m_Relocatable) { // partial linking m_FileType = mcld::LinkerConfig::Object; } else if (mcld::LinkerConfig::Binary == m_OFormat) { // binary output m_FileType = mcld::LinkerConfig::Binary; } pConfig.setCodeGenType(m_FileType); std::string output_filename(m_OutputFilename.native()); if (m_OutputFilename.empty()) { if (llvm::Triple::Win32 == pConfig.targets().triple().getOS()) { output_filename.assign("_out"); switch (m_FileType) { case mcld::LinkerConfig::Object: { output_filename += ".obj"; break; } case mcld::LinkerConfig::DynObj: { output_filename += ".dll"; break; } case mcld::LinkerConfig::Exec: { output_filename += ".exe"; break; } case mcld::LinkerConfig::External: break; default: { return false; break; } } // switch } else { if (mcld::LinkerConfig::Object == m_FileType || mcld::LinkerConfig::DynObj == m_FileType || mcld::LinkerConfig::Exec == m_FileType || mcld::LinkerConfig::External == m_FileType) { output_filename.assign("a.out"); } else { return false; } } } // end of if empty m_OutputFilename pModule.setName(output_filename); return true; }