-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
objtool: Add ORC unwind table generation
Now that objtool knows the states of all registers on the stack for each instruction, it's straightforward to generate debuginfo for an unwinder to use. Instead of generating DWARF, generate a new format called ORC, which is more suitable for an in-kernel unwinder. See Documentation/x86/orc-unwinder.txt for a more detailed description of this new debuginfo format and why it's preferable to DWARF. Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com> Cc: Andy Lutomirski <luto@kernel.org> Cc: Borislav Petkov <bp@alien8.de> Cc: Brian Gerst <brgerst@gmail.com> Cc: Denys Vlasenko <dvlasenk@redhat.com> Cc: H. Peter Anvin <hpa@zytor.com> Cc: Jiri Slaby <jslaby@suse.cz> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Mike Galbraith <efault@gmx.de> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: live-patching@vger.kernel.org Link: http://lkml.kernel.org/r/c9b9f01ba6c5ed2bdc9bb0957b78167fdbf9632e.1499786555.git.jpoimboe@redhat.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
- Loading branch information
Josh Poimboeuf
authored and
Ingo Molnar
committed
Jul 18, 2017
1 parent
5a3cf86
commit 627fce1
Showing
14 changed files
with
916 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
/* | ||
* Copyright (C) 2017 Josh Poimboeuf <jpoimboe@redhat.com> | ||
* | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU General Public License | ||
* as published by the Free Software Foundation; either version 2 | ||
* of the License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program; if not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
/* | ||
* objtool orc: | ||
* | ||
* This command analyzes a .o file and adds .orc_unwind and .orc_unwind_ip | ||
* sections to it, which is used by the in-kernel ORC unwinder. | ||
* | ||
* This command is a superset of "objtool check". | ||
*/ | ||
|
||
#include <string.h> | ||
#include <subcmd/parse-options.h> | ||
#include "builtin.h" | ||
#include "check.h" | ||
|
||
|
||
static const char *orc_usage[] = { | ||
"objtool orc generate [<options>] file.o", | ||
"objtool orc dump file.o", | ||
NULL, | ||
}; | ||
|
||
extern const struct option check_options[]; | ||
extern bool nofp; | ||
|
||
int cmd_orc(int argc, const char **argv) | ||
{ | ||
const char *objname; | ||
|
||
argc--; argv++; | ||
if (!strncmp(argv[0], "gen", 3)) { | ||
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, nofp, true); | ||
|
||
} | ||
|
||
if (!strcmp(argv[0], "dump")) { | ||
if (argc != 2) | ||
usage_with_options(orc_usage, check_options); | ||
|
||
objname = argv[1]; | ||
|
||
return orc_dump(objname); | ||
} | ||
|
||
usage_with_options(orc_usage, check_options); | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.