Object file injection, first part
[centaur.git] / src / options.c
index c728d40ac2cf12ee6807cdd5a43dcdd835320d60..928d080d60703aeb4ce9461010d5b1976dc0dde3 100644 (file)
@@ -23,10 +23,14 @@ static void printUsage(char *progname)
           "    off: File offset, not within any structure (headers or sections).\n"
           "    sz:  A multiple of the maximum alignment of all PHDRs.\n"
           "\n"
+          "      --expand-nobits off        Expand virtual areas (NOBITS sections and similar PHDRs).\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"
+          "High-level insertion:\n"
+          "      --reladd        obj.o      Automatically insert object file contents\n"
           "\n");
 }
 
@@ -47,6 +51,8 @@ void parseOptions(CLIOpts *opts, int argc, char **argv)
     {"print-sections", 0, 0, 10003},
     {"insert-before", 1, 0, 10004},
     {"insert-after", 1, 0, 10005},
+    {"expand-nobits", 1, 0, 10006},
+    {"reladd", 1, 0, 10007},
     {NULL, 0, NULL, 0}
   };
 
@@ -88,6 +94,15 @@ void parseOptions(CLIOpts *opts, int argc, char **argv)
           goto USAGE;
         }
         break;
+      case 10006:
+        opts->expandNobitsOffs = strtoul(optarg, &endptr, 0);
+        if (endptr[0] != '\0' || opts->expandNobitsOffs < 1) {
+          goto USAGE;
+        }
+        break;
+      case 10007:
+        opts->fnReladd = optarg;
+        break;
       case '?':
       default:
         goto USAGE;