This is the mail archive of the
mailing list for the glibc project.
Re: [PATCH] HPPA/IA64 : Don't use broken DL_AUTO_FUNCTION_ADDRESS()
- From: Guy Martin <gmsoft at tuxicoman dot be>
- To: Carlos O'Donell <carlos at redhat dot com>
- Cc: Mike Frysinger <vapier at gentoo dot org>, libc-alpha at sourceware dot org, Andreas Schwab <schwab at linux-m68k dot org>
- Date: Thu, 31 Oct 2013 13:21:08 +0100
- Subject: Re: [PATCH] HPPA/IA64 : Don't use broken DL_AUTO_FUNCTION_ADDRESS()
- Authentication-results: sourceware.org; auth=none
- References: <20131017214754 dot 00555bf3 at dellete> <871u3ina5t dot fsf at igel dot home> <b42704e5527fa00f6e69cacd0d62c19d at tuxicoman dot be> <201310190206 dot 07506 dot vapier at gentoo dot org> <52631FA0 dot 5090403 at redhat dot com>
Andreas makes a good comment that they should really be rewritten
to avoid needing to create the function pointer, instead the code
should create and call it as required (that way the created fptr
need never leave scope). However doing so might be more work than
you have time for.
I've reworked the patch to have the macro call the function directly.
This way it is reentrant.
It has been tested on hppa and amd64. I don't have access to an ia64
Please note that the use of volatile for fptr is mandatory. Without
it, gcc doesn't even bother setting it's value since it's never
accessed via fptr within the scope. Using __attribute__(may_alias)
has been suggested to me but I'm not sure it's the right approach
since it's supported only from gcc 3.4. I haven't tested that either.