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
62b48497
Verified
Commit
62b48497
authored
Jan 02, 2021
by
nagayama15
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add dummy embedding method (that do nothing)
parent
8053699e
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
2 deletions
+5
-2
common.rb
scripts/common.rb
+1
-0
embed.rb
scripts/embed.rb
+1
-1
snpi.cpp
src/snpi.cpp
+3
-1
No files found.
scripts/common.rb
View file @
62b48497
...
...
@@ -28,6 +28,7 @@ METHODS = [
{
:name
=>
"function-reorder"
,
:abbr
=>
"fn"
},
{
:name
=>
"export-reorder"
,
:abbr
=>
"ex"
},
{
:name
=>
"operand-swap"
,
:abbr
=>
"op"
},
{
:name
=>
"null"
,
:abbr
=>
"null"
},
]
OPT_PASSES
=
[
...
...
scripts/embed.rb
View file @
62b48497
...
...
@@ -17,6 +17,6 @@ METHODS.each do |method|
embed
(
file
,
out
,
method
[
:name
],
watermark
)
OPT_PASSES
.
each
{
|
pass
|
optimize
(
out
,
out
.
sub
(
".wasm"
,
"-
#{
pass
}
.wasm"
),
pass
)}
OPT_PASSES
.
each
{
|
pass
|
optimize
(
out
,
out
.
sub
(
".wasm"
,
"-
#{
pass
}
.wasm"
),
pass
)}
if
method
[
:name
]
!=
"null"
end
end
src/snpi.cpp
View file @
62b48497
...
...
@@ -18,7 +18,7 @@ int main(int argc, char* argv[]) {
options
.
add
(
"version"
,
'v'
,
"Print version"
);
options
.
add
<
std
::
string
>
(
"output"
,
'o'
,
"Output filename"
,
true
);
options
.
add
<
std
::
string
>
(
"method"
,
'm'
,
"Embedding method (function-reorder, export-reorder, operand-swap
)"
,
true
,
""
,
cmdline
::
oneof
<
std
::
string
>
(
"function-reorder"
,
"export-reorder"
,
"operand-swap
"
));
options
.
add
<
std
::
string
>
(
"method"
,
'm'
,
"Embedding method (function-reorder, export-reorder, operand-swap
, null)"
,
true
,
""
,
cmdline
::
oneof
<
std
::
string
>
(
"function-reorder"
,
"export-reorder"
,
"operand-swap"
,
"null
"
));
options
.
add
<
std
::
string
>
(
"watermark"
,
'w'
,
"Watermark to embed"
,
true
);
options
.
add
<
std
::
size_t
>
(
"chunk-size"
,
'c'
,
"Chunk size [2~20]"
,
false
,
20
,
cmdline
::
range
<
std
::
size_t
>
(
2
,
20
));
options
.
add
(
"debug"
,
'd'
,
"Preserve debug info"
);
...
...
@@ -77,6 +77,8 @@ int main(int argc, char* argv[]) {
size_bits
=
kyut
::
methods
::
export_reordering
::
embed
(
r
,
module
,
chunk_size
);
}
else
if
(
method
==
"operand-swap"
)
{
size_bits
=
kyut
::
methods
::
operand_swapping
::
embed
(
r
,
module
);
}
else
if
(
method
==
"null"
)
{
size_bits
=
0
;
/* Don't do anything */
}
else
{
WASM_UNREACHABLE
((
"unknown method: "
+
method
).
c_str
());
}
...
...
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