diff options
| author | Josh Poimboeuf <jpoimboe@kernel.org> | 2025-03-14 12:29:07 -0700 |
|---|---|---|
| committer | Peter Zijlstra <peterz@infradead.org> | 2025-03-17 11:36:01 +0100 |
| commit | 5a406031d0719d146d2033ee4270310b1ca9a1e3 (patch) | |
| tree | 4df3c743470970860b84a076187c45bbf9357697 /tools/objtool/orc_dump.c | |
| parent | fdf5ff2934f4c5c6b483c906fea6e0288df36da2 (diff) | |
| download | linux-next-5a406031d0719d146d2033ee4270310b1ca9a1e3.tar.gz linux-next-5a406031d0719d146d2033ee4270310b1ca9a1e3.zip | |
objtool: Add --output option
Add option to allow writing the changed binary to a separate file rather
than changing it in place.
Libelf makes this suprisingly hard, so take the easy way out and just
copy the file before editing it.
Also steal the -o short option from --orc. Nobody will notice ;-)
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lore.kernel.org/r/0da308d42d82b3bbed16a31a72d6bde52afcd6bd.1741975349.git.jpoimboe@kernel.org
Diffstat (limited to 'tools/objtool/orc_dump.c')
| -rw-r--r-- | tools/objtool/orc_dump.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/tools/objtool/orc_dump.c b/tools/objtool/orc_dump.c index a62247efb64f..05ef0e297837 100644 --- a/tools/objtool/orc_dump.c +++ b/tools/objtool/orc_dump.c @@ -10,7 +10,7 @@ #include <objtool/warn.h> #include <objtool/endianness.h> -int orc_dump(const char *_objname) +int orc_dump(const char *filename) { int fd, nr_entries, i, *orc_ip = NULL, orc_size = 0; struct orc_entry *orc = NULL; @@ -26,12 +26,9 @@ int orc_dump(const char *_objname) Elf_Data *data, *symtab = NULL, *rela_orc_ip = NULL; struct elf dummy_elf = {}; - - objname = _objname; - elf_version(EV_CURRENT); - fd = open(objname, O_RDONLY); + fd = open(filename, O_RDONLY); if (fd == -1) { perror("open"); return -1; |
