Merge pull request #435 from NixOS/ci

add workaround for readelf from binutils 2.30
This commit is contained in:
Jörg Thalheim 2022-11-06 14:03:23 +01:00 committed by GitHub
commit 78a2a707e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -764,7 +764,11 @@ void ElfFile<ElfFileParamNames>::rewriteSectionsLibrary()
Elf_Off startOffset = roundUp(fileContents->size(), getPageSize());
fileContents->resize(startOffset + neededSpace, 0);
// In older version of binutils (2.30), readelf would check if the dynamic
// section segment is strictly smaller than the file (and not same size).
// By making it one byte larger, we don't break readelf.
off_t binutilsQuirkPadding = 1;
fileContents->resize(startOffset + neededSpace + binutilsQuirkPadding, 0);
/* Even though this file is of type ET_DYN, it could actually be
an executable. For instance, Gold produces executables marked