// plugin.h -- plugin manager for gold -*- C++ -*-
-// Copyright (C) 2008-2017 Free Software Foundation, Inc.
+// Copyright (C) 2008-2020 Free Software Foundation, Inc.
// Written by Cary Coutant <ccoutant@google.com>.
// This file is part of gold.
class Task_token;
class Pluginobj;
class Plugin_rescan;
+class Plugin_recorder;
// This class represents a single plugin library.
this->args_.push_back(arg);
}
+ const std::string&
+ filename() const
+ { return this->filename_; }
+
private:
Plugin(const Plugin&);
Plugin& operator=(const Plugin&);
options_(options), workqueue_(NULL), task_(NULL), input_objects_(NULL),
symtab_(NULL), layout_(NULL), dirpath_(NULL), mapfile_(NULL),
this_blocker_(NULL), extra_search_path_(), lock_(NULL),
- initialize_lock_(&lock_)
+ initialize_lock_(&lock_), defsym_defines_set_(),
+ recorder_(NULL)
{ this->current_ = plugins_.end(); }
~Plugin_manager();
+ // Returns true if the symbol name is used in the LHS of a defsym.
+ bool
+ is_defsym_def(const char* sym_name) const
+ {
+ return defsym_defines_set_.find(sym_name) != defsym_defines_set_.end();
+ }
+
// Add a plugin library.
void
add_plugin(const char* filename)
layout()
{ return this->layout_; }
+ Plugin_recorder*
+ recorder() const
+ { return this->recorder_; }
+
private:
Plugin_manager(const Plugin_manager&);
Plugin_manager& operator=(const Plugin_manager&);
std::string extra_search_path_;
Lock* lock_;
Initialize_lock initialize_lock_;
+
+ // Keep track of all symbols defined by defsym.
+ typedef Unordered_set<std::string> Defsym_defines_set;
+ Defsym_defines_set defsym_defines_set_;
+
+ // Class to record plugin actions.
+ Plugin_recorder* recorder_;
};