summaryrefslogtreecommitdiffstats
path: root/lld/ELF/AArch64ErrataFix.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [LLD][ELF][AArch64][ARM] Add missing classof to patch sections.Peter Smith2019-12-111-0/+4
| | | | | | | | | | | | | The code to insert patch section merges them with a comparison function that uses logic of the form: return (isa<PatchSection>(a) && !isa<PatchSection>(b)); If the PatchSections don't implement classof this check fails if b is also a SyntheticSection. This can result in the patches being out of range if the SyntheticSection is big, for example a ThunkSection with lots of thunks. Differential Revision: https://reviews.llvm.org/D71242 fixes (part of) pr44071
* Fix a few typos in lld/ELF to cycle botsNico Weber2019-10-281-2/+2
|
* [ELF][AARCH64] Refactor AArchErrataFix to match changes in ARMErrataFix NFC.Peter Smith2019-09-171-22/+19
| | | | | | | | | | | | | | | | | | D67284 introduced ARMErrataFix.cpp which was derived from AArch64ErrataFix.cpp. There were some useful refactoring changes made to ARMErrataFix.cpp made as part of the review. This change applies the relevant changes back to AArch64ErrataFix.cpp. Main changes are: - Old style variable names in comments like IS, are now new style isec. - Simplify init() collection of mappingSymbols to always start with a code mapping symbol. - Simplify logic in mergeCmp(). - Fix one 80 column overflow caused by IS -> isec transformation. Differential Revision: https://reviews.llvm.org/D67622 llvm-svn: 372094
* [ELF][ARM] Implement --fix-cortex-a8 to fix erratum 657417Peter Smith2019-09-161-7/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The --fix-cortex-a8 option implements a linker workaround for the coretex-a8 erratum 657417. A summary of the erratum conditions is: - A 32-bit Thumb-2 branch instruction B.w, Bcc.w, BL, BLX spans two 4KiB regions. - The destination of the branch is to the first 4KiB region. - The instruction before the branch is a 32-bit Thumb-2 non-branch instruction. The linker fix is to redirect the branch to a patch not in the first 4KiB region. The patch forwards the branch on to its target. The cortex-a8, is an old CPU, with the first implementation of this workaround in ld.bfd appearing in 2009. The cortex-a8 has been used in early Android Phones and there are some critical applications that still need to run on a cortex-a8 that have the erratum. The patch is applied roughly 10 times on LLD and 20 on Clang when they are built with --fix-cortex-a8 on an Arm system. The formal erratum description is avaliable in the ARM Core Cortex-A8 (AT400/AT401) Errata Notice document. This is available from Arm on request but it seems to be findable via a web search. Differential Revision: https://reviews.llvm.org/D67284 llvm-svn: 371965
* [ELF][AArch64] Apply some NFC cleanups to AArch64ErrataFix.cppFangrui Song2019-09-091-10/+10
| | | | | | | | Reviewed By: ruiu Differential Revision: https://reviews.llvm.org/D67310 llvm-svn: 371389
* [ELF] Fix variable names in comments after VariableName -> variableName changeFangrui Song2019-07-161-10/+10
| | | | | | Also fix some typos. llvm-svn: 366181
* [Coding style change][lld] Rename variables for non-ELF portsRui Ueyama2019-07-111-8/+8
| | | | | | | | | | | This patch does the same thing as r365595 to other subdirectories, which completes the naming style change for the entire lld directory. With this, the naming style conversion is complete for lld. Differential Revision: https://reviews.llvm.org/D64473 llvm-svn: 365730
* [Coding style change] Rename variables so that they start with a lowercase ↵Rui Ueyama2019-07-101-230/+230
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | letter This patch is mechanically generated by clang-llvm-rename tool that I wrote using Clang Refactoring Engine just for creating this patch. You can see the source code of the tool at https://reviews.llvm.org/D64123. There's no manual post-processing; you can generate the same patch by re-running the tool against lld's code base. Here is the main discussion thread to change the LLVM coding style: https://lists.llvm.org/pipermail/llvm-dev/2019-February/130083.html In the discussion thread, I proposed we use lld as a testbed for variable naming scheme change, and this patch does that. I chose to rename variables so that they are in camelCase, just because that is a minimal change to make variables to start with a lowercase letter. Note to downstream patch maintainers: if you are maintaining a downstream lld repo, just rebasing ahead of this commit would cause massive merge conflicts because this patch essentially changes every line in the lld subdirectory. But there's a remedy. clang-llvm-rename tool is a batch tool, so you can rename variables in your downstream repo with the tool. Given that, here is how to rebase your repo to a commit after the mass renaming: 1. rebase to the commit just before the mass variable renaming, 2. apply the tool to your downstream repo to mass-rename variables locally, and 3. rebase again to the head. Most changes made by the tool should be identical for a downstream repo and for the head, so at the step 3, almost all changes should be merged and disappear. I'd expect that there would be some lines that you need to merge by hand, but that shouldn't be too many. Differential Revision: https://reviews.llvm.org/D64121 llvm-svn: 365595
* Use llvm::stable_sortFangrui Song2019-04-231-3/+3
| | | | | | | | | Make some small adjustment while touching the code: make parameters const, use less_first(), etc. Differential Revision: https://reviews.llvm.org/D60989 llvm-svn: 358943
* [ELF][MachO][wasm] Simplify range-style std::find{,_if} with STLExtras.h ↵Fangrui Song2019-03-291-3/+3
| | | | | | utilities. NFC llvm-svn: 357269
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* ELF: AArch64: Fix errata patch address calculation.Peter Collingbourne2018-12-171-1/+2
| | | | | | | | | | | The code here wants the output section offset of the instruction requiring the errata patch, not the virtual address. Without this change we can end up placing a patch out of range if the virtual address of the code section is large enough. Differential Revision: https://reviews.llvm.org/D55732 llvm-svn: 349386
* [AArch64] Cortex-a53-843419 erratum should not apply to relaxed TLS.Peter Smith2018-11-271-4/+8
| | | | | | | | | | | | | | | | The changes to the instructions performed by TLS relaxation and the errata patching are performed with relocations. As these are applied so late the errata scanning won't see the changes in the section data made by the TLS relaxation. This can lead to a TLS relaxed sequence being patched when it doesn't need to be. The fix checks to see if there is a R_RELAX_TLS_IE_TO_LE instruction at the same address as the ADRP as this indicates the presence of a relaxation of a sequence that might get recognised as a patch. Differential Revision: https://reviews.llvm.org/D54854 llvm-svn: 347649
* Avoid unnecessary buffer allocation and memcpy for compressed sections.Rui Ueyama2018-10-081-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, we uncompress all compressed sections before doing anything. That works, and that is conceptually simple, but that could results in a waste of CPU time and memory if uncompressed sections are then discarded or just copied to the output buffer. In particular, if .debug_gnu_pub{names,types} are compressed and if no -gdb-index option is given, we wasted CPU and memory because we uncompress them into newly allocated bufers and then memcpy the buffers to the output buffer. That temporary buffer was redundant. This patch changes how to uncompress sections. Now, compressed sections are uncompressed lazily. To do that, `Data` member of `InputSectionBase` is now hidden from outside, and `data()` accessor automatically expands an compressed buffer if necessary. If no one calls `data()`, then `writeTo()` directly uncompresses compressed data into the output buffer. That eliminates the redundant memory allocation and redundant memcpy. This patch significantly reduces memory consumption (20 GiB max RSS to 15 Gib) for an executable whose .debug_gnu_pub{names,types} are in total 5 GiB in an uncompressed form. Differential Revision: https://reviews.llvm.org/D52917 llvm-svn: 343979
* [ELF] Guard --fix-cortex-a53-843419 against --just-symsPeter Smith2018-09-131-1/+1
| | | | | | | | | | | | | | If --just-syms is used the mapping symbols from the ELF file will be absolute symbols with no section. The code to process mapping symbols in --fix-cortex-a53-843419 assumes that these symbols have a defining section so a crash will result when --just-syms is used. The simple fix is to not process the symbol when it doesn't have a section. Fixes PR37971 Differential Revision: https://reviews.llvm.org/D52038 llvm-svn: 342146
* [ELF] Add support for Armv5 and Armv6 compatible ThunksPeter Smith2018-08-201-2/+2
| | | | | | | | | | | | | | | | Older Arm architectures do not support the MOVT and MOVW instructions so we must use an alternative sequence of instructions to transfer control to the destination. Assuming at least Armv5 this patch adds support for Thunks that load or add to the program counter. Note that there are no Armv5 Thumb Thunks as there is no Thumb branch instruction in Armv5 that supports Thunks. These thunks will not work for Armv4t (arm7tdmi) as this architecture cannot change state from using the LDR or ADD instruction. Differential Revision: https://reviews.llvm.org/D50077 llvm-svn: 340160
* Add a SectionBase::getVA helper. NFC.Rafael Espindola2018-03-241-3/+3
| | | | | | There were a few too many places duplicating this. llvm-svn: 328402
* Merge {COFF,ELF}/Strings.cpp to Common/Strings.cpp.Rui Ueyama2018-02-281-1/+1
| | | | | | | | | This should resolve the issue that lld build fails in some hosts that uses case-insensitive file system. Differential Revision: https://reviews.llvm.org/D43788 llvm-svn: 326339
* Consistent (non) use of empty lines in include blocksSam Clegg2018-02-201-1/+0
| | | | | | | | | The profailing style in lld seem to be to not include such empty lines. Clang-tidy/clang-format seem to handle this just fine. Differential Revision: https://reviews.llvm.org/D43528 llvm-svn: 325629
* Use log to print out a verbose message.Rui Ueyama2018-02-091-4/+2
| | | | llvm-svn: 324688
* Remove Config->Verbose because we have errorHandler().Verbose.Rui Ueyama2018-02-081-1/+2
| | | | llvm-svn: 324684
* [ELF] Make --fix-cortex-a53-843419 work on big endian hostsPeter Smith2018-01-231-1/+2
| | | | | | | | | | | | The reinterpret cast to uint32_t to read the little-endian instructions will only work on a little endian system. Use ulittle32_t to always read little-endian (AArch64 instructions are always little endian). Fixes PR36056 Differential Revision: https://reviews.llvm.org/D42421 llvm-svn: 323243
* Use references instead of pointers. NFC.Rafael Espindola2017-12-191-2/+2
| | | | | | | These values are trivially never null. While at it, also use InputSection instead of InputSectionBase when possible. llvm-svn: 321126
* [ELF] Complete implementation of --fix-cortex-a53-843419Peter Smith2017-12-151-60/+218
| | | | | | | | | | | | | | | | | | This patch provides the mechanism to fix instances of the instruction sequence that may trigger the cortex-a53 843419 erratum. The fix is provided by an alternative instruction sequence to remove one of the erratum conditions. To reach this alternative instruction sequence we replace the original instruction with a branch to the alternative sequence. The alternative sequence is responsible for branching back to the original. As there is only erratum to fix the implementation is specific to AArch64 and the specific erratum conditions. It should be generalizable to other targets and erratum if needed. Differential Revision: https://reviews.llvm.org/D36749 llvm-svn: 320800
* Remove some includes from InputFiles.h.Rafael Espindola2017-12-091-1/+2
| | | | | | | They were not used in InputFiles.h and it was getting too easy to add circular includes. llvm-svn: 320256
* [ELF] AArch64 Errata fix, add missing files.Peter Smith2017-12-051-0/+489
Forgot these from r319780 llvm-svn: 319781
OpenPOWER on IntegriCloud