| 467 | |
| 468 | template <class Types> |
| 469 | bool cmELFInternalImpl<Types>::LoadDynamicSection() |
| 470 | { |
| 471 | // If there is no dynamic section we are done. |
| 472 | if (!this->HasDynamicSection()) { |
| 473 | return false; |
| 474 | } |
| 475 | |
| 476 | // If the section was already loaded we are done. |
| 477 | if (!this->DynamicSectionEntries.empty()) { |
| 478 | return true; |
| 479 | } |
| 480 | |
| 481 | // If there are no entries we are done. |
| 482 | ELF_Shdr const& sec = this->SectionHeaders[this->DynamicSectionIndex]; |
| 483 | if (sec.sh_entsize == 0) { |
| 484 | return false; |
| 485 | } |
| 486 | |
| 487 | // Allocate the dynamic section entries. |
| 488 | int n = static_cast<int>(sec.sh_size / sec.sh_entsize); |
| 489 | this->DynamicSectionEntries.resize(n); |
| 490 | |
| 491 | // Read each entry. |
| 492 | for (int j = 0; j < n; ++j) { |
| 493 | // Seek to the beginning of the section entry. |
| 494 | this->Stream->seekg(sec.sh_offset + sec.sh_entsize * j); |
| 495 | ELF_Dyn& dyn = this->DynamicSectionEntries[j]; |
| 496 | |
| 497 | // Try reading the entry. |
| 498 | if (!this->Read(dyn)) { |
| 499 | this->SetErrorMessage("Error reading entry from DYNAMIC section."); |
| 500 | this->DynamicSectionIndex = -1; |
| 501 | return false; |
| 502 | } |
| 503 | } |
| 504 | return true; |
| 505 | } |
| 506 | |
| 507 | template <class Types> |
| 508 | unsigned long cmELFInternalImpl<Types>::GetDynamicEntryPosition(int j) |
no test coverage detected