This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: ELF interposition and One Definition Rule
- From: Richard Biener <richard dot guenther at gmail dot com>
- To: Nathan Sidwell <nathan_sidwell at mentor dot com>
- Cc: Jason Merrill <jason at redhat dot com>, Jan Hubicka <hubicka at ucw dot cz>, GCC Patches <gcc-patches at gcc dot gnu dot org>, Nathan Sidwell <nathan at codesourcery dot com>, Gabriel Dos Reis <gdr at integrable-solutions dot net>
- Date: Wed, 28 Aug 2013 12:47:20 +0200
- Subject: Re: ELF interposition and One Definition Rule
- Authentication-results: sourceware.org; auth=none
- References: <20130826152141 dot GA19918 at kam dot mff dot cuni dot cz> <521BF9C1 dot 8080806 at redhat dot com> <521CA12C dot 9090604 at mentor dot com>
On Tue, Aug 27, 2013 at 2:53 PM, Nathan Sidwell
<nathan_sidwell@mentor.com> wrote:
> On 08/26/13 20:58, Jason Merrill wrote:
>
>> I would be happy with an even stronger default that optimizes on the
>> assumption
>> that no interposition occurs; typically interposition is overriding a
>> symbol
>> found in a dynamic library (i.e. malloc) rather than a symbol defined in
>> the
>> same translation unit as the use.
>
>
> I had thought that that case (overriding malloc etc) was what this patch was
> dealing with. Perhaps I was confused.
>
> There's nothing particularly special about ctors, dtors and virtual function
> implementations. Their common feature, as Jan described, is that it's hard
> to take their address:
> * ctors don't have names.
> * dtors do have names, but you can't take their address.
> * virtual function implementations can't have their instance address taken
> -- you get the ptr-to-memfn object describing the vtable slot etc. There is
> (was?) a GNU extension to work around that, IIRC.
>
> So that stops a programmer calling these indirectly. However I don't really
> see the semantic difference between:
>
> fptr = &somefunc; ... fptr (...);
> and
> somefunc (...);
>
> So treating those 3 types of function specially because you can't use the
> former syntax with them seems odd.
Yeah - this is why I'm always worried about "frontend specific" optimizations
in the middle-end. If you need to rely stuff that's not visible in GIMPLE then
it smells.
Richard.
> nathan
>
> --
> Nathan Sidwell