From c9ac08753a53eb84c184901a083ee87b1992bd32 Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Wed, 2 Oct 2019 10:39:26 -0400 Subject: [PATCH] add binutils patch to fix broken arm LD/GD TLS relocs in static PIE this is the same issue fixed for mips in 0004-mips-pie-tls.diff for 2.27, upstream in 2.32. --- patches/binutils-2.25.1/0009-arm-pie-tls.diff | 20 +++++++++++++++++++ patches/binutils-2.27/0006-arm-pie-tls.diff | 20 +++++++++++++++++++ patches/binutils-2.32/0002-arm-pie-tls.diff | 20 +++++++++++++++++++ 3 files changed, 60 insertions(+) create mode 100644 patches/binutils-2.25.1/0009-arm-pie-tls.diff create mode 100644 patches/binutils-2.27/0006-arm-pie-tls.diff create mode 100644 patches/binutils-2.32/0002-arm-pie-tls.diff diff --git a/patches/binutils-2.25.1/0009-arm-pie-tls.diff b/patches/binutils-2.25.1/0009-arm-pie-tls.diff new file mode 100644 index 0000000..626275d --- /dev/null +++ b/patches/binutils-2.25.1/0009-arm-pie-tls.diff @@ -0,0 +1,20 @@ +--- binutils-2.25.1/bfd/elf32-arm.c.orig 2019-10-02 10:41:56.188034263 -0400 ++++ binutils-2.25.1/bfd/elf32-arm.c 2019-10-02 10:42:45.553394647 -0400 +@@ -9493,7 +9493,7 @@ + { + /* If we don't know the module number, create a relocation + for it. */ +- if (info->shared) ++ if (!info->executable) + { + Elf_Internal_Rela outrel; + +@@ -9581,7 +9581,7 @@ + now, and emit any relocations. If both an IE GOT and a + GD GOT are necessary, we emit the GD first. */ + +- if ((info->shared || indx != 0) ++ if ((!info->executable || indx != 0) + && (h == NULL + || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT + || h->root.type != bfd_link_hash_undefweak)) diff --git a/patches/binutils-2.27/0006-arm-pie-tls.diff b/patches/binutils-2.27/0006-arm-pie-tls.diff new file mode 100644 index 0000000..7b29da2 --- /dev/null +++ b/patches/binutils-2.27/0006-arm-pie-tls.diff @@ -0,0 +1,20 @@ +--- binutils-2.32/bfd/elf32-arm.c.orig 2019-10-02 07:47:36.153918869 -0400 ++++ binutils-2.32/bfd/elf32-arm.c 2019-10-02 08:37:09.108263016 -0400 +@@ -11624,7 +11624,7 @@ + { + /* If we don't know the module number, create a relocation + for it. */ +- if (bfd_link_pic (info)) ++ if (bfd_link_dll (info)) + { + Elf_Internal_Rela outrel; + +@@ -11728,7 +11728,7 @@ + now, and emit any relocations. If both an IE GOT and a + GD GOT are necessary, we emit the GD first. */ + +- if ((bfd_link_pic (info) || indx != 0) ++ if ((bfd_link_dll (info) || indx != 0) + && (h == NULL + || (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT + && !resolved_to_zero) diff --git a/patches/binutils-2.32/0002-arm-pie-tls.diff b/patches/binutils-2.32/0002-arm-pie-tls.diff new file mode 100644 index 0000000..7b29da2 --- /dev/null +++ b/patches/binutils-2.32/0002-arm-pie-tls.diff @@ -0,0 +1,20 @@ +--- binutils-2.32/bfd/elf32-arm.c.orig 2019-10-02 07:47:36.153918869 -0400 ++++ binutils-2.32/bfd/elf32-arm.c 2019-10-02 08:37:09.108263016 -0400 +@@ -11624,7 +11624,7 @@ + { + /* If we don't know the module number, create a relocation + for it. */ +- if (bfd_link_pic (info)) ++ if (bfd_link_dll (info)) + { + Elf_Internal_Rela outrel; + +@@ -11728,7 +11728,7 @@ + now, and emit any relocations. If both an IE GOT and a + GD GOT are necessary, we emit the GD first. */ + +- if ((bfd_link_pic (info) || indx != 0) ++ if ((bfd_link_dll (info) || indx != 0) + && (h == NULL + || (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT + && !resolved_to_zero)