+ FS::Path path;
+ if(!output.compare(search_dir, 2, "=/"))
+ {
+ search_dir += 2;
+ if(sysroot.empty())
+ path = "/";
+ else
+ path = sysroot;
+ }
+
+ path /= output.substr(search_dir, end-search_dir);
+ builder.get_logger().log("tools", "Got %s system path: %s", tag, path);
+ system_path.push_back(path);
+ path_found = true;
+
+ start = end+3;
+ }
+ }
+ catch(...)
+ { }
+ }
+
+ if(!path_found)
+ {
+ 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())
+ {
+ system_path.push_back("/lib");
+ system_path.push_back("/usr/lib");
+ if(architecture->match_name("pc-32-linux"))
+ {
+ system_path.push_back("/lib/i386-linux-gnu");
+ system_path.push_back("/usr/lib/i386-linux-gnu");
+ }
+ else if(architecture->match_name("pc-64-linux"))
+ {
+ system_path.push_back("/lib/x86_64-linux-gnu");
+ system_path.push_back("/usr/lib/x86_64-linux-gnu");
+ }
+ }
+ else
+ system_path.push_back(format("/usr/%s/lib", architecture->get_cross_prefix()));
+ }
+}
+
+Task *GnuLinker::_run(const Binary &bin)
+{
+ const Tool &tool = *bin.get_tool();
+ const Builder &builder = tool.get_builder();
+ const Architecture &arch = *tool.get_architecture();
+
+ ExternalTask::Arguments argv;
+ argv.push_back(tool.get_executable()->get_path().str());
+
+ FS::Path work_dir = bin.get_component()->get_package().get_source_directory();