Also extend the tests for IMAGE_REL_ARM64_PAGEOFFSET_12L to test all 8/16/32/64 bit GPR and 8/16/32/64/128 SIMD/FP bit ldr/str variants.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
Where is this behavior documented?
COFF/Chunks.cpp | ||
---|---|---|
190 ↗ | (On Diff #107391) | This is probably more straightforward: if (Orig & 0x280000) Size += 4; |
On page 533 and 1108 in "ARM Architecture Reference Manual ARMv8, for ARMv8-A architecture profile", at https://developer.arm.com/docs/ddi0487/latest/arm-architecture-reference-manual-armv8-for-armv8-a-architecture-profile. I found a direct link to a copy if the pdf at http://mazsola.iit.uni-miskolc.hu/~drdani/docs_arm/DDI0487A_e_armv8_arm.pdf as well.
Or if you mean what instruction forms IMAGE_REL_ARM64_PAGEOFFSET_12L can refer to; the official pecoff document doesn't say, but this is based on the instructions that I've seen LLVM produce, with this relocation. That originates from AArch64::fixup_aarch64_ldst_imm12_scale1, ..._scale2, 4, 8 and 16 (in lib/Target/AArch64/MCTargetDesc/AArch64WinCOFFObjectWriter.cpp) - I haven't tried to backtrack to see if those can be applied to other instruction forms as well.
COFF/Chunks.cpp | ||
---|---|---|
190 ↗ | (On Diff #107391) | Sure - I'll update the patch later today. |
I wanted to ask about IMAGE_REL_ARM64_PAGEOFFSET_12L. Sorry for the confusion. The reason why I wanted more information is because, with this patch, a relocation with this relocation type behaves differently depending on an instruction to which the relocation is applied. I think that is not common. Usually, relocations are agnostic on instructions they are modifying but just blindly mutate bits where they are applied. If you need some different behavior, I thought you'd define a different relocation type.
That being said, is this behavior the same as the Microsoft linker? If so, it's correct whether it is odd or not.
Yes, I've checked it with their linker. (Even though the MSVC compiler for ARM64 isn't available publicly yet, link.exe from MSVC 2013 and onwards already seems to support ARM64.)
I think the sizes are separate relocation types in other object file types, but perhaps Microsoft wanted to save on the number of different relocation. (What's the available range for them in COFF?)
COFF/Chunks.cpp | ||
---|---|---|
190 ↗ | (On Diff #107391) | Actually, it'd be like this: // 0x04000000 indicates SIMD/FP registers // 0x00800000 indicates 128 bit if ((Orig & 0x4800000) == 0x4800000) Size += 4; |
Rewrote the condition as suggested by Rui (with modifications to keep the exact behaviour as before).