Skip to content

Commit 4106101

Browse files
committed
[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 Cortex A53 erratum 843419. 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.
1 parent cf39cfc commit 4106101

12 files changed

+695
-14
lines changed

bfd/ChangeLog

+41
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,44 @@
1+
2015-04-01 Tejas Belagod <[email protected]>
2+
Marcus Shawcroft <[email protected]>
3+
Jiong Wang <[email protected]>
4+
5+
* bfd-in.h (bfd_elf64_aarch64_set_options)
6+
(bfd_elf32_aarch64_set_options): Add parameter.
7+
* bfd-in2.h: Regenerated.
8+
* elfnn-aarch64.c (aarch64_erratum_843419_stub)
9+
(_bfd_aarch64_adrp_p, _bfd_aarch64_erratum_843419_sequence_p)
10+
(_bfd_aarch64_erratum_843419_stub_name)
11+
(_bfd_aarch64_erratum_843419_fixup)
12+
(_bfd_aarch64_erratum_843419_scan)
13+
(_bfd_aarch64_erratum_843419_branch_to_stub)
14+
(_bfd_aarch64_erratum_843419_p): Define.
15+
(enum elf_aarch64_stub_type): Define
16+
aarch64_stub_erratum_843419_veneer.
17+
(struct elf_aarch64_stub_hash_entry): Define adrp_offset.
18+
(struct elf_aarch64_link_hash_table): Define fix_erratum_843419
19+
and fix_erratum_843419_adr.
20+
(stub_hash_newfunc): Initialize adrp_offset;
21+
(_bfd_aarch64_add_stub_entry_after): Define.
22+
(aarch64_map_one_stub, aarch64_build_one_stub)
23+
(aarch64_size_one_stub): Handle
24+
aarch64_stub_erratum_843419_veneer.
25+
(_bfd_aarch64_resize_stubs): Round stub section size.
26+
(elfNN_aarch64_size_stubs): Add scan for 843419.
27+
(bfd_elfNN_aarch64_set_options): Add parameter. Initialize
28+
fix_erratum_843419 and fix_erratum_843419_adr.
29+
(struct erratum_835769_branch_to_stub_data): Add info.
30+
(elfNN_aarch64_write_section): Initialise info. Handle 843419.
31+
(elfNN_aarch64_size_dynamic_sections): Handle 843419.
32+
* elfxx-aarch64.c (_bfd_aarch64_decode_adrp_imm)
33+
(_bfd_aarch64_sign_extend): Define.
34+
(reencode_adr_imm): Remove static. Rename to:
35+
(_bfd_aarch64_reencode_adr_imm): Define.
36+
(_bfd_aarch64_elf_put_addend): Call _bfd_aarch64_reencode_adr_imm.
37+
* elfxx-aarch64.h (AARCH64_ADR_OP, AARCH64_ADRP_OP)
38+
(AARCH64_ADRP_OP_MASK, _bfd_aarch64_sign_extend)
39+
(_bfd_aarch64_decode_adrp_imm, _bfd_aarch64_reencode_adr_imm):
40+
Define.
41+
142
2015-04-01 H.J. Lu <[email protected]>
243

344
* configure: Regenerated.

bfd/bfd-in.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -934,10 +934,10 @@ extern void bfd_elf32_aarch64_init_maps
934934
(bfd *);
935935

936936
extern void bfd_elf64_aarch64_set_options
937-
(bfd *, struct bfd_link_info *, int, int, int, int);
937+
(bfd *, struct bfd_link_info *, int, int, int, int, int);
938938

939939
extern void bfd_elf32_aarch64_set_options
940-
(bfd *, struct bfd_link_info *, int, int, int, int);
940+
(bfd *, struct bfd_link_info *, int, int, int, int, int);
941941

942942
/* ELF AArch64 mapping symbol support. */
943943
#define BFD_AARCH64_SPECIAL_SYM_TYPE_MAP (1 << 0)

bfd/bfd-in2.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -941,10 +941,10 @@ extern void bfd_elf32_aarch64_init_maps
941941
(bfd *);
942942

943943
extern void bfd_elf64_aarch64_set_options
944-
(bfd *, struct bfd_link_info *, int, int, int, int);
944+
(bfd *, struct bfd_link_info *, int, int, int, int, int);
945945

946946
extern void bfd_elf32_aarch64_set_options
947-
(bfd *, struct bfd_link_info *, int, int, int, int);
947+
(bfd *, struct bfd_link_info *, int, int, int, int, int);
948948

949949
/* ELF AArch64 mapping symbol support. */
950950
#define BFD_AARCH64_SPECIAL_SYM_TYPE_MAP (1 << 0)

0 commit comments

Comments
 (0)