AArch64: Save & restore NZCV (flags) upon entry to _dl_tlsdesc_dynamic

in order to work around GCC reordering compares across the TLS
  descriptor sequence (GCC PR61545.) Committing a (temporary) fix here
  allows us to avoid rebuilding the world with gcc 4.9.0-11.fc21.
This commit is contained in:
Kyle McMartin 2014-06-20 11:49:56 -04:00
parent 0c40cdae52
commit b66a135726
2 changed files with 43 additions and 2 deletions

View File

@ -0,0 +1,33 @@
diff --git a/sysdeps/aarch64/dl-tlsdesc.S b/sysdeps/aarch64/dl-tlsdesc.S
index ded5471..7d28496 100644
--- a/sysdeps/aarch64/dl-tlsdesc.S
+++ b/sysdeps/aarch64/dl-tlsdesc.S
@@ -140,7 +140,7 @@ _dl_tlsdesc_undefweak:
cfi_startproc
.align 2
_dl_tlsdesc_dynamic:
-# define NSAVEXREGPAIRS 2
+# define NSAVEXREGPAIRS 3
stp x29, x30, [sp,#-(32+16*NSAVEXREGPAIRS)]!
cfi_adjust_cfa_offset (32+16*NSAVEXREGPAIRS)
mov x29, sp
@@ -151,6 +151,10 @@ _dl_tlsdesc_dynamic:
stp x1, x2, [sp, #32+16*0]
stp x3, x4, [sp, #32+16*1]
+ /* Work around GCC rescheduling compares across tlsdesc calls. */
+ mrs x30, nzcv
+ stp xzr, x30, [sp, #32+16*2]
+
mrs x4, tpidr_el0
ldr x1, [x0,#8]
ldr x0, [x4]
@@ -169,6 +173,8 @@ _dl_tlsdesc_dynamic:
1:
ldp x1, x2, [sp, #32+16*0]
ldp x3, x4, [sp, #32+16*1]
+ ldp xzr, x30, [sp, #32+16*2]
+ msr nzcv, x30
ldp x29, x30, [sp], #(32+16*NSAVEXREGPAIRS)
cfi_adjust_cfa_offset (32+16*NSAVEXREGPAIRS)

View File

@ -1,6 +1,6 @@
%define glibcsrcdir glibc-2.19-591-ga729111 %define glibcsrcdir glibc-2.19-591-ga729111
%define glibcversion 2.19.90 %define glibcversion 2.19.90
%define glibcrelease 21%{?dist} %define glibcrelease 22%{?dist}
# Pre-release tarballs are pulled in from git using a command that is # Pre-release tarballs are pulled in from git using a command that is
# effectively: # effectively:
# #
@ -219,7 +219,8 @@ Patch2027: %{name}-rh819430.patch
Patch2031: %{name}-rh1070416.patch Patch2031: %{name}-rh1070416.patch
Patch2033: glibc-aarch64-tls-fixes.patch Patch2033: %{name}-aarch64-tls-fixes.patch
Patch2034: %{name}-aarch64-workaround-nzcv-clobber-in-tlsdesc.patch
############################################################################## ##############################################################################
# End of glibc patches. # End of glibc patches.
@ -550,6 +551,7 @@ package or when debugging this package.
%patch2031 -p1 %patch2031 -p1
%patch0047 -p1 %patch0047 -p1
%patch2033 -p1 %patch2033 -p1
%patch2034 -p1
############################################################################## ##############################################################################
# %%prep - Additional prep required... # %%prep - Additional prep required...
@ -1639,6 +1641,12 @@ rm -f *.filelist*
%endif %endif
%changelog %changelog
* Fri Jun 20 2014 Kyle McMartin <kmcmarti@redhat.com> - 2.19.90-22
- AArch64: Save & restore NZCV (flags) upon entry to _dl_tlsdesc_dynamic
in order to work around GCC reordering compares across the TLS
descriptor sequence (GCC PR61545.) Committing a (temporary) fix here
allows us to avoid rebuilding the world with gcc 4.9.0-11.fc21.
* Mon Jun 16 2014 Kyle McMartin <kmcmarti@redhat.com> - 2.19.90-21 * Mon Jun 16 2014 Kyle McMartin <kmcmarti@redhat.com> - 2.19.90-21
- Auto-sync with upstream master. - Auto-sync with upstream master.