aboutsummaryrefslogtreecommitdiff
path: root/gold/plugin.cc
diff options
context:
space:
mode:
authorSriraman Tallam <tmsriram@google.com>2018-02-22 13:56:46 -0800
committerSriraman Tallam <tmsriram@google.com>2018-04-27 15:00:42 -0700
commit8efd17cb25686c51b9db6531ae2fbeb2e6ef2399 (patch)
tree2eba677c050c91e8e2eb6e412365c61b055c8c12 /gold/plugin.cc
parent4ba9ba2ceb8ca16d414c5ec8f5f48792e60165e5 (diff)
downloadbinutils-binutils-2_29-branch.zip
binutils-binutils-2_29-branch.tar.gz
binutils-binutils-2_29-branch.tar.bz2
New plugin interface to get list of symbols wrapped with --wrap option.binutils-2_29-branch
2018-02-22 Sriraman Tallam <tmsriram@google.com> * plugin.cc (get_wrap_symbols): New plugin interface. (load): Add get_wrap_symbols to transfer vector. * plugin-api.h (ld_plugin_get_wrap_symbols): New plugin interface. * testsuite/plugin_test.c (onload): Call and check get_wrap_symbols interface. * testsuite/plugin_test_wrap_symbols.sh: New test script. * testsuite/plugin_test_wrap_symbols_1.cc: New file. * testsuite/plugin_test_wrap_symbols_2.cc: New file. * testsuite/Makefile.am (plugin_test_wrap_symbols): New test. * testsuite/Makefile.in: Regenerate. (cherry picked from commit 0b65c07b97c43e8891c2e14061270878a85222c8)
Diffstat (limited to 'gold/plugin.cc')
-rw-r--r--gold/plugin.cc28
1 files changed, 27 insertions, 1 deletions
diff --git a/gold/plugin.cc b/gold/plugin.cc
index 0284162..3ebba62 100644
--- a/gold/plugin.cc
+++ b/gold/plugin.cc
@@ -167,6 +167,9 @@ static enum ld_plugin_status
get_input_section_size(const struct ld_plugin_section section,
uint64_t* secsize);
+static enum ld_plugin_status
+get_wrap_symbols(uint64_t *num_symbols, const char ***wrap_symbol_list);
+
};
#endif // ENABLE_PLUGINS
@@ -211,7 +214,7 @@ Plugin::load()
sscanf(ver, "%d.%d", &major, &minor);
// Allocate and populate a transfer vector.
- const int tv_fixed_size = 29;
+ const int tv_fixed_size = 30;
int tv_size = this->args_.size() + tv_fixed_size;
ld_plugin_tv* tv = new ld_plugin_tv[tv_size];
@@ -346,6 +349,10 @@ Plugin::load()
tv[i].tv_u.tv_get_input_section_size = get_input_section_size;
++i;
+ tv[i].tv_tag = LDPT_GET_WRAP_SYMBOLS;
+ tv[i].tv_u.tv_get_wrap_symbols = get_wrap_symbols;
+
+ ++i;
tv[i].tv_tag = LDPT_NULL;
tv[i].tv_u.tv_val = 0;
@@ -1808,6 +1815,25 @@ get_input_section_size(const struct ld_plugin_section section,
return LDPS_OK;
}
+static enum ld_plugin_status
+get_wrap_symbols(uint64_t *count, const char ***wrap_symbols)
+{
+ gold_assert(parameters->options().has_plugins());
+ *count = parameters->options().wrap_size();
+
+ if (*count == 0)
+ return LDPS_OK;
+
+ *wrap_symbols = new const char *[*count];
+ int i = 0;
+ for (options::String_set::const_iterator
+ it = parameters->options().wrap_begin();
+ it != parameters->options().wrap_end(); ++it, ++i) {
+ (*wrap_symbols)[i] = it->c_str();
+ }
+ return LDPS_OK;
+}
+
// Specify the ordering of sections in the final layout. The sections are
// specified as (handle,shndx) pairs in the two arrays in the order in