win32: add -Wl,--stack=xxx switch

For example:

    $ tcc -Wl,--stack=4194309

which means 4 MB.  Default is 1 MB.
master
grischka 2011-07-11 18:47:16 +02:00
parent 7b573dc239
commit 45184e01d8
3 changed files with 7 additions and 6 deletions

View File

@ -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")) {

1
tcc.h
View File

@ -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;

View File

@ -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)