[all-commits] [llvm/llvm-project] 8cf895: [lld][Arm] Big Endian - Byte invariant support.
simpal01 via All-commits
all-commits at lists.llvm.org
Tue Jun 20 06:08:35 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 8cf8956897ce9bca3176c6339077b1ca17b27abc
https://github.com/llvm/llvm-project/commit/8cf8956897ce9bca3176c6339077b1ca17b27abc
Author: Simi Pallipurath <simi.pallipurath at arm.com>
Date: 2023-06-20 (Tue, 20 Jun 2023)
Changed paths:
M lld/ELF/Arch/ARM.cpp
M lld/ELF/Config.h
M lld/ELF/Driver.cpp
M lld/ELF/Options.td
M lld/ELF/OutputSections.cpp
M lld/ELF/SyntheticSections.cpp
M lld/ELF/Target.h
M lld/ELF/Thunks.cpp
M lld/ELF/Writer.cpp
M lld/docs/ld.lld.1
M lld/test/ELF/arm-bl-v6.s
M lld/test/ELF/arm-data-relocs.s
M lld/test/ELF/arm-exidx-emit-relocs.s
M lld/test/ELF/arm-exidx-relocatable.s
M lld/test/ELF/arm-exidx-sentinel-norelocatable.s
M lld/test/ELF/arm-header.s
M lld/test/ELF/arm-mov-relocs.s
M lld/test/ELF/arm-plt-reloc.s
M lld/test/ELF/arm-thumb-plt-reloc.s
M lld/test/ELF/arm-thunk-arm-thumb-reuse.s
M lld/test/ELF/arm-thunk-edgecase.s
M lld/test/ELF/arm-thunk-largesection.s
M lld/test/ELF/arm-thunk-linkerscript-dotexpr.s
M lld/test/ELF/arm-thunk-linkerscript.s
M lld/test/ELF/arm-thunk-nosuitable.s
M lld/test/ELF/arm-thunk-re-add.s
M lld/test/ELF/arm-thunk-reuse.s
M lld/test/ELF/arm-thunk-section-too-large.s
M lld/test/ELF/arm-thunk-toolargesection.s
M lld/test/ELF/arm-v5-reloc-error.s
M lld/test/ELF/emulation-arm.s
M lld/test/ELF/target-specific-options.s
Log Message:
-----------
[lld][Arm] Big Endian - Byte invariant support.
Arm has BE8 big endian configuration called a byte-invariant(every byte has the same address on little and big-endian systems).
When in BE8 mode:
1. Instructions are big-endian in relocatable objects but
little-endian in executables and shared objects.
2. Data is big-endian.
3. The data encoding of the ELF file is ELFDATA2MSB.
To support BE8 without an ABI break for relocatable objects,the linker takes on the responsibility of changing the endianness of instructions. At a high level the only difference between BE32 and BE8 in the linker is that for BE8:
1. The linker sets the flag EF_ARM_BE8 in the ELF header.
2. The linker endian reverses the instructions, but not data.
This patch adds BE8 big endian support for Arm. To endian reverse the instructions we'll need access to the mapping symbols. Code sections can contain a mix of Arm, Thumb and literal data. We need to endian reverse Arm instructions as words, Thumb instructions
as half-words and ignore literal data.The only way to find these transitions precisely is by using mapping symbols. The instruction reversal will need to take place after relocation. For Arm BE8 code sections (Section has SHF_EXECINSTR flag ) we inserted a step after relocation to endian reverse the instructions. The implementation strategy i have used here is to write all sections BE32 including SyntheticSections then endian reverse all code in InputSections via mapping symbols.
Reviewed By: peter.smith
Differential Revision: https://reviews.llvm.org/D150870
More information about the All-commits
mailing list