• Home
  • Raw
  • Download

Lines Matching refs:off

78 static void applySecRel(const SectionChunk *sec, uint8_t *off,  in applySecRel()  argument
87 add32(off, secRel); in applySecRel()
90 static void applySecIdx(uint8_t *off, OutputSection *os) { in applySecIdx() argument
95 add16(off, os->sectionIndex); in applySecIdx()
97 add16(off, DefinedAbsolute::numOutputSections + 1); in applySecIdx()
100 void SectionChunk::applyRelX64(uint8_t *off, uint16_t type, OutputSection *os, in applyRelX64() argument
103 case IMAGE_REL_AMD64_ADDR32: add32(off, s + config->imageBase); break; in applyRelX64()
104 case IMAGE_REL_AMD64_ADDR64: add64(off, s + config->imageBase); break; in applyRelX64()
105 case IMAGE_REL_AMD64_ADDR32NB: add32(off, s); break; in applyRelX64()
106 case IMAGE_REL_AMD64_REL32: add32(off, s - p - 4); break; in applyRelX64()
107 case IMAGE_REL_AMD64_REL32_1: add32(off, s - p - 5); break; in applyRelX64()
108 case IMAGE_REL_AMD64_REL32_2: add32(off, s - p - 6); break; in applyRelX64()
109 case IMAGE_REL_AMD64_REL32_3: add32(off, s - p - 7); break; in applyRelX64()
110 case IMAGE_REL_AMD64_REL32_4: add32(off, s - p - 8); break; in applyRelX64()
111 case IMAGE_REL_AMD64_REL32_5: add32(off, s - p - 9); break; in applyRelX64()
112 case IMAGE_REL_AMD64_SECTION: applySecIdx(off, os); break; in applyRelX64()
113 case IMAGE_REL_AMD64_SECREL: applySecRel(this, off, os, s); break; in applyRelX64()
120 void SectionChunk::applyRelX86(uint8_t *off, uint16_t type, OutputSection *os, in applyRelX86() argument
124 case IMAGE_REL_I386_DIR32: add32(off, s + config->imageBase); break; in applyRelX86()
125 case IMAGE_REL_I386_DIR32NB: add32(off, s); break; in applyRelX86()
126 case IMAGE_REL_I386_REL32: add32(off, s - p - 4); break; in applyRelX86()
127 case IMAGE_REL_I386_SECTION: applySecIdx(off, os); break; in applyRelX86()
128 case IMAGE_REL_I386_SECREL: applySecRel(this, off, os, s); break; in applyRelX86()
135 static void applyMOV(uint8_t *off, uint16_t v) { in applyMOV() argument
136 write16le(off, (read16le(off) & 0xfbf0) | ((v & 0x800) >> 1) | ((v >> 12) & 0xf)); in applyMOV()
137 write16le(off + 2, (read16le(off + 2) & 0x8f00) | ((v & 0x700) << 4) | (v & 0xff)); in applyMOV()
140 static uint16_t readMOV(uint8_t *off, bool movt) { in readMOV() argument
141 uint16_t op1 = read16le(off); in readMOV()
145 uint16_t op2 = read16le(off + 2); in readMOV()
153 void applyMOV32T(uint8_t *off, uint32_t v) { in applyMOV32T() argument
154 uint16_t immW = readMOV(off, false); // read MOVW operand in applyMOV32T()
155 uint16_t immT = readMOV(off + 4, true); // read MOVT operand in applyMOV32T()
158 applyMOV(off, v); // set MOVW operand in applyMOV32T()
159 applyMOV(off + 4, v >> 16); // set MOVT operand in applyMOV32T()
162 static void applyBranch20T(uint8_t *off, int32_t v) { in applyBranch20T() argument
168 or16(off, (s << 10) | ((v >> 12) & 0x3f)); in applyBranch20T()
169 or16(off + 2, (j1 << 13) | (j2 << 11) | ((v >> 1) & 0x7ff)); in applyBranch20T()
172 void applyBranch24T(uint8_t *off, int32_t v) { in applyBranch24T() argument
178 or16(off, (s << 10) | ((v >> 12) & 0x3ff)); in applyBranch24T()
180 write16le(off + 2, (read16le(off + 2) & 0xd000) | (j1 << 13) | (j2 << 11) | ((v >> 1) & 0x7ff)); in applyBranch24T()
183 void SectionChunk::applyRelARM(uint8_t *off, uint16_t type, OutputSection *os, in applyRelARM() argument
190 case IMAGE_REL_ARM_ADDR32: add32(off, sx + config->imageBase); break; in applyRelARM()
191 case IMAGE_REL_ARM_ADDR32NB: add32(off, sx); break; in applyRelARM()
192 case IMAGE_REL_ARM_MOV32T: applyMOV32T(off, sx + config->imageBase); break; in applyRelARM()
193 case IMAGE_REL_ARM_BRANCH20T: applyBranch20T(off, sx - p - 4); break; in applyRelARM()
194 case IMAGE_REL_ARM_BRANCH24T: applyBranch24T(off, sx - p - 4); break; in applyRelARM()
195 case IMAGE_REL_ARM_BLX23T: applyBranch24T(off, sx - p - 4); break; in applyRelARM()
196 case IMAGE_REL_ARM_SECTION: applySecIdx(off, os); break; in applyRelARM()
197 case IMAGE_REL_ARM_SECREL: applySecRel(this, off, os, s); break; in applyRelARM()
198 case IMAGE_REL_ARM_REL32: add32(off, sx - p - 4); break; in applyRelARM()
208 void applyArm64Addr(uint8_t *off, uint64_t s, uint64_t p, int shift) { in applyArm64Addr() argument
209 uint32_t orig = read32le(off); in applyArm64Addr()
216 write32le(off, (orig & ~mask) | immLo | immHi); in applyArm64Addr()
222 void applyArm64Imm(uint8_t *off, uint64_t imm, uint32_t rangeLimit) { in applyArm64Imm() argument
223 uint32_t orig = read32le(off); in applyArm64Imm()
226 write32le(off, orig | ((imm & (0xFFF >> rangeLimit)) << 10)); in applyArm64Imm()
237 static void applyArm64Ldr(uint8_t *off, uint64_t imm) { in applyArm64Ldr() argument
238 uint32_t orig = read32le(off); in applyArm64Ldr()
246 applyArm64Imm(off, imm >> size, size); in applyArm64Ldr()
249 static void applySecRelLow12A(const SectionChunk *sec, uint8_t *off, in applySecRelLow12A() argument
252 applyArm64Imm(off, (s - os->getRVA()) & 0xfff, 0); in applySecRelLow12A()
255 static void applySecRelHigh12A(const SectionChunk *sec, uint8_t *off, in applySecRelHigh12A() argument
265 applyArm64Imm(off, secRel & 0xfff, 0); in applySecRelHigh12A()
268 static void applySecRelLdr(const SectionChunk *sec, uint8_t *off, in applySecRelLdr() argument
271 applyArm64Ldr(off, (s - os->getRVA()) & 0xfff); in applySecRelLdr()
274 void applyArm64Branch26(uint8_t *off, int64_t v) { in applyArm64Branch26() argument
277 or32(off, (v & 0x0FFFFFFC) >> 2); in applyArm64Branch26()
280 static void applyArm64Branch19(uint8_t *off, int64_t v) { in applyArm64Branch19() argument
283 or32(off, (v & 0x001FFFFC) << 3); in applyArm64Branch19()
286 static void applyArm64Branch14(uint8_t *off, int64_t v) { in applyArm64Branch14() argument
289 or32(off, (v & 0x0000FFFC) << 3); in applyArm64Branch14()
292 void SectionChunk::applyRelARM64(uint8_t *off, uint16_t type, OutputSection *os, in applyRelARM64() argument
295 case IMAGE_REL_ARM64_PAGEBASE_REL21: applyArm64Addr(off, s, p, 12); break; in applyRelARM64()
296 case IMAGE_REL_ARM64_REL21: applyArm64Addr(off, s, p, 0); break; in applyRelARM64()
297 case IMAGE_REL_ARM64_PAGEOFFSET_12A: applyArm64Imm(off, s & 0xfff, 0); break; in applyRelARM64()
298 case IMAGE_REL_ARM64_PAGEOFFSET_12L: applyArm64Ldr(off, s & 0xfff); break; in applyRelARM64()
299 case IMAGE_REL_ARM64_BRANCH26: applyArm64Branch26(off, s - p); break; in applyRelARM64()
300 case IMAGE_REL_ARM64_BRANCH19: applyArm64Branch19(off, s - p); break; in applyRelARM64()
301 case IMAGE_REL_ARM64_BRANCH14: applyArm64Branch14(off, s - p); break; in applyRelARM64()
302 case IMAGE_REL_ARM64_ADDR32: add32(off, s + config->imageBase); break; in applyRelARM64()
303 case IMAGE_REL_ARM64_ADDR32NB: add32(off, s); break; in applyRelARM64()
304 case IMAGE_REL_ARM64_ADDR64: add64(off, s + config->imageBase); break; in applyRelARM64()
305 case IMAGE_REL_ARM64_SECREL: applySecRel(this, off, os, s); break; in applyRelARM64()
306 case IMAGE_REL_ARM64_SECREL_LOW12A: applySecRelLow12A(this, off, os, s); break; in applyRelARM64()
307 case IMAGE_REL_ARM64_SECREL_HIGH12A: applySecRelHigh12A(this, off, os, s); break; in applyRelARM64()
308 case IMAGE_REL_ARM64_SECREL_LOW12L: applySecRelLdr(this, off, os, s); break; in applyRelARM64()
309 case IMAGE_REL_ARM64_SECTION: applySecIdx(off, os); break; in applyRelARM64()
310 case IMAGE_REL_ARM64_REL32: add32(off, s - p - 4); break; in applyRelARM64()
372 uint8_t *off = buf + rel.VirtualAddress; in writeTo() local
399 applyRelX64(off, rel.Type, os, s, p); in writeTo()
402 applyRelX86(off, rel.Type, os, s, p); in writeTo()
405 applyRelARM(off, rel.Type, os, s, p); in writeTo()
408 applyRelARM64(off, rel.Type, os, s, p); in writeTo()
696 int64_t off = impSymbol->getRVA() & 0xfff; in writeTo() local
699 applyArm64Ldr(buf + 4, off); in writeTo()
893 size_t off = builder.getOffset(toStringRef(c->getContents())); in assignSubsectionRVAs() local
894 c->setRVA(rva + off); in assignSubsectionRVAs()