X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fgnulinker.cpp;h=56becc2c42ef0f6f9f32f30f7ba910213a077212;hb=6b84e1f5673888753cbe566c1365222ed33fd3ac;hp=7a2901679deed67df744220b87e1cb84f5aa4c50;hpb=3938f8030b1f62802decce19777ce70fdafaff10;p=builder.git diff --git a/source/gnulinker.cpp b/source/gnulinker.cpp index 7a29016..56becc2 100644 --- a/source/gnulinker.cpp +++ b/source/gnulinker.cpp @@ -39,22 +39,19 @@ GnuLinker::~GnuLinker() delete cxx_linker; } -Target *GnuLinker::create_target(const list &sources, const string &arg) +Target *GnuLinker::create_target(const vector &sources, const string &arg) { if(sources.empty()) throw invalid_argument("GnuLinker::create_target"); - list objs; + vector objs; + objs.reserve(sources.size()); Linker *linker = default_linker; for(Target *s: sources) { - if(ObjectFile *obj = dynamic_cast(s)) - { - objs.push_back(obj); - if(obj->get_tool()->get_tag()=="CXX") - linker = cxx_linker; - } - else - throw invalid_argument("GnuLinker::create_target"); + ObjectFile &obj = dynamic_cast(*s); + objs.push_back(&obj); + if(obj.get_tool()->get_tag()=="CXX") + linker = cxx_linker; } const Component &comp = *objs.front()->get_component(); @@ -114,7 +111,7 @@ void GnuLinker::do_prepare() if(!sysroot.empty()) argv.push_back("--sysroot="+sysroot.str()); - builder.get_logger().log("auxcommands", format("Running %s", join(argv.begin(), argv.end()))); + builder.get_logger().log("auxcommands", "Running %s", join(argv.begin(), argv.end())); try { string output = ExternalTask::run_and_capture_output(argv, FS::Path(), true); @@ -141,7 +138,7 @@ void GnuLinker::do_prepare() } path /= output.substr(search_dir, end-search_dir); - builder.get_logger().log("tools", format("Got %s system path: %s", tag, path)); + builder.get_logger().log("tools", "Got %s system path: %s", tag, path); system_path.push_back(path); path_found = true; @@ -155,7 +152,7 @@ void GnuLinker::do_prepare() if(!path_found) { - builder.get_logger().log("tools", format("No %s system path found, using defaults", tag)); + builder.get_logger().log("tools", "No %s system path found, using defaults", tag); if(!sysroot.empty()) system_path.push_back(sysroot/"usr/lib"); else if(architecture->is_native()) @@ -174,7 +171,7 @@ void GnuLinker::do_prepare() } } else - system_path.push_back("/usr/"+architecture->get_cross_prefix()+"/lib"); + system_path.push_back(format("/usr/%s/lib", architecture->get_cross_prefix())); } } @@ -198,7 +195,7 @@ GnuLinker::Linker::Linker(GnuLinker &p, const string &ct): string GnuLinker::Linker::create_build_signature(const BuildInfo &binfo) const { - string result = FS::basename(executable->get_path()); + string result = Tool::create_build_signature(binfo); result += ','; if(binfo.libmode<=BuildInfo::STATIC) result += 't';