aboutsummaryrefslogtreecommitdiff
path: root/gold/plugin.cc
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>2009-12-10 07:44:28 +0000
committerIan Lance Taylor <ian@airs.com>2009-12-10 07:44:28 +0000
commitb59befec8e8a9bec906f2a0ae623db822c9ef2cd (patch)
tree5f5fd1f115c7e979c1d3e63f0d1fb16b17ab372f /gold/plugin.cc
parent8a2c8fef1949ad6eb7bd0deb84c9caf7f141c304 (diff)
downloadgdb-b59befec8e8a9bec906f2a0ae623db822c9ef2cd.zip
gdb-b59befec8e8a9bec906f2a0ae623db822c9ef2cd.tar.gz
gdb-b59befec8e8a9bec906f2a0ae623db822c9ef2cd.tar.bz2
* plugin.cc (Plugin::load): Don't cast from void* to a function
pointer.
Diffstat (limited to 'gold/plugin.cc')
-rw-r--r--gold/plugin.cc8
1 files changed, 5 insertions, 3 deletions
diff --git a/gold/plugin.cc b/gold/plugin.cc
index 317fb7d..ff9f98f 100644
--- a/gold/plugin.cc
+++ b/gold/plugin.cc
@@ -109,14 +109,16 @@ Plugin::load()
}
// Find the plugin's onload entry point.
- ld_plugin_onload onload = reinterpret_cast<ld_plugin_onload>
- (dlsym(this->handle_, "onload"));
- if (onload == NULL)
+ void* ptr = dlsym(this->handle_, "onload");
+ if (ptr == NULL)
{
gold_error(_("%s: could not find onload entry point"),
this->filename_.c_str());
return;
}
+ ld_plugin_onload onload;
+ gold_assert(sizeof(onload) == sizeof(ptr));
+ memcpy(&onload, &ptr, sizeof(ptr));
// Get the linker's version number.
const char* ver = get_version_string();