-
Notifications
You must be signed in to change notification settings - Fork 10
Manifest
The manifest for slash
should be valid JSON. The following keys have meaning:
-
main
: a path to the bitcode module containing themain
entry point. -
modules
: a list of paths to the other bitcode modules needed. -
binary
: the name of the desired executable. -
native_libs
: a list of flags (-lm
,-lc
,-lpthread
) or paths to native objects (.o
,.a
,.so
,.dylib
) -
ldflags
: a list of linker flags such as--static
,--nostdlib
-
name
: the program name -
static_args
: the list of static arguments you wish to specialize in the main() ofmain
. -
dynamic_args
: a number that indicates the arguments the specialized program will receive at runtime. If this key is omitted then the default value is 0 which means that the specialized program does not expect any parameter. -
lib_spec
: list of library bitcode you wish to specialize with respect tomain
or a list ofmain
functions given bymain_spec
. -
main_spec
: list of bitcode modules each containing amain
function used bylib_spec
.
As an example, (see examples/linux/apache
), to previrtualize apache:
{ "main" : "httpd.bc"
, "binary" : "httpd_slashed"
, "modules" : ["libapr-1.so.bc", "libaprutil-1.so.bc", "libpcre.so.bc"]
, "native_libs" : ["-lcrypt", "-ldl", "-lpthread"]
, "name" : "httpd"
, "static_args" : ["-d", "/var/www"]
}
Another example, (see examples/linux/musl_nweb
), specializes nweb
with musl libc.c
:
{ "main" : "nweb.o.bc"
, "binary" : "nweb_razor"
, "modules" : ["libc.a.bc"]
, "native_libs" : ["crt1.o", "libc.a"]
, "ldflags" : ["-static", "-nostdlib"]
, "name" : "nweb"
, "static_args" : ["8181", "./root"]
, "dynamic_args" : "0"
}
A third example, (see examples/linux/tree
), illustrates the use of
the dynamic_args
field to partially specialize the arguments to the
tree
utility.
{ "main" : "tree.bc"
, "binary" : "tree"
, "modules" : []
, "native_libs" : []
, "ldflags" : [ "-O2" ]
, "name" : "tree"
, "static_args" : ["-J", "-h"]
, "dynamic_args" : "1"
}
The specialized program will output its results in JSON notation (-J) that will include a human readable size field (-h). The specialized program expects one extra argument, either a directory or another flag to output the contents of the current working directory.