diff options
author | Chris Johns <chrisj@rtems.org> | 2012-10-22 17:58:34 -0700 |
---|---|---|
committer | Chris Johns <chrisj@rtems.org> | 2012-10-22 17:58:34 -0700 |
commit | 575084057061ee97c8a08cc0331393cf79a69cad (patch) | |
tree | d7e86dedfa71b33bbe15d269d1799d9a05773c50 /rld-outputter.cpp | |
parent | f97a935a3adb683a6ebc66e72f56644cf51d52f1 (diff) |
Fix repeats in output when cmd line objects depend on each other.
If an object on the command line depends on another object the output
code wrote the object files and then the dependent files and a
command line object file that is dependent ended up in the object
and dependent lists. A simple merge and unique fixed it.
Also moved the script generation code into a separate function
that can be used in a application container.
Diffstat (limited to 'rld-outputter.cpp')
-rw-r--r-- | rld-outputter.cpp | 61 |
1 files changed, 59 insertions, 2 deletions
diff --git a/rld-outputter.cpp b/rld-outputter.cpp index 7d36089..ef18d5d 100644 --- a/rld-outputter.cpp +++ b/rld-outputter.cpp @@ -38,6 +38,50 @@ namespace rld { namespace outputter { + const std::string + script_text (rld::files::object_list& dependents, + rld::files::cache& cache) + { + std::ostringstream out; + rld::files::object_list objects; + + cache.get_objects (objects); + + objects.merge (dependents); + objects.unique (); + + for (rld::files::object_list::iterator oi = objects.begin (); + oi != objects.end (); + ++oi) + { + rld::files::object& obj = *(*oi); + + if (rld::verbose () >= RLD_VERBOSE_INFO) + std::cout << " o: " << obj.name ().full () << std::endl; + + out << "o:" << obj.name ().basename () << std::endl; + + rld::symbols::table& unresolved = obj.unresolved_symbols (); + + int count = 0; + for (rld::symbols::table::iterator ursi = unresolved.begin (); + ursi != unresolved.begin (); + ++ursi) + { + rld::symbols::symbol& urs = (*ursi).second; + + ++count; + + if (rld::verbose () >= RLD_VERBOSE_INFO) + std::cout << " u: " << count << ':' << urs.name () << std::endl; + + out << " u:" << count << ':' << urs.name () << std::endl; + } + } + + return out.str (); + } + void archive (const std::string& name, rld::files::object_list& dependents, @@ -74,6 +118,18 @@ namespace rld */ out << "!# rls" << std::endl; + try + { + out << script_text (dependents, cache); + } + catch (...) + { + out.close (); + } + + out.close (); + +#if 0 rld::files::object_list objects; cache.get_objects (objects); @@ -99,7 +155,7 @@ namespace rld if (rld::verbose () >= RLD_VERBOSE_INFO) std::cout << " d: " << obj.name ().full () << std::endl; - out << "o:" << obj.name ().basename () << std::endl; + out << "d:" << obj.name ().basename () << std::endl; int count = 0; for (rld::symbols::table::iterator ursi = unresolved.begin (); @@ -108,9 +164,10 @@ namespace rld { ++count; rld::symbols::symbol& urs = (*ursi).second; - out << " d:" << count << ':' << urs.name () << std::endl; + out << " u:" << count << ':' << urs.name () << std::endl; } } +#endif } } } |