[PATCH] eliminate UNRESOLVED errors on attr-ifunc-1.[c,C]

Jack Howarth howarth@bromo.med.uc.edu
Fri Sep 24 13:25:00 GMT 2010


On Thu, Sep 16, 2010 at 10:31:52AM +0200, Jakub Jelinek wrote:
> On Thu, Sep 16, 2010 at 10:16:21AM +0200, Rainer Orth wrote:
> > Ok, so check for the GNU ld (and eventually gold) version that supports
> > this in gcc/configure.ac, and assume that other linkers don't have that
> > support.  If that assumption proves incorrect later, this can be handled
> > on a case-by-case basis.
> > 
> > >> * Runtime linker support?  Is this the purpose of your glibc 2.11 check:
> > >>    to test for ld.so.1 support?
> > >
> > > handling for the ifunc dynamic relocations.
> > 
> > No idea what's the best way to check this.
> 
> Especially for cross compiling it can't be a runtime test, so the best
> is to check __GLIBC__ and __GLIBC_MINOR__ IMHO (for the targets that
> actually support it).
> 
> 	Jakub

Jakub,
   The problem on darwin seems to be that, although auto-host.h ends up
with...

/* Define if your assembler supports indirect function type. */
/* #undef HAVE_GAS_INDIRECT_FUNCTION */

the call to assemble_alias() seems to occur before the code in
do_assemble_alias...

#if defined (ASM_OUTPUT_TYPE_DIRECTIVE) && HAVE_GAS_INDIRECT_FUNCTION
      ASM_OUTPUT_TYPE_DIRECTIVE
        (asm_out_file, IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)),
         IFUNC_ASM_TYPE);
#else
      error_at (DECL_SOURCE_LOCATION (decl),
                "ifunc is not supported in this configuration");
#endif

I have found on x86_64-apple-darwin10 that the following change...

Index: gcc/varasm.c
===================================================================
--- gcc/varasm.c	(revision 164570)
+++ gcc/varasm.c	(working copy)
@@ -5535,7 +5535,11 @@
 # else
       if (!DECL_WEAK (decl))
 	{
-	  error_at (DECL_SOURCE_LOCATION (decl),
+           if (lookup_attribute ("ifunc", DECL_ATTRIBUTES (decl)))
+              error_at (DECL_SOURCE_LOCATION (decl),
+                "ifunc is not supported in this configuration");
+	   else	
+	        error_at (DECL_SOURCE_LOCATION (decl),
 		    "only weak aliases are supported in this configuration");
 	  return;
 	}

...eliminates the UNRESOLVED testsuite errors for g++.dg/ext/attr-ifunc-1.C and
converts them properly to UNSUPPORTED.
             Jack



More information about the Gcc-patches mailing list