summaryrefslogtreecommitdiff
path: root/src/patchelf.cc
diff options
context:
space:
mode:
authorBreno Rodrigues Guimaraes <brenorg@gmail.com>2023-02-22 07:18:28 -0300
committerBreno Rodrigues Guimaraes <brenorg@gmail.com>2023-02-22 07:18:28 -0300
commitaeb34c2cc9d473319f320db49cd20e7e9ea4bff8 (patch)
treecc4049afe9ba658df5b02c84a826f235dfbb3b68 /src/patchelf.cc
parent991bf3a4ff094e4d09b9bf72f058393ae44e4a94 (diff)
downloadpatchelf-aeb34c2cc9d473319f320db49cd20e7e9ea4bff8.tar.gz
Avoid <class ER> syntax in lambdas. Thats C++20
Diffstat (limited to 'src/patchelf.cc')
-rw-r--r--src/patchelf.cc20
1 files changed, 5 insertions, 15 deletions
diff --git a/src/patchelf.cc b/src/patchelf.cc
index a4388f9..db18837 100644
--- a/src/patchelf.cc
+++ b/src/patchelf.cc
@@ -2013,20 +2013,10 @@ void ElfFile<ElfFileParamNames>::rebuildGnuHashTable(span<char> strTab, span<Elf
if (versyms)
reorderSpan(versyms, old2new);
- auto fixRelocationTable = [&old2new, firstSymIdx, this] <class ER> (auto& hdr)
+ auto remapSymbolId = [&old2new, firstSymIdx] (auto& oldSymIdx)
{
- auto rela = getSectionSpan<ER>(hdr);
- for (auto& r : rela)
- {
- auto info = rdi(r.r_info);
- auto oldSymIdx = rel_getSymId(info);
- if (oldSymIdx >= firstSymIdx)
- {
- auto newSymIdx = old2new[oldSymIdx - firstSymIdx] + firstSymIdx;
- if (newSymIdx != oldSymIdx)
- wri(r.r_info, rel_setSymId(info, newSymIdx));
- }
- }
+ return oldSymIdx >= firstSymIdx ? old2new[oldSymIdx - firstSymIdx] + firstSymIdx
+ : oldSymIdx;
};
for (unsigned int i = 1; i < rdi(hdr()->e_shnum); ++i)
@@ -2034,9 +2024,9 @@ void ElfFile<ElfFileParamNames>::rebuildGnuHashTable(span<char> strTab, span<Elf
auto& shdr = shdrs.at(i);
auto shtype = rdi(shdr.sh_type);
if (shtype == SHT_REL)
- fixRelocationTable.template operator()<Elf_Rel>(shdr);
+ changeRelocTableSymIds<Elf_Rel>(shdr, remapSymbolId);
else if (shtype == SHT_RELA)
- fixRelocationTable.template operator()<Elf_Rela>(shdr);
+ changeRelocTableSymIds<Elf_Rela>(shdr, remapSymbolId);
}
// Update bloom filters