Implement mInsertBefore, for pre-.interp injection
[centaur.git] / src / main.c
index 991fe09423b20247cfc0a4765873f3707934d3d9..4467a2cbcc995887a7ba88f4a5100e687b66f387 100644 (file)
@@ -67,12 +67,16 @@ int main(int argc, char **argv)
 
     if (me) {
       printf("Model successfully loaded.\n");
-
       elfu_mCheck(me);
-      printf("Model checked.\n");
+      printf("Input model checked.\n");
 
-      elfu_mToElf(me, hOut.e);
+      if (opts.insertBeforeSz) {
+        elfu_mInsertBefore(me, opts.insertBeforeOffs, opts.insertBeforeSz);
+      }
 
+      elfu_mCheck(me);
+      printf("Output model checked.\n");
+      elfu_mToElf(me, hOut.e);
       printf("Model converted to ELF, ready to be written.\n");
     } else {
       printf("Failed to load model.\n");