summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--patchelf.13
-rw-r--r--src/patchelf.cc10
2 files changed, 11 insertions, 2 deletions
diff --git a/patchelf.1 b/patchelf.1
index 92e1729..8067dff 100644
--- a/patchelf.1
+++ b/patchelf.1
@@ -22,6 +22,9 @@ of executables and change the RPATH of executables and libraries.
The single option given operates on a given FILE, editing in place.
+.IP "--page-size SIZE"
+Uses the given page size instead of the default.
+
.IP "--set-interpreter INTERPRETER"
Change the dynamic loader ("ELF interpreter") of executable given to
INTERPRETER.
diff --git a/src/patchelf.cc b/src/patchelf.cc
index e4bb084..0831f62 100644
--- a/src/patchelf.cc
+++ b/src/patchelf.cc
@@ -29,7 +29,7 @@ static bool debugMode = false;
static bool forceRPath = false;
static string fileName;
-
+static int pageSize = PAGESIZE;
off_t fileSize, maxSize;
unsigned char * contents = 0;
@@ -40,7 +40,7 @@ unsigned char * contents = 0;
static unsigned int getPageSize(){
- return PAGESIZE;
+ return pageSize;
}
@@ -1472,6 +1472,7 @@ void showHelp(const string & progName)
{
fprintf(stderr, "syntax: %s\n\
[--set-interpreter FILENAME]\n\
+ [--page-size SIZE]\n\
[--print-interpreter]\n\
[--print-soname]\t\tPrints 'DT_SONAME' entry of .dynamic section. Raises an error if DT_SONAME doesn't exist\n\
[--set-soname SONAME]\t\tSets 'DT_SONAME' entry to SONAME.\n\
@@ -1507,6 +1508,11 @@ int main(int argc, char * * argv)
if (++i == argc) error("missing argument");
newInterpreter = argv[i];
}
+ else if (arg == "--page-size") {
+ if (++i == argc) error("missing argument");
+ pageSize = atoi(argv[i]);
+ if (pageSize <= 0) error("invalid argument to --page-size");
+ }
else if (arg == "--print-interpreter") {
printInterpreter = true;
}