| 538 | |
| 539 | template <class Types> |
| 540 | std::vector<char> cmELFInternalImpl<Types>::EncodeDynamicEntries( |
| 541 | cmELF::DynamicEntryList const& entries) |
| 542 | { |
| 543 | std::vector<char> result; |
| 544 | result.reserve(sizeof(ELF_Dyn) * entries.size()); |
| 545 | |
| 546 | for (auto const& entry : entries) { |
| 547 | // Store the entry in an ELF_Dyn, byteswap it, then serialize to chars |
| 548 | ELF_Dyn dyn; |
| 549 | dyn.d_tag = static_cast<tagtype>(entry.first); |
| 550 | dyn.d_un.d_val = static_cast<tagtype>(entry.second); |
| 551 | |
| 552 | if (this->NeedSwap) { |
| 553 | this->ByteSwap(dyn); |
| 554 | } |
| 555 | |
| 556 | char* pdyn = reinterpret_cast<char*>(&dyn); |
| 557 | cm::append(result, pdyn, pdyn + sizeof(ELF_Dyn)); |
| 558 | } |
| 559 | |
| 560 | return result; |
| 561 | } |
| 562 | |
| 563 | template <class Types> |
| 564 | cmELF::StringEntry const* cmELFInternalImpl<Types>::GetDynamicSectionString( |