summaryrefslogtreecommitdiff
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
parent972af9e8ddd870cabf8aad39b28a6e352c9cc79c (diff)
downloadglibc-0e87343e204b44468ffad0ec5dc8c8d6068f1227.tar.gz
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.
-rw-r--r--ChangeLog6
-rw-r--r--NEWS2
-rw-r--r--sysdeps/powerpc/powerpc64/dl-machine.h4
3 files changed, 10 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index d746e18d59..cd093808ff 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2015-01-24 Adhemerval Zanellla <azanella@linux.vnet.ibm.com>
+
+ [BZ #17868]
+ * sysdeps/powerpc/powerpc64/dl-machine.h (resolve_ifunc): Force value
+ set dependency from opd value.
+
2015-01-23 H.J. Lu <hongjiu.lu@intel.com>
* sysdeps/x86_64/multiarch/init-arch.c (__init_cpu_features):
diff --git a/NEWS b/NEWS
index 0ce43521ea..f9ea7cf697 100644
--- a/NEWS
+++ b/NEWS
@@ -18,7 +18,7 @@ Version 2.21
17664, 17665, 17668, 17682, 17702, 17717, 17719, 17722, 17723, 17724,
17725, 17732, 17733, 17744, 17745, 17746, 17747, 17748, 17775, 17777,
17780, 17781, 17782, 17791, 17793, 17796, 17797, 17803, 17806, 17834,
- 17844, 17848, 17870
+ 17844, 17848, 17868, 17870
* A new semaphore algorithm has been implemented in generic C code for all
machines. Previous custom assembly implementations of semaphore were
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