summaryrefslogtreecommitdiff
path: root/rld-files.h
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2012-12-29 10:20:22 +1100
committerChris Johns <chrisj@rtems.org>2012-12-29 10:20:22 +1100
commitcc54579b0b54bd349f1d69f40aa89607e32bf614 (patch)
tree8d5fef66763090ebab459497d7302d0111b8e988 /rld-files.h
parent0123e92cdeb732ae20c3a69047c7d05877cb0318 (diff)
Fix managing weak symbols.
Weak symbols where not being managed correctly. The symbols table is now a class with externals and weaks as separate symtabs so the externals can be searched first then the weaks and if not found an unresolved error is raised. This was found creating a libbsdport RAP file where the drivers in the all driver table resolved to the weak symbols and so linking in nothing. Fixing the weak symbols as found in the libbsdport library triggered a new resolver bug. The object files now contain the resolver state and this is used to determine if an object file has been resolved or is currently being resolved avoiding rescursive loops with dependent object files. The resolver trace output is a little easier to read.
Diffstat (limited to 'rld-files.h')
-rw-r--r--rld-files.h35
1 files changed, 31 insertions, 4 deletions
diff --git a/rld-files.h b/rld-files.h
index f579626..4b5362e 100644
--- a/rld-files.h
+++ b/rld-files.h
@@ -56,12 +56,12 @@ namespace rld
/**
* Container of archive files.
*/
- typedef std::map < std::string, archive* > archives;
+ typedef std::map < const std::string, archive* > archives;
/**
* Container of object files.
*/
- typedef std::map < std::string, object* > objects;
+ typedef std::map < const std::string, object* > objects;
/**
* Container list of object files.
@@ -700,7 +700,7 @@ namespace rld
/**
* Return the unresolved symbol table for this object file.
*/
- symbols::table& unresolved_symbols ();
+ symbols::symtab& unresolved_symbols ();
/**
* Return the list external symbols.
@@ -741,13 +741,40 @@ namespace rld
*/
const section& get_section (int index) const;
+ /**
+ * Set the object file's resolving flag.
+ */
+ void resolve_set ();
+
+ /**
+ * Clear the object file's resolving flag.
+ */
+ void resolve_clear ();
+
+ /**
+ * The resolving state.
+ */
+ bool resolving () const;
+
+ /**
+ * Set the object file resolved flag.
+ */
+ void resolved_set ();
+
+ /**
+ * The resolved state.
+ */
+ bool resolved () const;
+
private:
archive* archive_; //< Points to the archive if part of an
// archive.
bool valid_; //< If true begin has run and finished.
- symbols::table unresolved; //< This object's unresolved symbols.
+ symbols::symtab unresolved; //< This object's unresolved symbols.
symbols::pointers externals; //< This object's external symbols.
sections secs; //< The sections.
+ bool resolving_; //< The object is being resolved.
+ bool resolved_; //< The object has been resolved.
/**
* Cannot copy via a copy constructor.