[GOLD] [PATCH] Casting plugin onload entry point
Ian Lance Taylor
iant@google.com
Thu Dec 10 07:46:00 GMT 2009
Viktor Kutuzov <vkutuzov@accesssoftek.com> writes:
> Depending on the version of the compiler, the way how plugin onload
> entry point is casted may give a compilation error: "ISO C++ forbids
> casting between pointer-to-function and pointer-to-object".
>
> The attached patch fixes this issue by using the workaround introduced by the POSIX.1-2003.
> *(void **)(&onload) = dlsym(this->handle_, "onload");
Thanks for pointing that out. I hope that POSIX doesn't really
recommend your approach, though, as it is an aliasing violation. I
committed this patch to fix the problem in a way that should be
standard compliant.
Ian
2009-12-09 Ian Lance Taylor <iant@google.com>
* plugin.cc (Plugin::load): Don't cast from void* to a function
pointer.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: foo.patch
Type: text/x-diff
Size: 881 bytes
Desc: cast
URL: <https://sourceware.org/pipermail/binutils/attachments/20091210/3bddf652/attachment.bin>
More information about the Binutils
mailing list