From 68fcca92b735bb46e38331485ac2e933e5876b83 Mon Sep 17 00:00:00 2001 From: Jiong Wang Date: Fri, 24 Oct 2014 11:39:35 +0100 Subject: [PATCH] [AArch64] Cortex-A53 erratum 835769 linker workaround 2014-10-22 Tejas Belagod bfd/ * bfd-in.h (bfd_elf64_aarch64_set_options): Add a parameter. * bfd-in2.h (bfd_elf64_aarch64_set_options): Likewise. * elfnn-aarch64.c (aarch64_erratum_835769_stub): New. (elf_aarch64_stub_type): Add new type aarch64_stub_erratum_835769_veneer. (elf_aarch64_stub_hash_entry): New fields for erratum 835769. (aarch64_erratum_835769_fix): New data struct to record erratum 835769. (elf_aarch64_link_hash_table: Global flags for 835769. (aarch64_build_one_stub): Add case for 835769. (aarch64_size_one_stub): Likewise. (aarch64_mem_op_p, aarch64_mlxl_p, aarch64_erratum_sequence,erratum_835769_scan): New. Decode and scan functions for erratum 835769. (elf_aarch64_create_or_find_stub_sec): New. (elfNN_aarch64_size_stubs): Look for erratum 835769 and record them. (bfd_elfNN_aarch64_set_options: Set global flag for 835769. (erratum_835769_branch_to_stub_data, make_branch_to_erratum_835769_stub):New. Connect up all the erratum stubs to occurances by branches. (elfNN_aarch64_write_section): New hook. (aarch64_map_one_stub): Output erratum stub symbol. (elfNN_aarch64_size_dynamic_sections): Init mapping symbol information for erratum 835769. (elf_backend_write_section): Define. ld/ * emultempl/aarch64elf.em: Add command-line option for erratum 835769. ld/testsuite/ * ld-aarch64/aarch64-elf.exp (aarch64elftests): Drive erratum 835769 tests. * ld-aarch64/erratum835769.d: New. * ld-aarch64/erratum835769.s: New. --- bfd/ChangeLog | 29 ++ bfd/bfd-in.h | 4 +- bfd/bfd-in2.h | 4 +- bfd/elfnn-aarch64.c | 641 +++++++++++++++++++++++- ld/ChangeLog | 4 + ld/emultempl/aarch64elf.em | 10 +- ld/ld.texinfo | 7 + ld/testsuite/ChangeLog | 7 + ld/testsuite/ld-aarch64/aarch64-elf.exp | 8 + ld/testsuite/ld-aarch64/erratum835769.d | 48 ++ ld/testsuite/ld-aarch64/erratum835769.s | 75 +++ 11 files changed, 829 insertions(+), 8 deletions(-) create mode 100644 ld/testsuite/ld-aarch64/erratum835769.d create mode 100644 ld/testsuite/ld-aarch64/erratum835769.s diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 79bc7841920..04b6d86f9b7 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,32 @@ +2014-10-24 Tejas Belagod + + * bfd-in.h (bfd_elf64_aarch64_set_options): Add a parameter. + * bfd-in2.h (bfd_elf64_aarch64_set_options): Likewise. + * elfnn-aarch64.c (aarch64_erratum_835769_stub): New. + (elf_aarch64_stub_type): Add new type + aarch64_stub_erratum_835769_veneer. + (elf_aarch64_stub_hash_entry): New fields for erratum 835769. + (aarch64_erratum_835769_fix): New data struct to record erratum + 835769. + (elf_aarch64_link_hash_table: Global flags for 835769. + (aarch64_build_one_stub): Add case for 835769. + (aarch64_size_one_stub): Likewise. + (aarch64_mem_op_p, aarch64_mlxl_p, + aarch64_erratum_sequence,erratum_835769_scan): + New. Decode and scan functions for erratum 835769. + (elf_aarch64_create_or_find_stub_sec): New. + (elfNN_aarch64_size_stubs): Look for erratum 835769 and record + them. + (bfd_elfNN_aarch64_set_options: Set global flag for 835769. + (erratum_835769_branch_to_stub_data, + make_branch_to_erratum_835769_stub):New. Connect up all the + erratum stubs to occurances by branches. + (elfNN_aarch64_write_section): New hook. + (aarch64_map_one_stub): Output erratum stub symbol. + (elfNN_aarch64_size_dynamic_sections): Init mapping symbol + information for erratum 835769. + (elf_backend_write_section): Define. + 2014-10-23 Victor Kamensky * elf32-arm.c (read_code32): New function to read 32 bit diff --git a/bfd/bfd-in.h b/bfd/bfd-in.h index bcb9fdc5f93..1f80a76ba05 100644 --- a/bfd/bfd-in.h +++ b/bfd/bfd-in.h @@ -937,10 +937,10 @@ extern void bfd_elf32_aarch64_init_maps (bfd *); extern void bfd_elf64_aarch64_set_options - (bfd *, struct bfd_link_info *, int, int, int); + (bfd *, struct bfd_link_info *, int, int, int, int); extern void bfd_elf32_aarch64_set_options - (bfd *, struct bfd_link_info *, int, int, int); + (bfd *, struct bfd_link_info *, int, int, int, int); /* ELF AArch64 mapping symbol support. */ #define BFD_AARCH64_SPECIAL_SYM_TYPE_MAP (1 << 0) diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h index 928aa3598df..c7a2bb52738 100644 --- a/bfd/bfd-in2.h +++ b/bfd/bfd-in2.h @@ -944,10 +944,10 @@ extern void bfd_elf32_aarch64_init_maps (bfd *); extern void bfd_elf64_aarch64_set_options - (bfd *, struct bfd_link_info *, int, int, int); + (bfd *, struct bfd_link_info *, int, int, int, int); extern void bfd_elf32_aarch64_set_options - (bfd *, struct bfd_link_info *, int, int, int); + (bfd *, struct bfd_link_info *, int, int, int, int); /* ELF AArch64 mapping symbol support. */ #define BFD_AARCH64_SPECIAL_SYM_TYPE_MAP (1 << 0) diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c index 9e000690dde..19ad4d29b57 100644 --- a/bfd/elfnn-aarch64.c +++ b/bfd/elfnn-aarch64.c @@ -1611,6 +1611,12 @@ static const uint32_t aarch64_long_branch_stub[] = 0x00000000, }; +static const uint32_t aarch64_erratum_835769_stub[] = +{ + 0x00000000, /* Placeholder for multiply accumulate. */ + 0x14000000, /* b