gdb/
[deliverable/binutils-gdb.git] / gold / script.h
index 3b8cb92f1c8462a18b651bb45640f02a36c224b9..e1134ca2861d38b01fff4efe6ac6999aaa6970bf 100644 (file)
@@ -345,6 +345,10 @@ class Symbol_assignment
   set_if_absolute(Symbol_table*, const Layout*, bool is_dot_available,
                  uint64_t dot_value);
 
+  const std::string&
+  name() const
+  { return this->name_; }
+
   // Print the assignment to the FILE.  This is for debugging.
   void
   print(FILE*) const;
@@ -423,6 +427,14 @@ class Script_options
   add_symbol_assignment(const char* name, size_t length, bool is_defsym,
                        Expression* value, bool provide, bool hidden);
 
+  // Look for an assigned symbol.
+  bool
+  is_pending_assignment(const char* name);
+  
+  // Add a reference to a symbol.
+  void
+  add_symbol_reference(const char* name, size_t length);
+
   // Add an assertion.
   void
   add_assertion(Expression* check, const char* message, size_t messagelen);
@@ -439,6 +451,32 @@ class Script_options
   void
   add_symbols_to_table(Symbol_table*);
 
+  // Used to iterate over symbols which are referenced in expressions
+  // but not defined.
+  typedef Unordered_set<std::string>::const_iterator referenced_const_iterator;
+
+  referenced_const_iterator
+  referenced_begin() const
+  { return this->symbol_references_.begin(); }
+
+  referenced_const_iterator
+  referenced_end() const
+  { return this->symbol_references_.end(); }
+
+  // Return whether a symbol is referenced but not defined.
+  bool
+  is_referenced(const std::string& name) const
+  {
+    return (this->symbol_references_.find(name)
+           != this->symbol_references_.end());
+  }
+
+  // Return whether there are any symbols which were referenced but
+  // not defined.
+  bool
+  any_unreferenced() const
+  { return !this->symbol_references_.empty(); }
+
   // Finalize the symbol values.  Also check assertions.
   void
   finalize_symbols(Symbol_table*, const Layout*);
@@ -497,6 +535,10 @@ class Script_options
   std::string entry_;
   // Symbols to set.
   Symbol_assignments symbol_assignments_;
+  // Symbols defined in an expression, for faster lookup.
+  Unordered_set<std::string> symbol_definitions_;
+  // Symbols referenced in an expression.
+  Unordered_set<std::string> symbol_references_;
   // Assertions to check.
   Assertions assertions_;
   // Version information parsed from a version script.
This page took 0.025397 seconds and 4 git commands to generate.