about summary refs log tree commit diff
path: root/sysdeps/powerpc
diff options
context:
space:
mode:
authorAdhemerval Zanella <azanella@linux.vnet.ibm.com>2015-01-23 11:16:49 -0500
committerAdhemerval Zanella <azanella@linux.vnet.ibm.com>2015-01-24 08:38:39 -0500
commit0e87343e204b44468ffad0ec5dc8c8d6068f1227 (patch)
tree9d8fec4386efad530b94e129c8549ff4342cc959 /sysdeps/powerpc
parent972af9e8ddd870cabf8aad39b28a6e352c9cc79c (diff)
downloadglibc-0e87343e204b44468ffad0ec5dc8c8d6068f1227.tar.gz
glibc-0e87343e204b44468ffad0ec5dc8c8d6068f1227.tar.xz
glibc-0e87343e204b44468ffad0ec5dc8c8d6068f1227.zip
powerpc: Fix ifuncmain6pie failure with GCC 4.9
This patch fix the elf/ifuncmain6pie failure when building with GCC
4.9+.  For some reason, the compiler removes the branch taken code at
resolve_ifunc (sysdeps/powerpc/powerpc64/dl-machine.h) as dead-code
and thus the testcase fails because the ifunc resolves branches to an
invalid memory location.  It fixes by explicit adding a dependency of
value based on odp variable to avoid compiler optimization.

It fixes BZ#17868.
Diffstat (limited to 'sysdeps/powerpc')
-rw-r--r--sysdeps/powerpc/powerpc64/dl-machine.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/sysdeps/powerpc/powerpc64/dl-machine.h b/sysdeps/powerpc/powerpc64/dl-machine.h
index 944871223f..47bb5a7cb7 100644
--- a/sysdeps/powerpc/powerpc64/dl-machine.h
+++ b/sysdeps/powerpc/powerpc64/dl-machine.h
@@ -623,7 +623,9 @@ resolve_ifunc (Elf64_Addr value,
       opd.fd_func = func->fd_func + sym_map->l_addr;
       opd.fd_toc = func->fd_toc + sym_map->l_addr;
       opd.fd_aux = func->fd_aux;
-      value = (Elf64_Addr) &opd;
+      /* GCC 4.9+ eliminates the branch as dead code, force the odp set
+         dependency.  */
+      asm ("" : "=r" (value) : "0" (&opd), "X" (opd));
     }
 #endif
 #endif