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