Merge tag 'kernel-clone-v5.9' of git://git.kernel.org/pub/scm/linux/kernel/git/braune...
[linux-2.6-microblaze.git] / tools / objtool / builtin-check.c
index 7a44174..c6d199b 100644 (file)
@@ -41,6 +41,8 @@ const struct option check_options[] = {
 int cmd_check(int argc, const char **argv)
 {
        const char *objname, *s;
+       struct objtool_file *file;
+       int ret;
 
        argc = parse_options(argc, argv, check_options, check_usage, 0);
 
@@ -53,5 +55,16 @@ int cmd_check(int argc, const char **argv)
        if (s && !s[9])
                vmlinux = true;
 
-       return check(objname, false);
+       file = objtool_open_read(objname);
+       if (!file)
+               return 1;
+
+       ret = check(file);
+       if (ret)
+               return ret;
+
+       if (file->elf->changed)
+               return elf_write(file->elf);
+
+       return 0;
 }