aboutsummaryrefslogtreecommitdiff
path: root/tcc.c
diff options
context:
space:
mode:
Diffstat (limited to 'tcc.c')
-rw-r--r--tcc.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/tcc.c b/tcc.c
index 501dc01..76c3469 100644
--- a/tcc.c
+++ b/tcc.c
@@ -386,8 +386,47 @@ int parse_args(TCCState *s, int argc, char **argv)
if (strstart(optarg, "-Ttext,", &p)) {
s->text_addr = strtoul(p, NULL, 16);
s->has_text_addr = 1;
+ } else if (strstart(optarg, "--section-alignment,", &p)) {
+ s->section_align = strtoul(p, NULL, 16);
+ } else if (strstart(optarg, "--image-base,", &p)) {
+ s->text_addr = strtoul(p, NULL, 16);
+ s->has_text_addr = 1;
+#ifdef TCC_TARGET_PE
+ } else if (strstart(optarg, "--file-alignment,", &p)) {
+ s->pe_file_align = strtoul(p, NULL, 16);
+ } else if (strstart(optarg, "--subsystem,", &p)) {
+#if defined(TCC_TARGET_I386) || defined(TCC_TARGET_X86_64)
+ if (!strcmp(p, "native"))
+ s->pe_subsystem = 1;
+ else if (!strcmp(p, "console"))
+ s->pe_subsystem = 3;
+ else if (!strcmp(p, "gui"))
+ s->pe_subsystem = 2;
+ else if (!strcmp(p, "posix"))
+ s->pe_subsystem = 7;
+ else if (!strcmp(p, "efiapp"))
+ s->pe_subsystem = 10;
+ else if (!strcmp(p, "efiboot"))
+ s->pe_subsystem = 11;
+ else if (!strcmp(p, "efiruntime"))
+ s->pe_subsystem = 12;
+ else if (!strcmp(p, "efirom"))
+ s->pe_subsystem = 13;
+#endif
+ else {
+ error("invalid subsystem '%s'", p);
+ }
+#endif
} else if (strstart(optarg, "--oformat,", &p)) {
+#if defined(TCC_TARGET_PE)
+ if (strstart(p, "pe-", NULL)) {
+#else
+#if defined(TCC_TARGET_X86_64)
+ if (strstart(p, "elf64-", NULL)) {
+#else
if (strstart(p, "elf32-", NULL)) {
+#endif
+#endif
s->output_format = TCC_OUTPUT_FORMAT_ELF;
} else if (!strcmp(p, "binary")) {
s->output_format = TCC_OUTPUT_FORMAT_BINARY;