diff options
Diffstat (limited to 'libtcc.c')
| -rw-r--r-- | libtcc.c | 22 |
1 files changed, 13 insertions, 9 deletions
@@ -116,7 +116,7 @@ static void tcc_add_systemdir(TCCState *s) } #endif -#if defined TCC_IS_NATIVE && !defined CONFIG_TCC_STATIC +#if defined TCC_IS_NATIVE static void dlclose(void *p) { FreeLibrary((HMODULE)p); @@ -412,7 +412,7 @@ PUB_FUNC void tcc_memstats(int bench) mem_cur_size, mem_max_size); while (header) { - fprintf(stderr, " file %s, line %u: %u bytes\n", + fprintf(stderr, "%s:%u: error: %u bytes leaked\n", header->file_name, header->line_num, header->size); header = header->next; } @@ -1504,14 +1504,21 @@ LIBTCCAPI int tcc_set_output_type(TCCState *s, int output_type) { s->output_type = output_type; + /* always elf for objects */ + if (output_type == TCC_OUTPUT_OBJ) + s->output_format = TCC_OUTPUT_FORMAT_ELF; + + if (s->char_is_unsigned) + tcc_define_symbol(s, "__CHAR_UNSIGNED__", NULL); + if (!s->nostdinc) { /* default include paths */ /* -isystem paths have already been handled */ tcc_add_sysinclude_path(s, CONFIG_TCC_SYSINCLUDEPATHS); } - /* if bound checking, then add corresponding sections */ #ifdef CONFIG_TCC_BCHECK + /* if bound checking, then add corresponding sections */ if (s->do_bounds_check) { /* define symbol */ tcc_define_symbol(s, "__BOUNDS_CHECKING_ON", NULL); @@ -1522,11 +1529,6 @@ LIBTCCAPI int tcc_set_output_type(TCCState *s, int output_type) SHT_PROGBITS, SHF_ALLOC); } #endif - - if (s->char_is_unsigned) { - tcc_define_symbol(s, "__CHAR_UNSIGNED__", NULL); - } - /* add debug sections */ if (s->do_debug) { /* stab symbols */ @@ -1540,9 +1542,11 @@ LIBTCCAPI int tcc_set_output_type(TCCState *s, int output_type) } tcc_add_library_path(s, CONFIG_TCC_LIBPATHS); + #ifdef TCC_TARGET_PE # ifdef _WIN32 - tcc_add_systemdir(s); + if (!s->nostdlib && output_type != TCC_OUTPUT_OBJ) + tcc_add_systemdir(s); # endif #else /* add libc crt1/crti objects */ |
