Merge tag 'xfs-5.10-merge-5' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux
[linux-2.6-microblaze.git] / tools / objtool / builtin-orc.c
index b1dfe20..7b31121 100644 (file)
@@ -31,13 +31,38 @@ int cmd_orc(int argc, const char **argv)
                usage_with_options(orc_usage, check_options);
 
        if (!strncmp(argv[0], "gen", 3)) {
+               struct objtool_file *file;
+               int ret;
+
                argc = parse_options(argc, argv, check_options, orc_usage, 0);
                if (argc != 1)
                        usage_with_options(orc_usage, check_options);
 
                objname = argv[0];
 
-               return check(objname, true);
+               file = objtool_open_read(objname);
+               if (!file)
+                       return 1;
+
+               ret = check(file);
+               if (ret)
+                       return ret;
+
+               if (list_empty(&file->insn_list))
+                       return 0;
+
+               ret = create_orc(file);
+               if (ret)
+                       return ret;
+
+               ret = create_orc_sections(file);
+               if (ret)
+                       return ret;
+
+               if (!file->elf->changed)
+                       return 0;
+
+               return elf_write(file->elf);
        }
 
        if (!strcmp(argv[0], "dump")) {