[lld] r232761 - [Mips] Add comments to the relocation calculation functions
Simon Atanasyan
simon at atanasyan.com
Thu Mar 19 13:56:34 PDT 2015
Author: atanasyan
Date: Thu Mar 19 15:56:34 2015
New Revision: 232761
URL: http://llvm.org/viewvc/llvm-project?rev=232761&view=rev
Log:
[Mips] Add comments to the relocation calculation functions
No functional changes.
Modified:
lld/trunk/lib/ReaderWriter/ELF/Mips/MipsRelocationHandler.cpp
Modified: lld/trunk/lib/ReaderWriter/ELF/Mips/MipsRelocationHandler.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/Mips/MipsRelocationHandler.cpp?rev=232761&r1=232760&r2=232761&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/Mips/MipsRelocationHandler.cpp (original)
+++ lld/trunk/lib/ReaderWriter/ELF/Mips/MipsRelocationHandler.cpp Thu Mar 19 15:56:34 2015
@@ -205,6 +205,7 @@ static uint32_t relocLo16(uint64_t P, ui
return result;
}
+/// \brief R_MIPS_PCLO16
/// local/external: lo16 (S + AHL - P)
static uint32_t relocPcLo16(uint64_t P, uint64_t S, int64_t AHL) {
AHL = llvm::SignExtend32<16>(AHL);
@@ -244,14 +245,16 @@ static uint32_t relocGPRel32(uint64_t S,
}
/// \brief R_MIPS_PC18_S3
+/// local/external: (S + A - P) >> 3 (P with cleared 3 less significant bits)
static uint32_t relocPc18(uint64_t P, uint64_t S, int64_t A) {
A = llvm::SignExtend32<21>(A);
// FIXME (simon): Check that S + A has 8-byte alignment
- int32_t result = S + A - ((P | 7) ^ 7); // pc with cleared 3-lsb
+ int32_t result = S + A - ((P | 7) ^ 7);
return result >> 3;
}
/// \brief R_MIPS_PC19_S2
+/// local/external: (S + A - P) >> 2
static uint32_t relocPc19(uint64_t P, uint64_t S, int64_t A) {
A = llvm::SignExtend32<21>(A);
// FIXME (simon): Check that S + A has 4-byte alignment
@@ -260,6 +263,7 @@ static uint32_t relocPc19(uint64_t P, ui
}
/// \brief R_MIPS_PC21_S2
+/// local/external: (S + A - P) >> 2
static uint32_t relocPc21(uint64_t P, uint64_t S, int64_t A) {
A = llvm::SignExtend32<23>(A);
// FIXME (simon): Check that S + A has 4-byte alignment
@@ -268,6 +272,7 @@ static uint32_t relocPc21(uint64_t P, ui
}
/// \brief R_MIPS_PC26_S2
+/// local/external: (S + A - P) >> 2
static uint32_t relocPc26(uint64_t P, uint64_t S, int64_t A) {
A = llvm::SignExtend32<28>(A);
// FIXME (simon): Check that S + A has 4-byte alignment
More information about the llvm-commits
mailing list