From b66a1357266a43174bd1ed42a902875f86cebb49 Mon Sep 17 00:00:00 2001 From: Kyle McMartin Date: Fri, 20 Jun 2014 11:49:56 -0400 Subject: [PATCH] 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. --- ...4-workaround-nzcv-clobber-in-tlsdesc.patch | 33 +++++++++++++++++++ glibc.spec | 12 +++++-- 2 files changed, 43 insertions(+), 2 deletions(-) create mode 100644 glibc-aarch64-workaround-nzcv-clobber-in-tlsdesc.patch diff --git a/glibc-aarch64-workaround-nzcv-clobber-in-tlsdesc.patch b/glibc-aarch64-workaround-nzcv-clobber-in-tlsdesc.patch new file mode 100644 index 0000000..ed628ac --- /dev/null +++ b/glibc-aarch64-workaround-nzcv-clobber-in-tlsdesc.patch @@ -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) diff --git a/glibc.spec b/glibc.spec index 0d89c72..b4d39eb 100644 --- a/glibc.spec +++ b/glibc.spec @@ -1,6 +1,6 @@ %define glibcsrcdir glibc-2.19-591-ga729111 %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 # effectively: # @@ -219,7 +219,8 @@ Patch2027: %{name}-rh819430.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. @@ -550,6 +551,7 @@ package or when debugging this package. %patch2031 -p1 %patch0047 -p1 %patch2033 -p1 +%patch2034 -p1 ############################################################################## # %%prep - Additional prep required... @@ -1639,6 +1641,12 @@ rm -f *.filelist* %endif %changelog +* Fri Jun 20 2014 Kyle McMartin - 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 - 2.19.90-21 - Auto-sync with upstream master.