aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libtcc.c10
-rw-r--r--tcc.h1
-rw-r--r--tccpe.c2
3 files changed, 7 insertions, 6 deletions
diff --git a/libtcc.c b/libtcc.c
index fedd7e5..46a13fc 100644
--- a/libtcc.c
+++ b/libtcc.c
@@ -1551,15 +1551,10 @@ PUB_FUNC const char * tcc_set_linker(TCCState *s, char *option, int multi)
end = NULL;
if (link_option(option, "Bsymbolic", &p)) {
s->symbolic = TRUE;
-#ifdef TCC_TARGET_PE
- } else if (link_option(option, "file-alignment=", &p)) {
- s->pe_file_align = strtoul(p, &end, 16);
-#endif
} else if (link_option(option, "fini=", &p)) {
s->fini_symbol = p;
if (s->warn_unsupported)
warning("ignoring -fini %s", p);
-
} else if (link_option(option, "image-base=", &p)) {
s->text_addr = strtoul(p, &end, 16);
s->has_text_addr = 1;
@@ -1567,7 +1562,6 @@ PUB_FUNC const char * tcc_set_linker(TCCState *s, char *option, int multi)
s->init_symbol = p;
if (s->warn_unsupported)
warning("ignoring -init %s", p);
-
} else if (link_option(option, "oformat=", &p)) {
#if defined(TCC_TARGET_PE)
if (strstart(p, "pe-", NULL)) {
@@ -1599,6 +1593,10 @@ PUB_FUNC const char * tcc_set_linker(TCCState *s, char *option, int multi)
s->soname = p;
multi = 0;
#ifdef TCC_TARGET_PE
+ } else if (link_option(option, "file-alignment=", &p)) {
+ s->pe_file_align = strtoul(p, &end, 16);
+ } else if (link_option(option, "stack=", &p)) {
+ s->pe_stack_size = strtoul(p, &end, 10);
} else if (link_option(option, "subsystem=", &p)) {
#if defined(TCC_TARGET_I386) || defined(TCC_TARGET_X86_64)
if (!strcmp(p, "native")) {
diff --git a/tcc.h b/tcc.h
index c3c1031..ce7ee22 100644
--- a/tcc.h
+++ b/tcc.h
@@ -565,6 +565,7 @@ struct TCCState {
/* PE info */
int pe_subsystem;
unsigned long pe_file_align;
+ unsigned long pe_stack_size;
struct pe_uw {
Section *pdata;
int sym_1, sym_2, offs_1;
diff --git a/tccpe.c b/tccpe.c
index de2575a..ed57c63 100644
--- a/tccpe.c
+++ b/tccpe.c
@@ -686,6 +686,8 @@ static int pe_write(struct pe_info *pe)
pe_header.filehdr.NumberOfSections = pe->sec_count;
pe_header.opthdr.SizeOfHeaders = pe->sizeofheaders;
pe_header.opthdr.ImageBase = pe->imagebase;
+ if (pe->s1->pe_stack_size)
+ pe_header.opthdr.SizeOfStackReserve = pe->s1->pe_stack_size;
if (PE_DLL == pe->type)
pe_header.filehdr.Characteristics = CHARACTERISTICS_DLL;
else if (PE_GUI != pe->type)