Skip to content

Instantly share code, notes, and snippets.

@bartosh
Created July 21, 2017 07:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bartosh/aacbdc5140149e408e3639f1edc60fca to your computer and use it in GitHub Desktop.
Save bartosh/aacbdc5140149e408e3639f1edc60fca to your computer and use it in GitHub Desktop.
patchelf.cc.diff
diff --git a/src/patchelf.cc b/src/patchelf.cc
index 55b38e3..7196908 100644
--- a/src/patchelf.cc
+++ b/src/patchelf.cc
@@ -721,10 +721,8 @@ void ElfFile<ElfFileParamNames>::rewriteSectionsLibrary()
since DYN executables tend to start at virtual address 0, so
rewriteSectionsExecutable() won't work because it doesn't have
any virtual address space to grow downwards into. */
- if (isExecutable) {
- if (startOffset >= startPage) {
- debug("shifting new PT_LOAD segment by %d bytes to work around a Linux kernel bug\n", startOffset - startPage);
- }
+ if (isExecutable && startOffset > startPage) {
+ debug("shifting new PT_LOAD segment by %d bytes to work around a Linux kernel bug\n", startOffset - startPage);
startPage = startOffset;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment