patchelf: fix compilation with GCC 7 (#40581)

This commit is contained in:
Harmen Stoppels 2023-10-17 20:12:09 +02:00 committed by GitHub
parent 8c257d55b4
commit a4ad365de0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 28 additions and 0 deletions

View file

@ -0,0 +1,25 @@
From 5fb5d82637c1b547b800b5994a1f5342b3224da4 Mon Sep 17 00:00:00 2001
From: Rosen Penev <rosenp@gmail.com>
Date: Sat, 12 Aug 2023 11:46:14 -0700
Subject: [PATCH] fix compilation with GCC7
CTAD is not working here.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
src/patchelf.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/patchelf.cc b/src/patchelf.cc
index 82b4b46c..d6000160 100644
--- a/src/patchelf.cc
+++ b/src/patchelf.cc
@@ -2069,7 +2069,7 @@ void ElfFile<ElfFileParamNames>::rebuildGnuHashTable(span<char> strTab, span<Elf
// all tables that refer to symbols through indexes in the symbol table
auto reorderSpan = [] (auto dst, auto& old2new)
{
- std::vector tmp(dst.begin(), dst.end());
+ std::vector<std::remove_reference_t<decltype(dst[0])>> tmp(dst.begin(), dst.end());
for (size_t i = 0; i < tmp.size(); ++i)
dst[old2new[i]] = tmp[i];
};

View file

@ -39,6 +39,9 @@ class Patchelf(AutotoolsPackage):
conflicts("%gcc@:6", when="@0.14:", msg="Requires C++17 support")
conflicts("%clang@:3", when="@0.14:", msg="Requires C++17 support")
# GCC 7.5 doesn't have __cpp_deduction_guides >= 201606
patch("513.patch", when="@0.18: %gcc@:7")
def url_for_version(self, version):
if version < Version("0.12"):
return "https://nixos.org/releases/patchelf/patchelf-{0}/patchelf-{1}.tar.gz".format(