Skip to content

Commit

Permalink
Merge pull request #435 from NixOS/ci
Browse files Browse the repository at this point in the history
add workaround for readelf from binutils 2.30
  • Loading branch information
Mic92 authored Nov 6, 2022
2 parents ba47f65 + 19c1a2f commit 78a2a70
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/patchelf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 78a2a70

Please sign in to comment.