Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
wasm-watermarker
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nagayama15
wasm-watermarker
Commits
7f7ca746
Verified
Commit
7f7ca746
authored
Jan 08, 2021
by
nagayama15
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add witeframe of the method4 embedding tool
parent
54819b62
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
84 additions
and
1 deletion
+84
-1
CMakeLists.txt
src/CMakeLists.txt
+9
-0
kyuk.cpp
src/kyuk.cpp
+75
-0
snpi.cpp
src/snpi.cpp
+0
-1
No files found.
src/CMakeLists.txt
View file @
7f7ca746
...
@@ -16,6 +16,15 @@ target_link_libraries(pisn
...
@@ -16,6 +16,15 @@ target_link_libraries(pisn
cmdline::cmdline
cmdline::cmdline
)
)
add_executable
(
kyuk
kyuk.cpp
)
target_link_libraries
(
kyuk
kyut
cmdline::cmdline
)
add_executable
(
wasm-stat
add_executable
(
wasm-stat
wasm-stat.cpp
wasm-stat.cpp
)
)
...
...
src/kyuk.cpp
0 → 100644
View file @
7f7ca746
#include <fmt/printf.h>
#include "cmdline.h"
#include "wasm-io.h"
namespace
{
const
std
::
string
program_name
=
"kyuk"
;
const
std
::
string
version
=
"0.1.0"
;
}
// namespace
int
main
(
int
argc
,
char
*
argv
[])
{
cmdline
::
parser
options
{};
options
.
add
(
"help"
,
'h'
,
"Print help message"
);
options
.
add
(
"version"
,
'v'
,
"Print version"
);
options
.
add
<
std
::
string
>
(
"output"
,
'o'
,
"Output filename"
,
true
);
options
.
add
<
std
::
string
>
(
"watermark"
,
'w'
,
"Watermark to embed"
,
true
);
options
.
add
(
"debug"
,
'd'
,
"Preserve debug info"
);
options
.
set_program_name
(
program_name
);
options
.
footer
(
"filename"
);
// Parse command line arguments.
// Exit the program if help flag is specified or arguments are invalid.
options
.
parse_check
(
argc
,
argv
);
if
(
options
.
exist
(
"version"
))
{
// Show the program version.
fmt
::
print
(
"{} v{}
\n
"
,
program_name
,
version
);
std
::
exit
(
EXIT_SUCCESS
);
}
if
(
options
.
get
<
std
::
string
>
(
"watermark"
).
empty
())
{
// Zero-length watermark.
fmt
::
print
(
std
::
cerr
,
"no watermark
\n
"
);
fmt
::
print
(
std
::
cerr
,
"{}"
,
options
.
usage
());
std
::
exit
(
EXIT_FAILURE
);
}
if
(
options
.
rest
().
size
()
==
0
)
{
// No input file specified.
fmt
::
print
(
std
::
cerr
,
"no input file
\n
"
);
fmt
::
print
(
std
::
cerr
,
"{}"
,
options
.
usage
());
std
::
exit
(
EXIT_FAILURE
);
}
if
(
options
.
rest
().
size
()
>
1
)
{
// Too many input files.
fmt
::
print
(
std
::
cerr
,
"too many input files
\n
"
);
fmt
::
print
(
std
::
cerr
,
"{}"
,
options
.
usage
());
std
::
exit
(
EXIT_FAILURE
);
}
const
auto
input
=
options
.
rest
()[
0
];
const
auto
output
=
options
.
get
<
std
::
string
>
(
"output"
);
const
auto
watermark
=
options
.
get
<
std
::
string
>
(
"watermark"
);
const
auto
preserve_debug
=
options
.
exist
(
"debug"
);
try
{
wasm
::
Module
module
{};
wasm
::
ModuleReader
{}.
read
(
input
,
module
);
// TODO: Embedding
wasm
::
ModuleWriter
w
{};
w
.
setDebugInfo
(
preserve_debug
);
w
.
writeBinary
(
module
,
output
);
}
catch
(
const
std
::
exception
&
e
)
{
fmt
::
print
(
std
::
cerr
,
"error: {}
\n
"
,
e
.
what
());
std
::
exit
(
EXIT_FAILURE
);
}
catch
(
const
wasm
::
ParseException
&
e
)
{
e
.
dump
(
std
::
cerr
);
std
::
exit
(
EXIT_FAILURE
);
}
}
src/snpi.cpp
View file @
7f7ca746
...
@@ -3,7 +3,6 @@
...
@@ -3,7 +3,6 @@
#include "kyut/methods/ExportReordering.hpp"
#include "kyut/methods/ExportReordering.hpp"
#include "kyut/methods/FunctionReordering.hpp"
#include "kyut/methods/FunctionReordering.hpp"
#include "kyut/methods/OperandSwapping.hpp"
#include "kyut/methods/OperandSwapping.hpp"
#include "support/colors.h"
#include "wasm-io.h"
#include "wasm-io.h"
namespace
{
namespace
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment