Skip to content

Commit edd845b

Browse files
committed
Make E9Tool accept -CFR' as alternative to -X'
CFR = Control Flow Recovery
1 parent 7542796 commit edd845b

5 files changed

Lines changed: 20 additions & 17 deletions

File tree

doc/e9compile.1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.TH E9COMPILE "1" "June 2022" "E9Compile" "E9Compile"
1+
.TH E9COMPILE "1" "April 2023" "E9Compile" "E9Compile"
22
.SH NAME
33
E9Compile \- E9Tool instrumentation compiler
44
.SH SYNOPSIS

doc/e9patch.1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.TH E9PATCH "1" "June 2022" "E9Patch" "E9Patch"
1+
.TH E9PATCH "1" "April 2023" "E9Patch" "E9Patch"
22
.SH NAME
33
E9Patch \- a powerful static binary rewriting tool
44
.SH SYNOPSIS

doc/e9tool.1

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.TH E9TOOL "1" "June 2022" "E9Tool" "E9Tool"
1+
.TH E9TOOL "1" "April 2023" "E9Tool" "E9Tool"
22
.SH NAME
33
E9Tool \- a powerful static binary rewriting tool
44
.SH SYNOPSIS
@@ -105,6 +105,11 @@ For more information, please refer to the following document:
105105
.IP "\fB\-\-backend\fR PROG" 4
106106
Use PROG as the backend.
107107
The default is "e9patch".
108+
.IP "\fB\-CFR\fr, \fB\-X\fR" 4
109+
Enables binary rewriting "with" control-flow recovery. This
110+
usually makes the rewritten binary much faster, but may
111+
introduce rewriting bugs if the built-in recovery analysis is
112+
inaccurate.
108113
.IP "\fB\-\-compression\fR N, \fB\-c\fR N" 4
109114
Set the compression level to be N, where N is a number within
110115
the range 0..9. The default is 9 for maximum compression.
@@ -215,11 +220,6 @@ optional second column is 1 for call targets (functions), or
215220
0 otherwise (the default is 0).
216221
.IP "\fB\-\-version\fR" 4
217222
Print the version and exit.
218-
.IP "\fB\-X\fR" 4
219-
Enables binary rewriting "with" control-flow recovery. This
220-
usually makes the rewritten binary much faster, but may
221-
introduce rewriting bugs if the built-in recovery analysis is
222-
inaccurate.
223223
.SH "SEE ALSO"
224224
\fIe9patch\fR(1), \fIe9compile\fR(1), \fIe9afl\fR(1), \fIredfat\fR(1)
225225
.SH AUTHOR

src/e9tool/e9misc.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,12 @@ void usage(FILE *stream, const char *progname)
226226
"\t--backend PROG\n"
227227
"\t\tUse PROG as the backend. The default is \"e9patch\".\n"
228228
"\n"
229+
"\t-CFR, -X\n"
230+
"\t\tEnables binary rewriting \"with\" control-flow recovery. This\n"
231+
"\t\tusually makes the rewritten binary much faster, but may\n"
232+
"\t\tintroduce rewriting bugs if the built-in recovery analysis is\n"
233+
"\t\tinaccurate.\n"
234+
"\n"
229235
"\t--compression N, -c N\n"
230236
"\t\tSet the compression level to be N, where N is a number within\n"
231237
"\t\tthe range 0..9. The default is 9 for maximum compression.\n"
@@ -344,12 +350,6 @@ void usage(FILE *stream, const char *progname)
344350
"\n"
345351
"\t--version\n"
346352
"\t\tPrint the version and exit.\n"
347-
"\n"
348-
"\t-X\n"
349-
"\t\tEnables binary rewriting \"with\" control-flow recovery. This\n"
350-
"\t\tusually makes the rewritten binary much faster, but may\n"
351-
"\t\tintroduce rewriting bugs if the built-in recovery analysis is\n"
352-
"\t\tinaccurate.\n"
353353
"\n", progname);
354354
}
355355

src/e9tool/e9tool.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -653,6 +653,7 @@ static void checkCompatible(const ELF &elf, const ELF &target)
653653
enum Option
654654
{
655655
OPTION_BACKEND,
656+
OPTION_CFR,
656657
OPTION_COMPRESSION,
657658
OPTION_DSYNC,
658659
OPTION_DTHRESHOLD,
@@ -729,6 +730,7 @@ int main_2(int argc, char **argv)
729730
static const struct option long_options[] =
730731
{
731732
{"backend", req_arg, nullptr, OPTION_BACKEND},
733+
{"CFR", no_arg, nullptr, OPTION_CFR},
732734
{"compression", req_arg, nullptr, OPTION_COMPRESSION},
733735
{"Dsync", req_arg, nullptr, OPTION_DSYNC},
734736
{"Dthreshold", req_arg, nullptr, OPTION_DTHRESHOLD},
@@ -787,6 +789,10 @@ int main_2(int argc, char **argv)
787789
case OPTION_BACKEND:
788790
option_backend = optarg;
789791
break;
792+
case OPTION_CFR:
793+
case 'X':
794+
option_CFR = true;
795+
break;
790796
case OPTION_COMPRESSION:
791797
case 'c':
792798
option_compression_level = (unsigned)parseIntOptArg(
@@ -938,9 +944,6 @@ int main_2(int argc, char **argv)
938944
case OPTION_VERSION:
939945
puts("E9Tool " STRING(VERSION));
940946
return EXIT_SUCCESS;
941-
case 'X':
942-
option_CFR = true;
943-
break;
944947
default:
945948
error("failed to parse command-line options; try `--help' "
946949
"for more information");

0 commit comments

Comments
 (0)