From 02be46d639e716adcf7a01bd78a0d32bfb320ab7 Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Sun, 6 Oct 2019 23:36:25 -0400 Subject: [PATCH] add patches fixing ld bug linking arm tlsdesc relocs on 64-bit host this is binutils issue #25062. without it, cross-ld crashes linking arm programs using tlsdesc if the host is 64-bit. --- .../0010-arm-tlsdesc-64bithost.diff | 16 ++++++++++++++++ .../0007-arm-tlsdesc-64bithost.diff | 16 ++++++++++++++++ .../0003-arm-tlsdesc-64bithost.diff | 16 ++++++++++++++++ 3 files changed, 48 insertions(+) create mode 100644 patches/binutils-2.25.1/0010-arm-tlsdesc-64bithost.diff create mode 100644 patches/binutils-2.27/0007-arm-tlsdesc-64bithost.diff create mode 100644 patches/binutils-2.32/0003-arm-tlsdesc-64bithost.diff diff --git a/patches/binutils-2.25.1/0010-arm-tlsdesc-64bithost.diff b/patches/binutils-2.25.1/0010-arm-tlsdesc-64bithost.diff new file mode 100644 index 0000000..a95cbc0 --- /dev/null +++ b/patches/binutils-2.25.1/0010-arm-tlsdesc-64bithost.diff @@ -0,0 +1,16 @@ +diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c +index bb53e039e3..d52c046979 100644 +--- a/bfd/elf32-arm.c ++++ b/bfd/elf32-arm.c +@@ -12027,9 +12027,9 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto, + unsigned long data, insn; + unsigned thumb; + +- data = bfd_get_32 (input_bfd, hit_data); ++ data = bfd_get_signed_32 (input_bfd, hit_data); + thumb = data & 1; +- data &= ~1u; ++ data &= ~1ul; + + if (thumb) + { diff --git a/patches/binutils-2.27/0007-arm-tlsdesc-64bithost.diff b/patches/binutils-2.27/0007-arm-tlsdesc-64bithost.diff new file mode 100644 index 0000000..a95cbc0 --- /dev/null +++ b/patches/binutils-2.27/0007-arm-tlsdesc-64bithost.diff @@ -0,0 +1,16 @@ +diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c +index bb53e039e3..d52c046979 100644 +--- a/bfd/elf32-arm.c ++++ b/bfd/elf32-arm.c +@@ -12027,9 +12027,9 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto, + unsigned long data, insn; + unsigned thumb; + +- data = bfd_get_32 (input_bfd, hit_data); ++ data = bfd_get_signed_32 (input_bfd, hit_data); + thumb = data & 1; +- data &= ~1u; ++ data &= ~1ul; + + if (thumb) + { diff --git a/patches/binutils-2.32/0003-arm-tlsdesc-64bithost.diff b/patches/binutils-2.32/0003-arm-tlsdesc-64bithost.diff new file mode 100644 index 0000000..a95cbc0 --- /dev/null +++ b/patches/binutils-2.32/0003-arm-tlsdesc-64bithost.diff @@ -0,0 +1,16 @@ +diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c +index bb53e039e3..d52c046979 100644 +--- a/bfd/elf32-arm.c ++++ b/bfd/elf32-arm.c +@@ -12027,9 +12027,9 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto, + unsigned long data, insn; + unsigned thumb; + +- data = bfd_get_32 (input_bfd, hit_data); ++ data = bfd_get_signed_32 (input_bfd, hit_data); + thumb = data & 1; +- data &= ~1u; ++ data &= ~1ul; + + if (thumb) + {