Lines Matching +full:0 +full:xd000
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
52 enum class CodeState { Data = 0, Thumb = 2, Arm = 4 };
55 static DenseMap<InputSection *, SmallVector<const Defined *, 0>> sectionMap{};
70 trapInstr = {0xd4, 0xd4, 0xd4, 0xd4}; in ARM()
78 uint32_t abiFloatType = 0; in calcEFlags()
82 uint32_t armBE8 = 0; in calcEFlags()
218 write32(buf + 0, 0xe52de004); // str lr, [sp,#-4]! in writePltHeaderLong()
219 write32(buf + 4, 0xe59fe004); // ldr lr, L2 in writePltHeaderLong()
220 write32(buf + 8, 0xe08fe00e); // L1: add lr, pc, lr in writePltHeaderLong()
221 write32(buf + 12, 0xe5bef008); // ldr pc, [lr, #8] in writePltHeaderLong()
222 write32(buf + 16, 0x00000000); // L2: .word &(.got.plt) - L1 - 8 in writePltHeaderLong()
223 write32(buf + 20, 0xd4d4d4d4); // Pad to 32-byte boundary in writePltHeaderLong()
224 write32(buf + 24, 0xd4d4d4d4); // Pad to 32-byte boundary in writePltHeaderLong()
225 write32(buf + 28, 0xd4d4d4d4); in writePltHeaderLong()
243 // 0: b500 push {lr} in writePltHeader()
244 // 2: f8df e008 ldr.w lr, [pc, #0x8] @ 0xe <func+0xe> in writePltHeader()
249 // At 0x8, we want to jump to .got.plt, the -16 accounts for 8 bytes from in writePltHeader()
254 write16(buf + 0, 0xb500); in writePltHeader()
256 write16(buf + 2, 0xf8df); in writePltHeader()
257 write16(buf + 4, 0xe008); in writePltHeader()
258 write16(buf + 6, 0x44fe); in writePltHeader()
260 write16(buf + 8, 0xf85e); in writePltHeader()
261 write16(buf + 10, 0xff08); in writePltHeader()
274 0xe52de004, // L1: str lr, [sp,#-4]! in writePltHeader()
275 0xe28fe600, // add lr, pc, #0x0NN00000 &(.got.plt - L1 - 4) in writePltHeader()
276 0xe28eea00, // add lr, lr, #0x000NN000 &(.got.plt - L1 - 4) in writePltHeader()
277 0xe5bef000, // ldr pc, [lr, #0x00000NNN] &(.got.plt -L1 - 4) in writePltHeader()
286 write32(buf + 0, pltData[0]); in writePltHeader()
287 write32(buf + 4, pltData[1] | ((offset >> 20) & 0xff)); in writePltHeader()
288 write32(buf + 8, pltData[2] | ((offset >> 12) & 0xff)); in writePltHeader()
289 write32(buf + 12, pltData[3] | (offset & 0xfff)); in writePltHeader()
299 addSyntheticLocal("$t", STT_NOTYPE, 0, 0, isec); in addPltHeaderSymbols()
300 addSyntheticLocal("$d", STT_NOTYPE, 12, 0, isec); in addPltHeaderSymbols()
302 addSyntheticLocal("$a", STT_NOTYPE, 0, 0, isec); in addPltHeaderSymbols()
303 addSyntheticLocal("$d", STT_NOTYPE, 16, 0, isec); in addPltHeaderSymbols()
311 write32(buf + 0, 0xe59fc004); // ldr ip, L2 in writePltLong()
312 write32(buf + 4, 0xe08cc00f); // L1: add ip, ip, pc in writePltLong()
313 write32(buf + 8, 0xe59cf000); // ldr pc, [ip] in writePltLong()
314 write32(buf + 12, 0x00000000); // L2: .word Offset(&(.got.plt) - L1 - 8 in writePltLong()
333 0xe28fc600, // L1: add ip, pc, #0x0NN00000 Offset(&(.got.plt) - L1 - 8 in writePlt()
334 0xe28cca00, // add ip, ip, #0x000NN000 Offset(&(.got.plt) - L1 - 8 in writePlt()
335 0xe5bcf000, // ldr pc, [ip, #0x00000NNN] Offset(&(.got.plt) - L1 - 8 in writePlt()
342 write32(buf + 0, pltData[0] | ((offset >> 20) & 0xff)); in writePlt()
343 write32(buf + 4, pltData[1] | ((offset >> 12) & 0xff)); in writePlt()
344 write32(buf + 8, pltData[2] | (offset & 0xfff)); in writePlt()
358 // where ip = r12 = 0xc in writePlt()
361 write16(buf + 2, 0x0c00); // use `ip` in writePlt()
365 write16(buf + 6, 0x0c00); // use `ip` in writePlt()
368 write16(buf + 8, 0x44fc); // add ip, pc in writePlt()
369 write16(buf + 10, 0xf8dc); // ldr.w pc, [ip] (bottom half) in writePlt()
370 write16(buf + 12, 0xf000); // ldr.w pc, [ip] (upper half) in writePlt()
371 write16(buf + 14, 0xe7fc); // Branch to previous instruction in writePlt()
377 addSyntheticLocal("$t", STT_NOTYPE, off, 0, isec); in addPltSymbols()
379 addSyntheticLocal("$a", STT_NOTYPE, off, 0, isec); in addPltSymbols()
380 addSyntheticLocal("$d", STT_NOTYPE, off + 12, 0, isec); in addPltSymbols()
401 // Otherwise we need to interwork if STT_FUNC Symbol has bit 0 set (Thumb). in needsThunk()
415 // Otherwise we need to interwork if STT_FUNC Symbol has bit 0 clear (ARM). in needsThunk()
417 (s.isFunc() && (s.getVA() & 1) == 0)) in needsThunk()
423 (!config->armHasBlx && (s.getVA() & 1) == 0);; in needsThunk()
459 return (config->armJ1J2BranchEncoding) ? 0x1000000 - 0x30000 in getThunkSectionSpacing()
460 : 0x400000 - 0x7500; in getThunkSectionSpacing()
464 if ((dst & 0x1) == 0) in inBranchRange()
468 src &= ~0x3; in inBranchRange()
470 // Bit 0 == 1 denotes Thumb state, it is not part of the range. in inBranchRange()
471 dst &= ~0x1; in inBranchRange()
530 if (lz == 32) // implies rem == 0 in getRemAndLZForGroup()
532 val &= 0xffffff >> lz; in getRemAndLZForGroup()
542 uint32_t opcode = 0x00800000; in encodeAluGroup()
544 opcode = 0x00400000; in encodeAluGroup()
549 uint32_t rot = 0; in encodeAluGroup()
554 if (check && imm > 0xff) in encodeAluGroup()
557 write32(loc, (read32(loc) & 0xff3ff000) | opcode | rot | (imm & 0xff)); in encodeAluGroup()
563 // function then addr is 0 (modulo 2) and Pa is 0 (modulo 4) so we can clear in encodeLdrGroup()
566 val &= ~0x1; in encodeLdrGroup()
568 uint32_t opcode = 0x00800000; in encodeLdrGroup()
570 opcode = 0x0; in encodeLdrGroup()
575 write32(loc, (read32(loc) & 0xff7ff000) | opcode | imm); in encodeLdrGroup()
581 // function then addr is 0 (modulo 2) and Pa is 0 (modulo 4) so we can clear in encodeLdrsGroup()
584 val &= ~0x1; in encodeLdrsGroup()
586 uint32_t opcode = 0x00800000; in encodeLdrsGroup()
588 opcode = 0x0; in encodeLdrsGroup()
593 write32(loc, (read32(loc) & 0xff7ff0f0) | opcode | ((imm & 0xf0) << 4) | in encodeLdrsGroup()
594 (imm & 0xf)); in encodeLdrsGroup()
620 write32(loc, (read32(loc) & 0x80000000) | (val & ~0x80000000)); in relocate()
625 // value of bit 0 of Val. With bit 0 == 1 denoting Thumb. If the symbol is in relocate()
629 bool isBlx = (read32(loc) & 0xfe000000) == 0xfa000000; in relocate()
635 // The BLX encoding is 0xfa:H:imm24 where Val = imm24:H:'1' in relocate()
637 write32(loc, 0xfa000000 | // opcode in relocate()
639 ((val >> 2) & 0x00ffffff)); // imm24 in relocate()
644 write32(loc, 0xeb000000 | (read32(loc) & 0x00ffffff)); in relocate()
652 write32(loc, (read32(loc) & ~0x00ffffff) | ((val >> 2) & 0x00ffffff)); in relocate()
657 write16(loc, (read32(loc) & 0xff00) | ((val >> 1) & 0x00ff)); in relocate()
662 write16(loc, (read32(loc) & 0xf800) | ((val >> 1) & 0x07ff)); in relocate()
665 // Encoding T3: Val = S:J2:J1:imm6:imm11:0 in relocate()
668 (read16(loc) & 0xfbc0) | // opcode cond in relocate()
669 ((val >> 10) & 0x0400) | // S in relocate()
670 ((val >> 12) & 0x003f)); // imm6 in relocate()
672 0x8000 | // opcode in relocate()
673 ((val >> 8) & 0x0800) | // J2 in relocate()
674 ((val >> 5) & 0x2000) | // J1 in relocate()
675 ((val >> 1) & 0x07ff)); // imm11 in relocate()
680 // value of bit 0 of Val. With bit 0 == 0 denoting ARM, if the symbol is in relocate()
686 bool isBlx = (read16(loc + 2) & 0x1000) == 0; in relocate()
696 write16(loc + 2, read16(loc + 2) & ~0x1000); in relocate()
698 write16(loc + 2, (read16(loc + 2) & ~0x1000) | 1 << 12); in relocate()
705 0xf000 | // opcode in relocate()
706 ((val >> 12) & 0x07ff)); // imm11 in relocate()
708 (read16(loc + 2) & 0xd000) | // opcode in relocate()
709 0x2800 | // J1 == J2 == 1 in relocate()
710 ((val >> 1) & 0x07ff)); // imm11 in relocate()
717 // Encoding B T4, BL T1, BLX T2: Val = S:I1:I2:imm10:imm11:0 in relocate()
720 0xf000 | // opcode in relocate()
721 ((val >> 14) & 0x0400) | // S in relocate()
722 ((val >> 12) & 0x03ff)); // imm10 in relocate()
724 (read16(loc + 2) & 0xd000) | // opcode in relocate()
725 (((~(val >> 10)) ^ (val >> 11)) & 0x2000) | // J1 in relocate()
726 (((~(val >> 11)) ^ (val >> 13)) & 0x0800) | // J2 in relocate()
727 ((val >> 1) & 0x07ff)); // imm11 in relocate()
732 write32(loc, (read32(loc) & ~0x000f0fff) | ((val & 0xf000) << 4) | in relocate()
733 (val & 0x0fff)); in relocate()
738 write32(loc, (read32(loc) & ~0x000f0fff) | in relocate()
739 (((val >> 16) & 0xf000) << 4) | ((val >> 16) & 0xfff)); in relocate()
747 0xf2c0 | // opcode in relocate()
748 ((val >> 17) & 0x0400) | // i in relocate()
749 ((val >> 28) & 0x000f)); // imm4 in relocate()
752 (read16(loc + 2) & 0x8f00) | // opcode in relocate()
753 ((val >> 12) & 0x7000) | // imm3 in relocate()
754 ((val >> 16) & 0x00ff)); // imm8 in relocate()
761 0xf240 | // opcode in relocate()
762 ((val >> 1) & 0x0400) | // i in relocate()
763 ((val >> 12) & 0x000f)); // imm4 in relocate()
765 (read16(loc + 2) & 0x8f00) | // opcode in relocate()
766 ((val << 4) & 0x7000) | // imm3 in relocate()
767 (val & 0x00ff)); // imm8 in relocate()
770 write16(loc, (read16(loc) &~ 0x00ff) | ((val >> 24) & 0x00ff)); in relocate()
773 write16(loc, (read16(loc) &~ 0x00ff) | ((val >> 16) & 0x00ff)); in relocate()
776 write16(loc, (read16(loc) &~ 0x00ff) | ((val >> 8) & 0x00ff)); in relocate()
779 write16(loc, (read16(loc) &~ 0x00ff) | (val & 0x00ff)); in relocate()
782 encodeAluGroup(loc, rel, val, 0, true); in relocate()
785 encodeAluGroup(loc, rel, val, 0, false); in relocate()
797 encodeLdrGroup(loc, rel, val, 0); in relocate()
806 encodeLdrsGroup(loc, rel, val, 0); in relocate()
817 uint16_t sub = 0; in relocate()
818 if (imm < 0) { in relocate()
820 sub = 0x00a0; in relocate()
823 write16(loc, (read16(loc) & 0xfb0f) | sub | (imm & 0x800) >> 1); in relocate()
825 (read16(loc + 2) & 0x8f00) | (imm & 0x700) << 4 | (imm & 0xff)); in relocate()
831 // function then addr is 0 (modulo 2) and Pa is 0 (modulo 4) so we can clear in relocate()
834 val &= ~0x1; in relocate()
837 write16(loc, (read16(loc) & 0xff00) | (val & 0x3fc) >> 2); in relocate()
843 // function then addr is 0 (modulo 2) and Pa is 0 (modulo 4) so we can clear in relocate()
846 val &= ~0x1; in relocate()
848 uint16_t u = 0x0080; in relocate()
849 if (imm12 < 0) { in relocate()
851 u = 0; in relocate()
855 write16(loc + 2, (read16(loc + 2) & 0xf000) | imm12); in relocate()
868 return 0; in getImplicitAddend()
902 // Encoding T3: A = S:J2:J1:imm10:imm6:0 in getImplicitAddend()
905 return SignExtend64<20>(((hi & 0x0400) << 10) | // S in getImplicitAddend()
906 ((lo & 0x0800) << 8) | // J2 in getImplicitAddend()
907 ((lo & 0x2000) << 5) | // J1 in getImplicitAddend()
908 ((hi & 0x003f) << 12) | // imm6 in getImplicitAddend()
909 ((lo & 0x07ff) << 1)); // imm11:0 in getImplicitAddend()
917 return SignExtend64<22>(((hi & 0x7ff) << 12) | // imm11 in getImplicitAddend()
918 ((lo & 0x7ff) << 1)); // imm11:0 in getImplicitAddend()
923 // Encoding B T4, BL T1, BLX T2: A = S:I1:I2:imm10:imm11:0 in getImplicitAddend()
927 return SignExtend64<24>(((hi & 0x0400) << 14) | // S in getImplicitAddend()
928 (~((lo ^ (hi << 3)) << 10) & 0x00800000) | // I1 in getImplicitAddend()
929 (~((lo ^ (hi << 1)) << 11) & 0x00400000) | // I2 in getImplicitAddend()
930 ((hi & 0x003ff) << 12) | // imm0 in getImplicitAddend()
931 ((lo & 0x007ff) << 1)); // imm11:0 in getImplicitAddend()
941 uint64_t val = read32(buf) & 0x000f0fff; in getImplicitAddend()
942 return SignExtend64<16>(((val & 0x000f0000) >> 4) | (val & 0x00fff)); in getImplicitAddend()
953 return SignExtend64<16>(((hi & 0x000f) << 12) | // imm4 in getImplicitAddend()
954 ((hi & 0x0400) << 1) | // i in getImplicitAddend()
955 ((lo & 0x7000) >> 4) | // imm3 in getImplicitAddend()
956 (lo & 0x00ff)); // imm8 in getImplicitAddend()
962 return read16(buf) & 0xff; in getImplicitAddend()
973 uint32_t val = rotr32(instr & 0xff, ((instr & 0xf00) >> 8) * 2); in getImplicitAddend()
974 return (instr & 0x00400000) ? -val : val; in getImplicitAddend()
981 bool u = read32(buf) & 0x00800000; in getImplicitAddend()
982 uint32_t imm12 = read32(buf) & 0xfff; in getImplicitAddend()
990 bool u = opcode & 0x00800000; in getImplicitAddend()
991 uint32_t imm4l = opcode & 0xf; in getImplicitAddend()
992 uint32_t imm4h = (opcode & 0xf00) >> 4; in getImplicitAddend()
1001 uint64_t imm = (hi & 0x0400) << 1 | // i in getImplicitAddend()
1002 (lo & 0x7000) >> 4 | // imm3 in getImplicitAddend()
1003 (lo & 0x00ff); // imm8 in getImplicitAddend()
1005 return (hi & 0x00f0) ? -imm : imm; in getImplicitAddend()
1010 // from an unsigned field using expression (((imm8:00 + 4) & 0x3ff) – 4) in getImplicitAddend()
1011 // this trick permits the PC bias of -4 to be encoded using imm8 = 0xff in getImplicitAddend()
1012 return ((((read16(buf) & 0xff) << 2) + 4) & 0x3ff) - 4; in getImplicitAddend()
1015 bool u = read16(buf) & 0x0080; in getImplicitAddend()
1016 uint64_t imm12 = read16(buf + 2) & 0x0fff; in getImplicitAddend()
1023 return 0; in getImplicitAddend()
1043 SmallVector<const Defined *, 0> &mapSyms = kv.second; in sortArmMappingSymbols()
1105 SmallVector<const Defined *, 0> &mapSyms = sectionMap[sec]; in convertArmInstructionstoBE8()
1111 uint64_t start = 0, width = 0, size = sec->getSize(); in convertArmInstructionstoBE8()
1187 // Error for local symbols. The symbol at index 0 is LOCAL. So skip it. in importCmseSymbols()
1198 memset(sym, 0, sizeof(Symbol)); in importCmseSymbols()
1305 for (size_t i = 0, e = syms.size(); i != e; ++i) { in processArmCmseSymbols()
1323 uint64_t offset = 0;
1385 write16(p + 0, 0xe97f); // SG in writeTo()
1386 write16(p + 2, 0xe97f); in writeTo()
1387 write16(p + 4, 0xf000); // B.W S in writeTo()
1388 write16(p + 6, 0xb000); in writeTo()
1396 addSyntheticLocal("$t", STT_NOTYPE, /*off=*/0, /*size=*/0, *this); in addMappingSymbol()
1401 return (impLibMaxAddr ? impLibMaxAddr - getVA() : 0) + newEntries * entsize; in getSize()
1427 for (size_t i = 0; i < sgVeneers.size(); ++i) { in finalizeContents()
1449 SmallVector<std::pair<OutputSection *, SyntheticSection *>, 0> osIsPairs; in writeARMCmseImportLib()
1450 osIsPairs.emplace_back(make<OutputSection>(strtab->name, 0, 0), strtab); in writeARMCmseImportLib()
1451 osIsPairs.emplace_back(make<OutputSection>(impSymTab->name, 0, 0), impSymTab); in writeARMCmseImportLib()
1452 osIsPairs.emplace_back(make<OutputSection>(shstrtab->name, 0, 0), shstrtab); in writeARMCmseImportLib()
1463 /*stOther=*/0, STT_FUNC, d->getVA(), d->getSize(), nullptr)); in writeARMCmseImportLib()
1466 size_t idx = 0; in writeARMCmseImportLib()
1484 config->mmapOutputFile ? 0 : (unsigned)FileOutputBuffer::F_no_mmap; in writeARMCmseImportLib()
1500 eHdr->e_entry = 0; in writeARMCmseImportLib()
1506 eHdr->e_ident[EI_ABIVERSION] = 0; in writeARMCmseImportLib()
1511 eHdr->e_phnum = 0; in writeARMCmseImportLib()
1513 eHdr->e_phoff = 0; in writeARMCmseImportLib()
1514 eHdr->e_phentsize = 0; in writeARMCmseImportLib()