diff options
author | Jo-Philipp Wich <jo@mein.io> | 2022-01-15 21:22:37 +0100 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2022-01-18 11:21:20 +0100 |
commit | 371ba457917cf319b74de5a56e17782f6c4cd77a (patch) | |
tree | a5d5e14355c43849daa3236103817f0bb3025955 /compiler.c | |
parent | 6c2caf9fbb9d346cfb20cd5c83875fdff77e584c (diff) |
program: implement support for precompiling source files
- Introduce new command line flags `-o` and `-O` to write compiled program
code into the specified output file
- Add support for transparently executing precompiled files, the
lexical analyzing and com,pilation phase is skipped in this case
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'compiler.c')
-rw-r--r-- | compiler.c | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -2901,6 +2901,22 @@ uc_compile(uc_parse_config_t *config, uc_source_t *source, char **errp) break; + case UC_SOURCE_TYPE_PRECOMPILED: + prog = uc_program_from_file(source->fp, errp); + + if (prog) { + fn = uc_program_entry(prog); + + if (!fn) { + if (errp) + xasprintf(errp, "Program file contains no entry function\n"); + + uc_program_free(prog); + } + } + + break; + default: if (errp) xasprintf(errp, "Unrecognized source type\n"); |