summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFelipe Sateler <fsateler@debian.org>2016-01-15 01:56:04 (GMT)
committerFelipe Sateler <fsateler@debian.org>2016-01-15 01:57:28 (GMT)
commit20ccc36b9cdb4119fe326724bfee70d1619e31ee (patch)
tree0a48ed13aff026d9c2459fb673f0616decfd4493 /src
parent5c5026e572e36358b170d15a9451e6a471d710b6 (diff)
downloadpatchelf-20ccc36b9cdb4119fe326724bfee70d1619e31ee.zip
patchelf-20ccc36b9cdb4119fe326724bfee70d1619e31ee.tar.gz
patchelf-20ccc36b9cdb4119fe326724bfee70d1619e31ee.tar.bz2
Allow overriding pagesize at runtime via a command-line argument
Diffstat (limited to 'src')
-rw-r--r--src/patchelf.cc10
1 files changed, 8 insertions, 2 deletions
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;
}