firefox-nightly-bin: drop patchelf hack

Now included in nixpkgs proper
This commit is contained in:
K900 2023-09-29 12:01:11 +03:00 коммит произвёл Nicolas B. Pierron
Родитель 6eabade97b
Коммит 9b11a87c0c
3 изменённых файлов: 0 добавлений и 86 удалений

Просмотреть файл

@ -149,11 +149,6 @@ let
}).overrideAttrs (old: {
# Add a dependency on the signature check.
src = fetchVersion info;
# inject hacked up patchelf to not break binaries
nativeBuildInputs = old.nativeBuildInputs or [] ++ [
(self.callPackage ./pkgs/patchelf {})
];
}));
in super.wrapFirefox pkg {
pname = "${pkg.binaryName}-bin";

Просмотреть файл

@ -1,16 +0,0 @@
{ stdenv, patchelf, makeWrapper }:
let
patchelf' = patchelf.overrideAttrs(old: {
patches = old.patches or [] ++ [ ./no-clobber-old-sections.patch ];
});
in stdenv.mkDerivation {
pname = "patchelf-wrapped";
inherit (patchelf) version;
nativeBuildInputs = [ makeWrapper ];
buildCommand = ''
mkdir -p $out/bin
makeWrapper ${patchelf'}/bin/patchelf $out/bin/patchelf --add-flags "--no-clobber-old-sections"
'';
}

Просмотреть файл

@ -1,65 +0,0 @@
commit 19f7cd70f717b386e564a3e8453339cd46b07df0
Author: K900 <me@0upti.me>
Date: Thu Sep 21 18:20:53 2023 +0300
feat: add --no-clobber-old-sections switch
Works around #520, may be useful for other cursed self-modifying things.
This is a backport to 0.15.0.
diff --git a/src/patchelf.cc b/src/patchelf.cc
index 49accae..1aec5f4 100644
--- a/src/patchelf.cc
+++ b/src/patchelf.cc
@@ -55,6 +55,7 @@
static bool debugMode = false;
static bool forceRPath = false;
+static bool clobberOldSections = true;
static std::vector<std::string> fileNames;
static std::string outputFileName;
@@ -536,14 +537,16 @@ template<ElfFileParams>
void ElfFile<ElfFileParamNames>::writeReplacedSections(Elf_Off & curOff,
Elf_Addr startAddr, Elf_Off startOffset)
{
- /* Overwrite the old section contents with 'X's. Do this
- *before* writing the new section contents (below) to prevent
- clobbering previously written new section contents. */
- for (auto & i : replacedSections) {
- const std::string & sectionName = i.first;
- Elf_Shdr & shdr = findSectionHeader(sectionName);
- if (rdi(shdr.sh_type) != SHT_NOBITS)
- memset(fileContents->data() + rdi(shdr.sh_offset), 'X', rdi(shdr.sh_size));
+ if (clobberOldSections) {
+ /* Overwrite the old section contents with 'X's. Do this
+ *before* writing the new section contents (below) to prevent
+ clobbering previously written new section contents. */
+ for (auto & i : replacedSections) {
+ const std::string & sectionName = i.first;
+ Elf_Shdr & shdr = findSectionHeader(sectionName);
+ if (rdi(shdr.sh_type) != SHT_NOBITS)
+ memset(fileContents->data() + rdi(shdr.sh_offset), 'X', rdi(shdr.sh_size));
+ }
}
std::set<unsigned int> noted_phdrs = {};
@@ -1856,6 +1859,7 @@ void showHelp(const std::string & progName)
[--no-sort]\t\tDo not sort program+section headers; useful for debugging patchelf.\n\
[--clear-symbol-version SYMBOL]\n\
[--add-debug-tag]\n\
+ [--no-clobber-old-sections]\t\tDo not clobber old section values - only use when executable does self-referential tricks.\n\
[--output FILE]\n\
[--debug]\n\
[--version]\n\
@@ -1970,6 +1974,9 @@ int mainWrapped(int argc, char * * argv)
else if (arg == "--add-debug-tag") {
addDebugTag = true;
}
+ else if (arg == "--no-clobber-old-sections") {
+ clobberOldSections = false;
+ }
else if (arg == "--help" || arg == "-h" ) {
showHelp(argv[0]);
return 0;