| 536 | } |
| 537 | |
| 538 | Error CodeHolder::newRelocEntry(RelocEntry** dst, uint32_t type, uint32_t size) noexcept { |
| 539 | ASMJIT_PROPAGATE(_relocations.willGrow(&_baseHeap)); |
| 540 | |
| 541 | size_t index = _relocations.getLength(); |
| 542 | if (ASMJIT_UNLIKELY(index > size_t(0xFFFFFFFFU))) |
| 543 | return DebugUtils::errored(kErrorRelocIndexOverflow); |
| 544 | |
| 545 | RelocEntry* re = _baseHeap.allocZeroedT<RelocEntry>(); |
| 546 | if (ASMJIT_UNLIKELY(!re)) |
| 547 | return DebugUtils::errored(kErrorNoHeapMemory); |
| 548 | |
| 549 | re->_id = static_cast<uint32_t>(index); |
| 550 | re->_type = static_cast<uint8_t>(type); |
| 551 | re->_size = static_cast<uint8_t>(size); |
| 552 | re->_sourceSectionId = SectionEntry::kInvalidId; |
| 553 | re->_targetSectionId = SectionEntry::kInvalidId; |
| 554 | _relocations.appendUnsafe(re); |
| 555 | |
| 556 | *dst = re; |
| 557 | return kErrorOk; |
| 558 | } |
| 559 | |
| 560 | // TODO: Support multiple sections, this only relocates the first. |
| 561 | // TODO: This should go to Runtime as it's responsible for relocating the |
no test coverage detected