-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
liblink: fix relocations, constants, and immediate moves
This change fixes a lot of related bugs. ARM64 is a 64-bit machine, and the most general constants are 64-bit. The most general constant class was C_LCON, which is 32-bit. We change it to C_VCON. This didn't affect much because there weren't many assumptions on the size of C_LCON, but it allows us to use C_LCON for quantities which we know are 32-bit and could use a more efficient encoding (none so far). This change also makes the distinction between memory addresses (C_ADDR, which require relocation) and other 64-bit constants (C_VCON). Optab instruction variants for C_VCON quantities were duplicated to also work on C_ADDR where it makes sense. We could have simply made C_VCON equal C_ADDR in cmp, so existing instruction forms would have worked, but this way we can distinguish between instructions that need to operate on relocatable addresses and instructions that can operate on generic 64-bit constants, providing more theoretical safety. This change also enables more immediate forms, requiring less pool literals. Some forms still don't work, however, but most do. Another side effect of this change is fixing linking. Because we didn't use optimal immediate encodings, we generated more constant types that we originally accounted for. The extra constants were catched by a default switch case, which assumed they were all relocations, and issued relocations for them. The linker then complained it couldn't find the referenced symbols. Updates golang#6 Fixes golang#62
- Loading branch information
Showing
1 changed file
with
83 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters