| 1121 | } |
| 1122 | |
| 1123 | size_t CodeHolder::code_size() const noexcept { |
| 1124 | Support::FastUInt8 of = 0; |
| 1125 | uint64_t offset = 0; |
| 1126 | |
| 1127 | for (Section* section : _sections_by_order) { |
| 1128 | uint64_t real_size = section->real_size(); |
| 1129 | |
| 1130 | if (real_size) { |
| 1131 | uint64_t aligned_offset = Support::align_up(offset, section->alignment()); |
| 1132 | ASMJIT_ASSERT(aligned_offset >= offset); |
| 1133 | offset = Support::add_overflow(aligned_offset, real_size, &of); |
| 1134 | } |
| 1135 | } |
| 1136 | |
| 1137 | if ((sizeof(uint64_t) > sizeof(size_t) && offset > uint64_t(SIZE_MAX)) || of) { |
| 1138 | return SIZE_MAX; |
| 1139 | } |
| 1140 | |
| 1141 | return size_t(offset); |
| 1142 | } |
| 1143 | |
| 1144 | Error CodeHolder::relocate_to_base(uint64_t base_address, RelocationSummary* summary_out) noexcept { |
| 1145 | // Make sure `summary_out` pointer is always valid as we want to fill it. |