X-Git-Url: https://git.enpas.org/?a=blobdiff_plain;f=src%2Foptions.c;h=c728d40ac2cf12ee6807cdd5a43dcdd835320d60;hb=350812f90222da942a914f5ca8fa577720ab5fe8;hp=55a91c553bfb219beef058c0c824ddc554194b5a;hpb=98e4a3d2f841bce726473d418e2a5b10e28806d7;p=centaur.git diff --git a/src/options.c b/src/options.c index 55a91c5..c728d40 100644 --- a/src/options.c +++ b/src/options.c @@ -14,11 +14,19 @@ static void printUsage(char *progname) " -h, --help Print this help message\n" " -o, --output Where to write the modified ELF file to\n" "\n" + "ELF dump:\n" " --print-header Print ELF header\n" " --print-segments Print program headers\n" " --print-sections Print sections\n" "\n" - " --insert-before off,sz Insert spacing at given offset\n" + "Space insertion:\n" + " off: File offset, not within any structure (headers or sections).\n" + " sz: A multiple of the maximum alignment of all PHDRs.\n" + "\n" + " --insert-before off,sz Insert spacing at given offset,\n" + " mapping everything before it to lower mem addresses.\n" + " --insert-after off,sz Insert spacing at given offset,\n" + " mapping everything after it to higher mem addresses.\n" "\n"); } @@ -38,6 +46,7 @@ void parseOptions(CLIOpts *opts, int argc, char **argv) {"print-segments", 0, 0, 10002}, {"print-sections", 0, 0, 10003}, {"insert-before", 1, 0, 10004}, + {"insert-after", 1, 0, 10005}, {NULL, 0, NULL, 0} }; @@ -69,6 +78,16 @@ void parseOptions(CLIOpts *opts, int argc, char **argv) goto USAGE; } break; + case 10005: + opts->insertAfterOffs = strtoul(optarg, &endptr, 0); + if (endptr[0] != ',') { + goto USAGE; + } + opts->insertAfterSz = strtoul(endptr + 1, &endptr, 0); + if (endptr[0] != '\0' || opts->insertAfterSz == 0) { + goto USAGE; + } + break; case '?': default: goto USAGE;