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
  8e4d64be2f
- do not -Lsystemdir if compiling to .o
This commit is contained in:
grischka
2016-10-05 18:34:17 +02:00
parent b691585785
commit b42cb16b65
6 changed files with 44 additions and 32 deletions

View File

@ -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 */