This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Patch RFA libitm] config-based assessment of weakref capability
- From: Rainer Orth <ro at CeBiTec dot Uni-Bielefeld dot DE>
- To: Iain Sandoe <developer at sandoe-acoustics dot co dot uk>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, Richard Henderson <rth at redhat dot com>, Mike Stump <mrs at gcc dot gnu dot org>
- Date: Fri, 18 Nov 2011 15:49:58 +0100
- Subject: Re: [Patch RFA libitm] config-based assessment of weakref capability
- References: <E35ACA84-04A2-47CC-9D27-73D2131A7B8D@sandoe-acoustics.co.uk>
Hi Iain,
> one of the three remaining libitm issues for Darwin is to supply the dummy
> funcs fro the weakrefs (as Rainer has done for Tru64) for the versions of
> Darwin that need them.
>
> Since we now have the situation where there are several targets which might
> need dummy functions for the weak declarations, it seemed worth trying to
> auto-foo this.
>
> .. the attached works for me on Darwin9 (weakref doesn't work like elf***)
> and Darwin10+XCode3.2.5 (weakref works like elf)
>
> I hope it also works for Rainer .... and that I've got the right designator
> for the Tru64 cross-case.
I guess it does, given that the testcase is based on my own one :-)
A few comments:
* Move the macro definition to toplevel config/weakref.m4 (or
weakdef.m4, I'm not sure about the terminology), omitting the libitm
reference. libgfortran already uses something similar (although
partially hardcoded), we should share the code (not now, but in the
future).
* Omit the _working_ everywhere, we don't care for non-working
variants.
> Index: libitm/acinclude.m4
> ===================================================================
> --- libitm/acinclude.m4 (revision 181470)
> +++ libitm/acinclude.m4 (working copy)
> @@ -109,6 +109,29 @@ i[[34567]]86 | x86_64)
> ;;
> esac])
>
> +dnl Check whether weak refs actually work.
> +AC_DEFUN([LIBITM_CHECK_WORKING_WEAKREF], [
> + AC_CACHE_CHECK([whether weak refs actually work],
> + libitm_cv_have_working_weakref, [
> + AC_RUN_IFELSE([AC_LANG_SOURCE([[
> +extern void fNotToBeFoundInAnyStandardLib(void) __attribute__((weak));
> +int main ()
> +{
> + if (fNotToBeFoundInAnyStandardLib)
> + return 0;
> + else
> + return 1;
> +}
Just a nit: shorten function name to keep it readable.
Rainer
--
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University