Skip to content

Commit

Permalink
Make E9Tool accept -CFR' as alternative to -X'
Browse files Browse the repository at this point in the history
CFR = Control Flow Recovery
  • Loading branch information
GJDuck committed Mar 15, 2023
1 parent 7542796 commit edd845b
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 17 deletions.
2 changes: 1 addition & 1 deletion doc/e9compile.1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.TH E9COMPILE "1" "June 2022" "E9Compile" "E9Compile"
.TH E9COMPILE "1" "April 2023" "E9Compile" "E9Compile"
.SH NAME
E9Compile \- E9Tool instrumentation compiler
.SH SYNOPSIS
Expand Down
2 changes: 1 addition & 1 deletion doc/e9patch.1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.TH E9PATCH "1" "June 2022" "E9Patch" "E9Patch"
.TH E9PATCH "1" "April 2023" "E9Patch" "E9Patch"
.SH NAME
E9Patch \- a powerful static binary rewriting tool
.SH SYNOPSIS
Expand Down
12 changes: 6 additions & 6 deletions doc/e9tool.1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.TH E9TOOL "1" "June 2022" "E9Tool" "E9Tool"
.TH E9TOOL "1" "April 2023" "E9Tool" "E9Tool"
.SH NAME
E9Tool \- a powerful static binary rewriting tool
.SH SYNOPSIS
Expand Down Expand Up @@ -105,6 +105,11 @@ For more information, please refer to the following document:
.IP "\fB\-\-backend\fR PROG" 4
Use PROG as the backend.
The default is "e9patch".
.IP "\fB\-CFR\fr, \fB\-X\fR" 4
Enables binary rewriting "with" control-flow recovery. This
usually makes the rewritten binary much faster, but may
introduce rewriting bugs if the built-in recovery analysis is
inaccurate.
.IP "\fB\-\-compression\fR N, \fB\-c\fR N" 4
Set the compression level to be N, where N is a number within
the range 0..9. The default is 9 for maximum compression.
Expand Down Expand Up @@ -215,11 +220,6 @@ optional second column is 1 for call targets (functions), or
0 otherwise (the default is 0).
.IP "\fB\-\-version\fR" 4
Print the version and exit.
.IP "\fB\-X\fR" 4
Enables binary rewriting "with" control-flow recovery. This
usually makes the rewritten binary much faster, but may
introduce rewriting bugs if the built-in recovery analysis is
inaccurate.
.SH "SEE ALSO"
\fIe9patch\fR(1), \fIe9compile\fR(1), \fIe9afl\fR(1), \fIredfat\fR(1)
.SH AUTHOR
Expand Down
12 changes: 6 additions & 6 deletions src/e9tool/e9misc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,12 @@ void usage(FILE *stream, const char *progname)
"\t--backend PROG\n"
"\t\tUse PROG as the backend. The default is \"e9patch\".\n"
"\n"
"\t-CFR, -X\n"
"\t\tEnables binary rewriting \"with\" control-flow recovery. This\n"
"\t\tusually makes the rewritten binary much faster, but may\n"
"\t\tintroduce rewriting bugs if the built-in recovery analysis is\n"
"\t\tinaccurate.\n"
"\n"
"\t--compression N, -c N\n"
"\t\tSet the compression level to be N, where N is a number within\n"
"\t\tthe range 0..9. The default is 9 for maximum compression.\n"
Expand Down Expand Up @@ -344,12 +350,6 @@ void usage(FILE *stream, const char *progname)
"\n"
"\t--version\n"
"\t\tPrint the version and exit.\n"
"\n"
"\t-X\n"
"\t\tEnables binary rewriting \"with\" control-flow recovery. This\n"
"\t\tusually makes the rewritten binary much faster, but may\n"
"\t\tintroduce rewriting bugs if the built-in recovery analysis is\n"
"\t\tinaccurate.\n"
"\n", progname);
}

9 changes: 6 additions & 3 deletions src/e9tool/e9tool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -653,6 +653,7 @@ static void checkCompatible(const ELF &elf, const ELF &target)
enum Option
{
OPTION_BACKEND,
OPTION_CFR,
OPTION_COMPRESSION,
OPTION_DSYNC,
OPTION_DTHRESHOLD,
Expand Down Expand Up @@ -729,6 +730,7 @@ int main_2(int argc, char **argv)
static const struct option long_options[] =
{
{"backend", req_arg, nullptr, OPTION_BACKEND},
{"CFR", no_arg, nullptr, OPTION_CFR},
{"compression", req_arg, nullptr, OPTION_COMPRESSION},
{"Dsync", req_arg, nullptr, OPTION_DSYNC},
{"Dthreshold", req_arg, nullptr, OPTION_DTHRESHOLD},
Expand Down Expand Up @@ -787,6 +789,10 @@ int main_2(int argc, char **argv)
case OPTION_BACKEND:
option_backend = optarg;
break;
case OPTION_CFR:
case 'X':
option_CFR = true;
break;
case OPTION_COMPRESSION:
case 'c':
option_compression_level = (unsigned)parseIntOptArg(
Expand Down Expand Up @@ -938,9 +944,6 @@ int main_2(int argc, char **argv)
case OPTION_VERSION:
puts("E9Tool " STRING(VERSION));
return EXIT_SUCCESS;
case 'X':
option_CFR = true;
break;
default:
error("failed to parse command-line options; try `--help' "
"for more information");
Expand Down

0 comments on commit edd845b

Please sign in to comment.