win32: add -Wl,--stack=xxx switch
For example: $ tcc -Wl,--stack=4194309 which means 4 MB. Default is 1 MB.
This commit is contained in:
parent
7b573dc239
commit
45184e01d8
3 changed files with 7 additions and 6 deletions
10
libtcc.c
10
libtcc.c
|
@ -1551,15 +1551,10 @@ PUB_FUNC const char * tcc_set_linker(TCCState *s, char *option, int multi)
|
||||||
end = NULL;
|
end = NULL;
|
||||||
if (link_option(option, "Bsymbolic", &p)) {
|
if (link_option(option, "Bsymbolic", &p)) {
|
||||||
s->symbolic = TRUE;
|
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)) {
|
} else if (link_option(option, "fini=", &p)) {
|
||||||
s->fini_symbol = p;
|
s->fini_symbol = p;
|
||||||
if (s->warn_unsupported)
|
if (s->warn_unsupported)
|
||||||
warning("ignoring -fini %s", p);
|
warning("ignoring -fini %s", p);
|
||||||
|
|
||||||
} else if (link_option(option, "image-base=", &p)) {
|
} else if (link_option(option, "image-base=", &p)) {
|
||||||
s->text_addr = strtoul(p, &end, 16);
|
s->text_addr = strtoul(p, &end, 16);
|
||||||
s->has_text_addr = 1;
|
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;
|
s->init_symbol = p;
|
||||||
if (s->warn_unsupported)
|
if (s->warn_unsupported)
|
||||||
warning("ignoring -init %s", p);
|
warning("ignoring -init %s", p);
|
||||||
|
|
||||||
} else if (link_option(option, "oformat=", &p)) {
|
} else if (link_option(option, "oformat=", &p)) {
|
||||||
#if defined(TCC_TARGET_PE)
|
#if defined(TCC_TARGET_PE)
|
||||||
if (strstart(p, "pe-", NULL)) {
|
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;
|
s->soname = p;
|
||||||
multi = 0;
|
multi = 0;
|
||||||
#ifdef TCC_TARGET_PE
|
#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)) {
|
} else if (link_option(option, "subsystem=", &p)) {
|
||||||
#if defined(TCC_TARGET_I386) || defined(TCC_TARGET_X86_64)
|
#if defined(TCC_TARGET_I386) || defined(TCC_TARGET_X86_64)
|
||||||
if (!strcmp(p, "native")) {
|
if (!strcmp(p, "native")) {
|
||||||
|
|
1
tcc.h
1
tcc.h
|
@ -565,6 +565,7 @@ struct TCCState {
|
||||||
/* PE info */
|
/* PE info */
|
||||||
int pe_subsystem;
|
int pe_subsystem;
|
||||||
unsigned long pe_file_align;
|
unsigned long pe_file_align;
|
||||||
|
unsigned long pe_stack_size;
|
||||||
struct pe_uw {
|
struct pe_uw {
|
||||||
Section *pdata;
|
Section *pdata;
|
||||||
int sym_1, sym_2, offs_1;
|
int sym_1, sym_2, offs_1;
|
||||||
|
|
2
tccpe.c
2
tccpe.c
|
@ -686,6 +686,8 @@ static int pe_write(struct pe_info *pe)
|
||||||
pe_header.filehdr.NumberOfSections = pe->sec_count;
|
pe_header.filehdr.NumberOfSections = pe->sec_count;
|
||||||
pe_header.opthdr.SizeOfHeaders = pe->sizeofheaders;
|
pe_header.opthdr.SizeOfHeaders = pe->sizeofheaders;
|
||||||
pe_header.opthdr.ImageBase = pe->imagebase;
|
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)
|
if (PE_DLL == pe->type)
|
||||||
pe_header.filehdr.Characteristics = CHARACTERISTICS_DLL;
|
pe_header.filehdr.Characteristics = CHARACTERISTICS_DLL;
|
||||||
else if (PE_GUI != pe->type)
|
else if (PE_GUI != pe->type)
|
||||||
|
|
Loading…
Reference in a new issue