Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
fork

Configure Feed

Select the types of activity you want to include in your feed.

at v5.15 73 lines 1.3 kB view raw
1// SPDX-License-Identifier: GPL-2.0-or-later 2/* 3 * Copyright (C) 2017 Josh Poimboeuf <jpoimboe@redhat.com> 4 */ 5 6/* 7 * objtool orc: 8 * 9 * This command analyzes a .o file and adds .orc_unwind and .orc_unwind_ip 10 * sections to it, which is used by the in-kernel ORC unwinder. 11 * 12 * This command is a superset of "objtool check". 13 */ 14 15#include <string.h> 16#include <objtool/builtin.h> 17#include <objtool/objtool.h> 18 19static const char *orc_usage[] = { 20 "objtool orc generate [<options>] file.o", 21 "objtool orc dump file.o", 22 NULL, 23}; 24 25int cmd_orc(int argc, const char **argv) 26{ 27 const char *objname; 28 29 argc--; argv++; 30 if (argc <= 0) 31 usage_with_options(orc_usage, check_options); 32 33 if (!strncmp(argv[0], "gen", 3)) { 34 struct objtool_file *file; 35 int ret; 36 37 argc = cmd_parse_options(argc, argv, orc_usage); 38 objname = argv[0]; 39 40 file = objtool_open_read(objname); 41 if (!file) 42 return 1; 43 44 ret = check(file); 45 if (ret) 46 return ret; 47 48 if (list_empty(&file->insn_list)) 49 return 0; 50 51 ret = orc_create(file); 52 if (ret) 53 return ret; 54 55 if (!file->elf->changed) 56 return 0; 57 58 return elf_write(file->elf); 59 } 60 61 if (!strcmp(argv[0], "dump")) { 62 if (argc != 2) 63 usage_with_options(orc_usage, check_options); 64 65 objname = argv[1]; 66 67 return orc_dump(objname); 68 } 69 70 usage_with_options(orc_usage, check_options); 71 72 return 0; 73}