aboutsummaryrefslogtreecommitdiff
path: root/libtcc.c
diff options
context:
space:
mode:
authorgrischka <grischka>2016-10-05 18:34:17 +0200
committergrischka <grischka>2016-10-05 18:34:17 +0200
commitb42cb16b65ed237e6ec30f65d4f9647561515cb8 (patch)
tree4180321ae046754c683079c6e94764c3ab14e072 /libtcc.c
parentb691585785086024549cfb9ac65f3397263965aa (diff)
downloadtinycc-b42cb16b65ed237e6ec30f65d4f9647561515cb8.tar.gz
tinycc-b42cb16b65ed237e6ec30f65d4f9647561515cb8.tar.bz2
Misc. fixes
Makefile : - do not 'uninstall' peoples /usr/local/doc entirely libtcc.c : - MEM_DEBUG : IDE-friendly output "file:line: ..." - always ELF for objects tccgen.c : - fix memory leak in new switch code - move static 'in_sizeof' out of function profiling : - define 'static' to empty resolve_sym() : - replace by dlsym() win32/64: fix R_XXX_RELATIVE fixme - was fixed for i386 already in 8e4d64be2fc1d707c7800c5096f6e0ea22cbd - do not -Lsystemdir if compiling to .o
Diffstat (limited to 'libtcc.c')
-rw-r--r--libtcc.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/libtcc.c b/libtcc.c
index 068a0fc..4e69b4b 100644
--- a/libtcc.c
+++ b/libtcc.c
@@ -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 */