]> git.tdb.fi Git - builder.git/blobdiff - source/gnulinker.cpp
Explicitly add -lmingw32 before any other libraries
[builder.git] / source / gnulinker.cpp
index e266a8ea6123a53e59d4d06cc3666a04dbc7dc22..1b969b4c06882755926da76c57ec83e73144fddf 100644 (file)
@@ -174,9 +174,7 @@ Task *GnuLinker::Linker::run(const Target &target) const
        vector<string> argv;
        argv.push_back(executable->get_path().str());
 
-       const Component &comp = *bin.get_component();
-
-       FS::Path work_dir = comp.get_package().get_source_directory();
+       FS::Path work_dir = bin.get_component()->get_package().get_source_directory();
 
        if(const SharedLibrary *shlib = dynamic_cast<const SharedLibrary *>(&bin))
        {
@@ -225,8 +223,14 @@ Task *GnuLinker::Linker::run(const Target &target) const
        argv.push_back("-o");
        argv.push_back(relative(bin.get_path(), work_dir).str());
 
+       for(BuildInfo::WordList::const_iterator i=binfo.keep_symbols.begin(); i!=binfo.keep_symbols.end(); ++i)
+               argv.push_back("-u"+*i);
+
        bool static_link_ok = (binfo.libmode<=BuildInfo::STATIC);
 
+       if(architecture->get_system()=="windows" && architecture->get_cross_prefix().find("mingw")!=string::npos)
+               argv.push_back("-lmingw32");
+
        const Target::Dependencies &depends = target.get_dependencies();
        for(Target::Dependencies::const_iterator i=depends.begin(); i!=depends.end(); ++i)
        {