diff options
author | rnhmjoj <rnhmjoj@inventati.org> | 2017-07-06 04:06:10 +0200 |
---|---|---|
committer | rnhmjoj <rnhmjoj@inventati.org> | 2017-07-06 13:51:50 +0200 |
commit | 8fcc92fc692b4ec7511530068cf0ab1e5d757082 (patch) | |
tree | 9153462611a8ee852b0fa9d4f4d0530f61dceecc /pkgs/development/libraries/glibc | |
parent | 74f55017d26bb0931184bbcb54630000ce5ee107 (diff) | |
download | nixlib-8fcc92fc692b4ec7511530068cf0ab1e5d757082.tar nixlib-8fcc92fc692b4ec7511530068cf0ab1e5d757082.tar.gz nixlib-8fcc92fc692b4ec7511530068cf0ab1e5d757082.tar.bz2 nixlib-8fcc92fc692b4ec7511530068cf0ab1e5d757082.tar.lz nixlib-8fcc92fc692b4ec7511530068cf0ab1e5d757082.tar.xz nixlib-8fcc92fc692b4ec7511530068cf0ab1e5d757082.tar.zst nixlib-8fcc92fc692b4ec7511530068cf0ab1e5d757082.zip |
glibc: fix unaligned __tls_get_addr issue
Diffstat (limited to 'pkgs/development/libraries/glibc')
-rw-r--r-- | pkgs/development/libraries/glibc/common.nix | 3 | ||||
-rw-r--r-- | pkgs/development/libraries/glibc/fix-x64-abi.patch | 35 |
2 files changed, 37 insertions, 1 deletions
diff --git a/pkgs/development/libraries/glibc/common.nix b/pkgs/development/libraries/glibc/common.nix index 647a34e95dba..1b53acf12b17 100644 --- a/pkgs/development/libraries/glibc/common.nix +++ b/pkgs/development/libraries/glibc/common.nix @@ -68,7 +68,8 @@ stdenv.mkDerivation ({ ++ lib.optionals stdenv.isi686 [ ./fix-i686-memchr.patch ./i686-fix-vectorized-strcspn.patch - ]; + ] + ++ lib.optional stdenv.isx86_64 ./fix-x64-abi.patch; postPatch = # Needed for glibc to build with the gnumake 3.82 diff --git a/pkgs/development/libraries/glibc/fix-x64-abi.patch b/pkgs/development/libraries/glibc/fix-x64-abi.patch new file mode 100644 index 000000000000..1d60dcd7988b --- /dev/null +++ b/pkgs/development/libraries/glibc/fix-x64-abi.patch @@ -0,0 +1,35 @@ +From 3288c6da64add3b4561b8c10fff522027caea01c Mon Sep 17 00:00:00 2001 +From: Nicholas Miell <nmiell@gmail.com> +Date: Sat, 17 Jun 2017 18:21:07 -0700 +Subject: [PATCH] Align the stack on entry to __tls_get_addr() + +Old versions of gcc (4 & 5) didn't align the stack according to the +AMD64 psABI when calling __tls_get_addr(). Apparently new versions of +gcc (7) got much more aggressive about vectorizing and generating MOVAPS +instructions, which means old binaries built with the buggy versions of +gcc are much more likely to crash when using versions of glibc built +using gcc 7. + +For example, a large number of Linux games built using the Unity game +engine and available for purchase on Steam. +--- + elf/dl-tls.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/elf/dl-tls.c b/elf/dl-tls.c +index 5aba33b3fa..3f3cb917de 100644 +--- a/elf/dl-tls.c ++++ b/elf/dl-tls.c +@@ -827,6 +827,10 @@ rtld_hidden_proto (__tls_get_addr) + rtld_hidden_def (__tls_get_addr) + #endif + ++#ifdef __x86_64__ ++/* Old versions of gcc didn't align the stack. */ ++__attribute__((force_align_arg_pointer)) ++#endif + /* The generic dynamic and local dynamic model cannot be used in + statically linked applications. */ + void * +-- +2.13.0 |