aboutsummaryrefslogtreecommitdiff
path: root/tccpe.c
diff options
context:
space:
mode:
authorgrischka <grischka>2013-09-10 15:36:56 +0200
committergrischka <grischka>2013-09-10 15:36:56 +0200
commit13b997668e32a4b451783fd80525cf221149c5b3 (patch)
treedd00f33b50483aad1cfa2c1ffdae3aab89e2572a /tccpe.c
parent235a65033f287a6207079875bf7f8bffb458daa1 (diff)
downloadtinycc-13b997668e32a4b451783fd80525cf221149c5b3.tar.gz
tinycc-13b997668e32a4b451783fd80525cf221149c5b3.tar.bz2
win32: fix libtcc support
For "tcc -run file.c", I was trying to initialize the FP control in a function in libtcc1.a (_runmain) before calling main. Unfortunately that turned out to cause problems with for example libtcc_test since such usage doesn't necessarily define a 'main' function. So for tcc -run we're back to relying on the FP control word that is set in the startup code of tcc.exe rsp. libtcc.dll. This fixes part of commit 73faaea227a53e365dd75f1dba7a5071c7b5e541
Diffstat (limited to 'tccpe.c')
-rw-r--r--tccpe.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/tccpe.c b/tccpe.c
index 05fed09..19b20ab 100644
--- a/tccpe.c
+++ b/tccpe.c
@@ -1741,7 +1741,7 @@ static void pe_add_runtime(TCCState *s1, struct pe_info *pe)
start_symbol =
TCC_OUTPUT_MEMORY == s1->output_type
- ? PE_GUI == pe_type ? "__runwinmain" : "__runmain"
+ ? PE_GUI == pe_type ? "__runwinmain" : "_main"
: PE_DLL == pe_type ? PE_STDSYM("__dllstart","@12")
: PE_GUI == pe_type ? "__winstart" : "__start"
;
@@ -1750,7 +1750,7 @@ static void pe_add_runtime(TCCState *s1, struct pe_info *pe)
++start_symbol;
/* grab the startup code from libtcc1 */
- if (start_symbol)
+ if (TCC_OUTPUT_MEMORY != s1->output_type || PE_GUI == pe_type)
add_elf_sym(symtab_section,
0, 0,
ELFW(ST_INFO)(STB_GLOBAL, STT_NOTYPE), 0,
@@ -1775,10 +1775,11 @@ static void pe_add_runtime(TCCState *s1, struct pe_info *pe)
if (TCC_OUTPUT_MEMORY == s1->output_type) {
pe_type = PE_RUN;
s1->runtime_main = start_symbol;
+ } else {
+ pe->start_addr = (DWORD)tcc_get_symbol_err(s1, start_symbol);
}
pe->type = pe_type;
- pe->start_addr = (DWORD)tcc_get_symbol_err(s1, start_symbol);
}
ST_FUNC int pe_output_file(TCCState * s1, const char *filename)