This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PATCH: PR libc/10087: STT_GNU_IFUNC handling doesn't work withfunction descriptor


dl-runtime.c has

  if (__builtin_expect (ELFW(ST_TYPE) (sym->st_info) == STT_GNU_IFUNC,
0)) 
    value = ((DL_FIXUP_VALUE_TYPE (*) (void)) value) (); 

The type of value is DL_FIXUP_VALUE_TYPE, which may be struct fdesc.
We need to use DL_FIXUP_VALUE_ADDR to get the address of value.


H.J.
----
2009-04-24  H.J. Lu  <hongjiu.lu@intel.com>

	PR libc/10087
	* elf/dl-runtime.c (_dl_fixup): Use DL_FIXUP_VALUE_ADDR when
	calling value.
	(_dl_profile_fixup): Likewise.

Index: elf/dl-runtime.c
===================================================================
--- elf/dl-runtime.c	(revision 5746)
+++ elf/dl-runtime.c	(working copy)
@@ -137,7 +137,8 @@ _dl_fixup (
   value = elf_machine_plt_value (l, reloc, value);
 
   if (__builtin_expect (ELFW(ST_TYPE) (sym->st_info) == STT_GNU_IFUNC, 0))
-    value = ((DL_FIXUP_VALUE_TYPE (*) (void)) value) ();
+    value = ((DL_FIXUP_VALUE_TYPE (*) (void))
+	     DL_FIXUP_VALUE_ADDR (value)) ();
 
   /* Finally, fix up the plt itself.  */
   if (__builtin_expect (GLRO(dl_bind_not), 0))
@@ -225,7 +226,8 @@ _dl_profile_fixup (
 
 	  if (__builtin_expect (ELFW(ST_TYPE) (defsym->st_info)
 				== STT_GNU_IFUNC, 0))
-	    value = ((DL_FIXUP_VALUE_TYPE (*) (void)) value) ();
+	    value = ((DL_FIXUP_VALUE_TYPE (*) (void))
+		     DL_FIXUP_VALUE_ADDR (value)) ();
 	}
       else
 	{
@@ -235,7 +237,8 @@ _dl_profile_fixup (
 
 	  if (__builtin_expect (ELFW(ST_TYPE) (refsym->st_info)
 				== STT_GNU_IFUNC, 0))
-	    value = ((DL_FIXUP_VALUE_TYPE (*) (void)) value) ();
+	    value = ((DL_FIXUP_VALUE_TYPE (*) (void))
+		     DL_FIXUP_VALUE_ADDR (value)) ();
 
 	  result = l;
 	}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]