various fixes and new options for PE format
This commit is contained in:
39
tcc.c
39
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;
|
||||
|
||||
Reference in New Issue
Block a user