aboutsummaryrefslogtreecommitdiff
path: root/tcc.c
diff options
context:
space:
mode:
authorFrederic Feret <tommy.planet@free.fr>2009-08-27 10:12:13 +0200
committergrischka <grischka>2009-11-13 18:09:00 +0100
commit2f73e42d871e9bed3afccbfd8f4c7098895cc3a3 (patch)
treebc68a7b438121c03a23bc42f8fa462a979731757 /tcc.c
parent526c4645048fa469a2941c86a09f4f851a96eb91 (diff)
downloadtinycc-2f73e42d871e9bed3afccbfd8f4c7098895cc3a3.tar.gz
tinycc-2f73e42d871e9bed3afccbfd8f4c7098895cc3a3.tar.bz2
various fixes and new options for PE format
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;