diff options
author | Victor Kamensky <victor.kamensky@linaro.org> | 2013-12-13 16:34:24 -0800 |
---|---|---|
committer | Linaro Code Review <review@review.linaro.org> | 2013-12-18 18:00:44 +0000 |
commit | ea74048bd86fc8872fc7cc875b9f6ca3d34463e1 (patch) | |
tree | 6f657ed7fdb9c5a7a532c07699e217f320893c93 | |
parent | bcc7cdbcfb061cb5274704fdd96adad24ec77ce6 (diff) |
aarch64_be: tlsdesc plt code is corrupted in BE case
Fix tlsdesc plt entry creations. Since instructions are always
little endian bfd_getl32 and bfd_putl32 functions should be used
instead of bfd_get_32 and bfd_put_32 which should be used for
data.
Note this change is needed only for binutils-2.23.X. In
binutils-2.24.X and later this code was reworked and it does not
look it has this issue.
Change-Id: Id332418e76eb1868edafda878129929e02453b30
Signed-off-by: Victor Kamensky <victor.kamensky@linaro.org>
-rw-r--r-- | meta-linaro-toolchain/recipes-devtools/binutils/binutils-2.23.2.inc | 1 | ||||
-rw-r--r-- | meta-linaro-toolchain/recipes-devtools/binutils/binutils-2.23.2/tlsdesc_plt-aarch64_be.patch | 51 |
2 files changed, 52 insertions, 0 deletions
diff --git a/meta-linaro-toolchain/recipes-devtools/binutils/binutils-2.23.2.inc b/meta-linaro-toolchain/recipes-devtools/binutils/binutils-2.23.2.inc index 768801a0..d3d3ac3b 100644 --- a/meta-linaro-toolchain/recipes-devtools/binutils/binutils-2.23.2.inc +++ b/meta-linaro-toolchain/recipes-devtools/binutils/binutils-2.23.2.inc @@ -32,6 +32,7 @@ SRC_URI = "\ ${BACKPORT} \ file://binutils-fix-over-array-bounds-issue.patch \ file://binutils-xlp-support.patch \ + file://tlsdesc_plt-aarch64_be.patch \ " BACKPORT = "\ diff --git a/meta-linaro-toolchain/recipes-devtools/binutils/binutils-2.23.2/tlsdesc_plt-aarch64_be.patch b/meta-linaro-toolchain/recipes-devtools/binutils/binutils-2.23.2/tlsdesc_plt-aarch64_be.patch new file mode 100644 index 00000000..6c612b06 --- /dev/null +++ b/meta-linaro-toolchain/recipes-devtools/binutils/binutils-2.23.2/tlsdesc_plt-aarch64_be.patch @@ -0,0 +1,51 @@ +Index: binutils-linaro-2.23.2-2013.10-4/bfd/elf64-aarch64.c +=================================================================== +--- binutils-linaro-2.23.2-2013.10-4.orig/bfd/elf64-aarch64.c ++++ binutils-linaro-2.23.2-2013.10-4/bfd/elf64-aarch64.c +@@ -6968,38 +6968,34 @@ elf64_aarch64_finish_dynamic_sections (b + bfd_vma opcode; + + /* adrp x2, DT_TLSDESC_GOT */ +- opcode = bfd_get_32 (output_bfd, +- htab->root.splt->contents ++ opcode = bfd_getl32 (htab->root.splt->contents + + htab->tlsdesc_plt + 4); + opcode = reencode_adr_imm + (opcode, (PG (dt_tlsdesc_got) - PG (adrp1_addr)) >> 12); +- bfd_put_32 (output_bfd, opcode, ++ bfd_putl32 (opcode, + htab->root.splt->contents + htab->tlsdesc_plt + 4); + + /* adrp x3, 0 */ +- opcode = bfd_get_32 (output_bfd, +- htab->root.splt->contents ++ opcode = bfd_getl32 (htab->root.splt->contents + + htab->tlsdesc_plt + 8); + opcode = reencode_adr_imm + (opcode, (PG (pltgot_addr) - PG (adrp2_addr)) >> 12); +- bfd_put_32 (output_bfd, opcode, ++ bfd_putl32 (opcode, + htab->root.splt->contents + htab->tlsdesc_plt + 8); + + /* ldr x2, [x2, #0] */ +- opcode = bfd_get_32 (output_bfd, +- htab->root.splt->contents ++ opcode = bfd_getl32 (htab->root.splt->contents + + htab->tlsdesc_plt + 12); + opcode = reencode_ldst_pos_imm (opcode, + PG_OFFSET (dt_tlsdesc_got) >> 3); +- bfd_put_32 (output_bfd, opcode, ++ bfd_putl32 (opcode, + htab->root.splt->contents + htab->tlsdesc_plt + 12); + + /* add x3, x3, 0 */ +- opcode = bfd_get_32 (output_bfd, +- htab->root.splt->contents ++ opcode = bfd_getl32 (htab->root.splt->contents + + htab->tlsdesc_plt + 16); + opcode = reencode_add_imm (opcode, PG_OFFSET (pltgot_addr)); +- bfd_put_32 (output_bfd, opcode, ++ bfd_putl32 (opcode, + htab->root.splt->contents + htab->tlsdesc_plt + 16); + } + } |