at master 1.2 kB view raw
1From 3288c6da64add3b4561b8c10fff522027caea01c Mon Sep 17 00:00:00 2001 2From: Nicholas Miell <nmiell@gmail.com> 3Date: Sat, 17 Jun 2017 18:21:07 -0700 4Subject: [PATCH] Align the stack on entry to __tls_get_addr() 5 6Old versions of gcc (4 & 5) didn't align the stack according to the 7AMD64 psABI when calling __tls_get_addr(). Apparently new versions of 8gcc (7) got much more aggressive about vectorizing and generating MOVAPS 9instructions, which means old binaries built with the buggy versions of 10gcc are much more likely to crash when using versions of glibc built 11using gcc 7. 12 13For example, a large number of Linux games built using the Unity game 14engine and available for purchase on Steam. 15--- 16 elf/dl-tls.c | 4 ++++ 17 1 file changed, 4 insertions(+) 18 19diff --git a/elf/dl-tls.c b/elf/dl-tls.c 20index 5aba33b3fa..3f3cb917de 100644 21--- a/elf/dl-tls.c 22+++ b/elf/dl-tls.c 23@@ -827,6 +827,10 @@ rtld_hidden_proto (__tls_get_addr) 24 rtld_hidden_def (__tls_get_addr) 25 #endif 26 27+#ifdef __x86_64__ 28+/* Old versions of gcc didn't align the stack. */ 29+__attribute__((force_align_arg_pointer)) 30+#endif 31 /* The generic dynamic and local dynamic model cannot be used in 32 statically linked applications. */ 33 void * 34-- 352.13.0