build: build core/run.cc

Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
run: add helper for running with a vector<string> argv

Much easier than constructing a traditional argc/argv.

Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
run: save optind across invocations

optind is a global variable that is expected to be zero-initialized by
getopt().  Running one object after another violates this, if both use
getopt().

Fix by saving the value of optind across calls.

Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
Merge branch 'run-fixes'

Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
libc: implement sync()

Signed-off-by: Avi Kivity <avi@cloudius-systems.com>