diff options
author | Marcus Shawcroft <marcus.shawcroft@arm.com> | 2015-03-30 18:06:22 -0700 |
---|---|---|
committer | Andrew Hsieh <andrewhsieh@google.com> | 2015-03-30 21:39:14 -0700 |
commit | a9dedea652b5198bebf99d646ffa6b698f1980e5 (patch) | |
tree | b4fdc548b28f096c8882644d16f244c4cfb04101 /binutils-2.25/ld/emultempl | |
parent | 15c4812b1a1343236166916189c7159be84a5327 (diff) | |
download | toolchain_binutils-a9dedea652b5198bebf99d646ffa6b698f1980e5.zip toolchain_binutils-a9dedea652b5198bebf99d646ffa6b698f1980e5.tar.gz toolchain_binutils-a9dedea652b5198bebf99d646ffa6b698f1980e5.tar.bz2 |
[AArch64] Workaround for cortex-a53 erratum 843419
Some early revisions of the Cortex-A53 have an erratum (843419).
The details of the erratum are quite complex and involve dynamic
conditions. For the purposes of the workaround we have simplified
the static conditions to an ADRP in the last two instructions of a
4KByte page, followed within four instructions by a load/store dependent
on the ADRP.
This patch adds support to conservatively scan for and workaround the erratum.
There are two different workaround strategies used. The first is to rewrite
ADRP instructions which form part of an erratum sequence with an ADR instruction.
In situations where the ADR provides insufficient offset the dependent
load or store instruction from the sequence is moved to a stub section
and branches are inserted from the original sequence to the relocated
instruction and back again.
Stub section sizes are rounded up to a multiple of 4096 in order to ensure
that the act of inserting work around stubs does not create more errata sequences.
Workaround stubs are always inserted into the stub section associated
with the input section containing the erratum sequence. This ensures that the
fully relocated form of the veneered load store instruction is available at the
point in time when the stub section is written.
2015-03-30 Tejas Belagod <tejas.belagod@arm.com>
Marcus Shawcroft <marcus.shawcroft@arm.com>
Jiong Wang <jiong.wang@arm.com>
* bfd-in.h (bfd_elf64_aarch64_set_options)
(bfd_elf32_aarch64_set_options): Add parameter.
* bfd-in2.h: Regenerated.
* elfnn-aarch64.c (aarch64_erratum_843419_stub)
(_bfd_aarch64_adrp_p, _bfd_aarch64_erratum_843419_sequence_p)
(_bfd_aarch64_erratum_843419_stub_name)
(_bfd_aarch64_erratum_843419_fixup)
(_bfd_aarch64_erratum_843419_scan)
(_bfd_aarch64_erratum_843419_branch_to_stub)
(_bfd_aarch64_erratum_843419_p): Define.
(enum elf_aarch64_stub_type): Define
aarch64_stub_erratum_843419_veneer.
(struct elf_aarch64_stub_hash_entry): Define adrp_offset.
(struct elf_aarch64_link_hash_table): Define fix_erratum_843419
and fix_erratum_843419_adr.
(stub_hash_newfunc): Initialize adrp_offset;
(_bfd_aarch64_add_stub_entry_after): Define.
(aarch64_map_one_stub, aarch64_build_one_stub)
(aarch64_size_one_stub): Handle
aarch64_stub_erratum_843419_veneer.
(_bfd_aarch64_resize_stubs): Round stub section size.
(elfNN_aarch64_size_stubs): Add scan for 843419.
(bfd_elfNN_aarch64_set_options): Add parameter. Initialize
fix_erratum_843419 and fix_erratum_843419_adr.
(struct erratum_835769_branch_to_stub_data): Add info.
(elfNN_aarch64_write_section): Initialise info. Handle 843419.
(elfNN_aarch64_size_dynamic_sections): Handle 843419.
* elfxx-aarch64.c (_bfd_aarch64_decode_adrp_imm)
(_bfd_aarch64_sign_extend): Define.
(reencode_adr_imm): Remove static. Rename to:
(_bfd_aarch64_reencode_adr_imm): Define.
(_bfd_aarch64_elf_put_addend): Call _bfd_aarch64_reencode_adr_imm.
* elfxx-aarch64.h (AARCH64_ADR_OP, AARCH64_ADRP_OP)
(AARCH64_ADRP_OP_MASK, _bfd_aarch64_sign_extend)
(_bfd_aarch64_decode_adrp_imm, _bfd_aarch64_reencode_adr_imm):
Define.
ld/testsuite:
2015-03-24 Tejas Belagod <tejas.belagod@arm.com>
* emultempl/aarch64elf.em
(aarch64_elf_create_output_section_statements): Add parameter in
bfd_elf${ELFSIZE}_aarch64_set_options call.
(OPTION_FIX_ERRATUM_843419): Define.
(PARSE_AND_LIST_LONGOPTS): Add fix-cortex-a53-843419.
(PARSE_AND_LIST_ARGS_CASES): Add OPTION_FIX_ERRATUM_843419.
Change-Id: I758b04c90d431f4e72a978871d5a66676c413d92
Diffstat (limited to 'binutils-2.25/ld/emultempl')
-rw-r--r-- | binutils-2.25/ld/emultempl/aarch64elf.em | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/binutils-2.25/ld/emultempl/aarch64elf.em b/binutils-2.25/ld/emultempl/aarch64elf.em index 8572e5e..a573a8d 100644 --- a/binutils-2.25/ld/emultempl/aarch64elf.em +++ b/binutils-2.25/ld/emultempl/aarch64elf.em @@ -31,6 +31,7 @@ static int no_enum_size_warning = 0; static int no_wchar_size_warning = 0; static int pic_veneer = 0; static int fix_erratum_835769 = 0; +static int fix_erratum_843419 = 0; static void gld${EMULATION_NAME}_before_parse (void) @@ -303,7 +304,8 @@ aarch64_elf_create_output_section_statements (void) bfd_elf${ELFSIZE}_aarch64_set_options (link_info.output_bfd, &link_info, no_enum_size_warning, no_wchar_size_warning, - pic_veneer, fix_erratum_835769); + pic_veneer, + fix_erratum_835769, fix_erratum_843419); stub_file = lang_add_input_file ("linker stubs", lang_input_file_is_fake_enum, @@ -353,6 +355,7 @@ PARSE_AND_LIST_PROLOGUE=' #define OPTION_STUBGROUP_SIZE 311 #define OPTION_NO_WCHAR_SIZE_WARNING 312 #define OPTION_FIX_ERRATUM_835769 313 +#define OPTION_FIX_ERRATUM_843419 314 ' PARSE_AND_LIST_SHORTOPTS=p @@ -364,6 +367,7 @@ PARSE_AND_LIST_LONGOPTS=' { "stub-group-size", required_argument, NULL, OPTION_STUBGROUP_SIZE }, { "no-wchar-size-warning", no_argument, NULL, OPTION_NO_WCHAR_SIZE_WARNING}, { "fix-cortex-a53-835769", no_argument, NULL, OPTION_FIX_ERRATUM_835769}, + { "fix-cortex-a53-843419", no_argument, NULL, OPTION_FIX_ERRATUM_843419}, ' PARSE_AND_LIST_OPTIONS=' @@ -382,6 +386,7 @@ PARSE_AND_LIST_OPTIONS=' the linker should choose suitable defaults.\n" )); fprintf (file, _(" --fix-cortex-a53-835769 Fix erratum 835769\n")); + fprintf (file, _(" --fix-cortex-a53-843419 Fix erratum 843419\n")); ' PARSE_AND_LIST_ARGS_CASES=' @@ -405,6 +410,10 @@ PARSE_AND_LIST_ARGS_CASES=' fix_erratum_835769 = 1; break; + case OPTION_FIX_ERRATUM_843419: + fix_erratum_843419 = 1; + break; + case OPTION_STUBGROUP_SIZE: { const char *end; |